diff --git a/beat/editor/scripts/editor_cli.py b/beat/editor/scripts/editor_cli.py index 94980f238300a7209207f39975245e64e1cb317d..d85bc57c54fe548afd14048e7915f4324b51f63f 100644 --- a/beat/editor/scripts/editor_cli.py +++ b/beat/editor/scripts/editor_cli.py @@ -36,6 +36,7 @@ import pkg_resources from click_plugins import with_plugins from PyQt5.QtWidgets import QApplication +from PyQt5.QtCore import QCoreApplication from beat.cmdline.click_helper import AliasedGroup from beat.cmdline.config import Configuration @@ -98,6 +99,11 @@ def start(ctx, prefix, cache): logger.info("BEAT cache set to `%s'", config.cache) app = QApplication(sys.argv) + + QCoreApplication.setApplicationName("beat.editor") + QCoreApplication.setOrganizationName("Idiap") + QCoreApplication.setOrganizationDomain("ch.idiap") + mainwindow = MainWindow() mainwindow.set_prefix_root(config.path) mainwindow.show() diff --git a/beat/editor/widgets/mainwindow.py b/beat/editor/widgets/mainwindow.py index b7ed7c0cdeabfcdf202db2889b11e47896ff2a0b..778fbc53107b0afed062508df391d6c35810aa16 100644 --- a/beat/editor/widgets/mainwindow.py +++ b/beat/editor/widgets/mainwindow.py @@ -27,6 +27,7 @@ from PyQt5.QtWidgets import QHBoxLayout from PyQt5.QtWidgets import QMainWindow from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import qApp +from PyQt5.QtCore import QSettings from .assetbrowser import AssetBrowser from .assetwidget import AssetWidget @@ -42,6 +43,13 @@ 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,3 +79,9 @@ class MainWindow(QMainWindow): def show_settings(self): """Show settings dialog""" pass + + def closeEvent(self, event): + settings = QSettings() + settings.setValue("geometry", self.saveGeometry()) + settings.setValue("windowState", self.saveState()) + QMainWindow.closeEvent(self, event)