diff --git a/src/urh/controller/MainController.py b/src/urh/controller/MainController.py index f24e6fb263..3d23fb079f 100644 --- a/src/urh/controller/MainController.py +++ b/src/urh/controller/MainController.py @@ -147,6 +147,8 @@ def __init__(self, *args): self.ui.actionSave_project.setVisible(False) self.ui.actionClose_project.setVisible(False) + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) + def __set_non_project_warning_visibility(self): show = settings.read("show_non_project_warning", True, bool) and not self.project_manager.project_loaded self.ui.labelNonProjectMode.setVisible(show) @@ -415,6 +417,7 @@ def set_frame_numbers(self): def closeEvent(self, event: QCloseEvent): self.save_project() + settings.write("{}/geometry".format(self.__class__.__name__), self.saveGeometry()) super().closeEvent(event) def close_all_files(self): diff --git a/src/urh/controller/dialogs/DecoderDialog.py b/src/urh/controller/dialogs/DecoderDialog.py index de0813fe07..bdf976527a 100644 --- a/src/urh/controller/dialogs/DecoderDialog.py +++ b/src/urh/controller/dialogs/DecoderDialog.py @@ -90,11 +90,7 @@ def __init__(self, decodings, signals, project_manager: ProjectManager, # Connects self.create_connects() - - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) def create_connects(self): self.ui.inpt.textChanged.connect(self.decoder_update) diff --git a/src/urh/controller/dialogs/FuzzingDialog.py b/src/urh/controller/dialogs/FuzzingDialog.py index fa7b096bf9..f06543589d 100644 --- a/src/urh/controller/dialogs/FuzzingDialog.py +++ b/src/urh/controller/dialogs/FuzzingDialog.py @@ -44,11 +44,7 @@ def __init__(self, protocol: ProtocolAnalyzerContainer, label_index: int, msg_in self.ui.tblFuzzingValues.resize_me() self.create_connects() - - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) @property def message(self): diff --git a/src/urh/controller/dialogs/MessageTypeDialog.py b/src/urh/controller/dialogs/MessageTypeDialog.py index 0e447232ed..f1431329e9 100644 --- a/src/urh/controller/dialogs/MessageTypeDialog.py +++ b/src/urh/controller/dialogs/MessageTypeDialog.py @@ -47,11 +47,7 @@ def __init__(self, message_type: MessageType, parent=None): self.ui.cbRulesetMode.setCurrentIndex(self.message_type.ruleset.mode.value) self.create_connects() - - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) def create_connects(self): self.ui.btnAddRule.clicked.connect(self.on_btn_add_rule_clicked) diff --git a/src/urh/controller/dialogs/ModulatorDialog.py b/src/urh/controller/dialogs/ModulatorDialog.py index 27853e432e..2fcc5530fb 100644 --- a/src/urh/controller/dialogs/ModulatorDialog.py +++ b/src/urh/controller/dialogs/ModulatorDialog.py @@ -63,11 +63,7 @@ def __init__(self, modulators, tree_model=None, parent=None): QLineEdit.TrailingPosition) self.create_connects() - - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) self.set_bits_per_symbol_enabled_status() self.set_modulation_profile_status() diff --git a/src/urh/controller/dialogs/OptionsDialog.py b/src/urh/controller/dialogs/OptionsDialog.py index aed71f44d3..7e475d3c94 100644 --- a/src/urh/controller/dialogs/OptionsDialog.py +++ b/src/urh/controller/dialogs/OptionsDialog.py @@ -219,11 +219,7 @@ def __init__(self, installed_plugins, highlighted_plugins=None, parent=None): self.ui.labelRebuildNativeStatus.setText("") self.show_available_colormaps() - - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) def create_connects(self): self.ui.doubleSpinBoxFuzzingPause.valueChanged.connect(self.on_spinbox_fuzzing_pause_value_changed) diff --git a/src/urh/controller/dialogs/ProjectDialog.py b/src/urh/controller/dialogs/ProjectDialog.py index 751bd49a8a..b78c29693b 100644 --- a/src/urh/controller/dialogs/ProjectDialog.py +++ b/src/urh/controller/dialogs/ProjectDialog.py @@ -75,11 +75,7 @@ def __init__(self, new_project=True, project_manager: ProjectManager = None, par self.ui.lineEdit_Path.setText(os.path.realpath(os.path.join(os.curdir, "new"))) self.on_line_edit_path_text_edited() - - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) @property def participants(self): diff --git a/src/urh/controller/dialogs/ProtocolLabelDialog.py b/src/urh/controller/dialogs/ProtocolLabelDialog.py index 781f3f0ad4..e6db628917 100644 --- a/src/urh/controller/dialogs/ProtocolLabelDialog.py +++ b/src/urh/controller/dialogs/ProtocolLabelDialog.py @@ -64,10 +64,7 @@ def __init__(self, message: Message, viewtype: int, selected_index=None, parent= self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowFlags(Qt.Window) - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) for i in range(self.model.rowCount()): self.open_editors(i) diff --git a/src/urh/controller/dialogs/SendRecvDialog.py b/src/urh/controller/dialogs/SendRecvDialog.py index a9c77515be..07c030590e 100644 --- a/src/urh/controller/dialogs/SendRecvDialog.py +++ b/src/urh/controller/dialogs/SendRecvDialog.py @@ -56,11 +56,7 @@ def __init__(self, project_manager: ProjectManager, is_tx: bool, continuous_send self.device_settings_widget.ui.cbDevice.setCurrentText(NetworkSDRInterfacePlugin.NETWORK_SDR_NAME) self.timer = QTimer(self) - - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) self.ui.splitter.setSizes([int(0.4 * self.width()), int(0.6 * self.width())]) diff --git a/src/urh/controller/dialogs/SignalDetailsDialog.py b/src/urh/controller/dialogs/SignalDetailsDialog.py index 8921974a22..894fdf6904 100644 --- a/src/urh/controller/dialogs/SignalDetailsDialog.py +++ b/src/urh/controller/dialogs/SignalDetailsDialog.py @@ -38,11 +38,7 @@ def __init__(self, signal, parent=None): self.set_duration() self.ui.dsb_sample_rate.valueChanged.connect(self.on_dsb_sample_rate_value_changed) - - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) def closeEvent(self, event: QCloseEvent): settings.write("{}/geometry".format(self.__class__.__name__), self.saveGeometry()) diff --git a/src/urh/controller/widgets/PluginFrame.py b/src/urh/controller/widgets/PluginFrame.py index 2845704594..936e3e706f 100644 --- a/src/urh/controller/widgets/PluginFrame.py +++ b/src/urh/controller/widgets/PluginFrame.py @@ -21,10 +21,7 @@ def __init__(self, plugins, highlighted_plugins=None, parent=None): self.ui.groupBoxSettings.setLayout(self.settings_layout) self.create_connects() - try: - self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__))) - except TypeError: - pass + self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes)) def create_connects(self): diff --git a/src/urh/main.py b/src/urh/main.py index 7be2d3ea62..65af040422 100755 --- a/src/urh/main.py +++ b/src/urh/main.py @@ -166,8 +166,10 @@ def main(): import ctypes ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("jopohl.urh") - main_window.showMaximized() - # main_window.setFixedSize(1920, 1080 - 30) # Youtube + if settings.read("MainController/geometry", type=bytes): + main_window.show() + else: + main_window.showMaximized() if "autoclose" in sys.argv[1:]: # Autoclose after 1 second, this is useful for automated testing