From d22c06c07e5cf41964442bf0037cbb68c5aaf61e Mon Sep 17 00:00:00 2001 From: Ettore Dreucci Date: Sat, 9 Jan 2021 15:43:06 +0100 Subject: [PATCH] Refactored LogDialog with *args and **kwds Signed-off-by: Ettore Dreucci --- fatture_ccsr/fatture_ccsr.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fatture_ccsr/fatture_ccsr.py b/fatture_ccsr/fatture_ccsr.py index 5dd0b00..508c50c 100644 --- a/fatture_ccsr/fatture_ccsr.py +++ b/fatture_ccsr/fatture_ccsr.py @@ -131,13 +131,13 @@ class FattureCCSRFrame(wx.Frame): pass elif btn_id == DOWNLOAD_ACTION: - self.log_dialog = LogDialog(self, "Download delle fatture dal portale CCSR", DOWNLOAD_ACTION) + self.log_dialog = LogDialog(self, action = DOWNLOAD_ACTION) self.log_dialog.Show() downloader.download_invoices(self) self.log_dialog.close_btn.Enable() elif btn_id == CONVERT_ACTION: - self.log_dialog = LogDialog(self, "Conversione delle fatture in TRAF2000", CONVERT_ACTION) + self.log_dialog = LogDialog(self, action = CONVERT_ACTION) self.log_dialog.Show() traf2000_converter.convert(self) self.log_dialog.close_btn.Enable() @@ -149,8 +149,12 @@ class FattureCCSRFrame(wx.Frame): class LogDialog(wx.Dialog): """logging panel""" - def __init__(self, parent, title, action): - super(LogDialog, self).__init__(parent, wx.ID_ANY, title, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) + def __init__(self, *args, **kwds): + kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER + action = kwds.pop('action', -1) + + wx.Dialog.__init__(self, *args, **kwds) + self.SetTitle("Log") main_sizer = wx.BoxSizer(wx.VERTICAL)