diff options
author | Matt Singleton <matt@xcolour.net> | 2020-09-06 17:23:18 -0500 |
---|---|---|
committer | Matt Singleton <matt@xcolour.net> | 2020-09-06 17:23:18 -0500 |
commit | 8e209427f5f08bb2ff57d657fb00f88117d4396b (patch) | |
tree | c275d20af489651cc48238c6e5a05d52e65cec19 | |
parent | e46b842ba4a663ce14addc61d9f902f40f7f3c44 (diff) |
restore window state and geometry
-rwxr-xr-x | browser.py | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -77,15 +77,16 @@ class GBrowser(QtWidgets.QMainWindow): def __init__(self): QtWidgets.QMainWindow.__init__(self) - self.initUI() + self.init_ui() - def initUI(self): + def init_ui(self): self.statusBar().showMessage('Ready') back = QtWidgets.QPushButton("back") forward = QtWidgets.QPushButton("forward") address = GUrlBar() toolbar = QtWidgets.QToolBar() + toolbar.setObjectName('navigationToolbar') toolbar.addWidget(back) toolbar.addWidget(forward) toolbar.addWidget(address) @@ -102,10 +103,18 @@ class GBrowser(QtWidgets.QMainWindow): browser.setSource(QtCore.QUrl('gemini://gemini.circumlunar.space/')) - self.setGeometry(10, 10, 1024, 750) + settings = QtCore.QSettings("xcolour.net", "GeminiBrowser") + self.restoreGeometry(settings.value("geometry")) + self.restoreState(settings.value("windowState")) self.setWindowTitle('Gemini Browser') self.show() + def closeEvent(self, event): + settings = QtCore.QSettings("xcolour.net", "GeminiBrowser") + settings.setValue("geometry", self.saveGeometry()) + settings.setValue("windowState", self.saveState()) + super().closeEvent(event) + app = QtWidgets.QApplication(sys.argv) ex = GBrowser() sys.exit(app.exec_()) |