From a90642712b7ee961ab1d7653d1a85ca758df918d Mon Sep 17 00:00:00 2001 From: donoban Date: Mon, 15 Mar 2021 15:13:59 +0100 Subject: [PATCH] Added parent to all __init__() --- qubesmanager/about.py | 22 ++++++++++------------ qubesmanager/informationnotes.py | 4 ++-- qubesmanager/qube_manager.py | 12 ++++++------ qubesmanager/releasenotes.py | 4 ++-- qubesmanager/template_manager.py | 2 +- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/qubesmanager/about.py b/qubesmanager/about.py index da3f398..f8b9b03 100644 --- a/qubesmanager/about.py +++ b/qubesmanager/about.py @@ -30,8 +30,8 @@ from . import ui_about # pylint: disable=no-name-in-module # pylint: disable=too-few-public-methods class AboutDialog(ui_about.Ui_AboutDialog, QDialog): - def __init__(self): - super().__init__() + def __init__(self, parent=None): + super().__init__(parent) self.setupUi(self) @@ -40,15 +40,13 @@ class AboutDialog(ui_about.Ui_AboutDialog, QDialog): self.release.setText(release_file.read()) self.ok.clicked.connect(self.accept) - self.releaseNotes.clicked.connect(on_release_notes_clicked) - self.informationNotes.clicked.connect(on_information_notes_clicked) + self.releaseNotes.clicked.connect(self.on_release_notes_clicked) + self.informationNotes.clicked.connect(self.on_information_notes_clicked) + def on_release_notes_clicked(self): + release_notes_dialog = ReleaseNotesDialog(self) + release_notes_dialog.exec_() -def on_release_notes_clicked(): - release_notes_dialog = ReleaseNotesDialog() - release_notes_dialog.exec_() - - -def on_information_notes_clicked(): - information_notes_dialog = InformationNotesDialog() - information_notes_dialog.exec_() + def on_information_notes_clicked(self): + information_notes_dialog = InformationNotesDialog(self) + information_notes_dialog.exec_() diff --git a/qubesmanager/informationnotes.py b/qubesmanager/informationnotes.py index 4383aac..755be5b 100644 --- a/qubesmanager/informationnotes.py +++ b/qubesmanager/informationnotes.py @@ -29,8 +29,8 @@ import subprocess class InformationNotesDialog(ui_informationnotes.Ui_InformationNotesDialog, QDialog): # pylint: disable=too-few-public-methods - def __init__(self): - super().__init__() + def __init__(self, parent=None): + super().__init__(parent) self.setupUi(self) details = subprocess.check_output( diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index e9e61df..330bb53 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -1275,7 +1275,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow): @pyqtSlot(name='on_action_createvm_triggered') def action_createvm_triggered(self): with common_threads.busy_cursor(): - create_window = create_new_vm.NewVmDlg(self.qt_app, self.qubes_app) + create_window = create_new_vm.NewVmDlg(self.qt_app, self.qubes_app, self) create_window.exec_() # noinspection PyArgumentList @@ -1493,8 +1493,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow): try: with common_threads.busy_cursor(): settings_window = settings.VMSettingsWindow( - vm, init_page=tab, qapp=self.qt_app, - qubesapp=self.qubes_app) + vm, tab, self.qt_app, self.qubes_app, self) settings_window.show() self.settings_windows[vm.name] = settings_window except exc.QubesException as ex: @@ -1597,7 +1596,8 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow): with common_threads.busy_cursor(): global_settings_window = global_settings.GlobalSettingsWindow( self.qt_app, - self.qubes_app) + self.qubes_app, + self) global_settings_window.show() self.settings_windows['global_settings_window'] = global_settings_window @@ -1620,7 +1620,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow): def action_restore_triggered(self): with common_threads.busy_cursor(): restore_window = restore.RestoreVMsWindow(self.qt_app, - self.qubes_app) + self.qubes_app, self) restore_window.exec_() # noinspection PyArgumentList @@ -1670,7 +1670,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow): # noinspection PyArgumentList @pyqtSlot(name='on_action_about_qubes_triggered') def action_about_qubes_triggered(self): # pylint: disable=no-self-use - about = AboutDialog() + about = AboutDialog(self) about.exec_() def createPopupMenu(self): # pylint: disable=invalid-name diff --git a/qubesmanager/releasenotes.py b/qubesmanager/releasenotes.py index b91fb57..7c30caf 100644 --- a/qubesmanager/releasenotes.py +++ b/qubesmanager/releasenotes.py @@ -27,8 +27,8 @@ from . import ui_releasenotes # pylint: disable=no-name-in-module class ReleaseNotesDialog(ui_releasenotes.Ui_ReleaseNotesDialog, QDialog): # pylint: disable=too-few-public-methods - def __init__(self): - super().__init__() + def __init__(self, parent=None): + super().__init__(parent) self.setupUi(self) diff --git a/qubesmanager/template_manager.py b/qubesmanager/template_manager.py index 6ed44e0..4536df6 100644 --- a/qubesmanager/template_manager.py +++ b/qubesmanager/template_manager.py @@ -35,7 +35,7 @@ class TemplateManagerWindow( def __init__(self, qt_app, qubes_app, dispatcher, parent=None): # pylint: disable=unused-argument - super().__init__() + super().__init__(parent) self.setupUi(self) self.qubes_app = qubes_app