diff --git a/beat/editor/widgets/mainwindow.py b/beat/editor/widgets/mainwindow.py index 778fbc53107b0afed062508df391d6c35810aa16..ab024698ae7200b587d6baaa570b89d759fe5bbe 100644 --- a/beat/editor/widgets/mainwindow.py +++ b/beat/editor/widgets/mainwindow.py @@ -43,13 +43,6 @@ class MainWindow(QMainWindow): super(MainWindow, self).__init__(parent) - # MainWindow settings - settings = QSettings() - if settings.value("geometry") is not None: - self.restoreGeometry(settings.value("geometry")) - if settings.value("windowState") is not None: - self.restoreState(settings.value("windowState")) - menubar = self.menuBar() fileMenu = menubar.addMenu(self.tr("File")) quitAction = fileMenu.addAction(self.tr("Quit")) @@ -71,6 +64,8 @@ class MainWindow(QMainWindow): self.assetBrowser.json_selected.connect(self.assetWidget.show_json) settingsAction.triggered.connect(self.show_settings) + self.load_settings() + def set_prefix_root(self, prefix_root_path): """Sets the root path of the prefix to edit""" @@ -80,8 +75,19 @@ class MainWindow(QMainWindow): """Show settings dialog""" pass - def closeEvent(self, event): + def save_settings(self): settings = QSettings() settings.setValue("geometry", self.saveGeometry()) settings.setValue("windowState", self.saveState()) + + def load_settings(self): + # MainWindow settings + settings = QSettings() + if settings.value("geometry") is not None: + self.restoreGeometry(settings.value("geometry")) + if settings.value("windowState") is not None: + self.restoreState(settings.value("windowState")) + + def closeEvent(self, event): + self.save_settings() QMainWindow.closeEvent(self, event)