summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Singleton <matt@xcolour.net>2020-09-06 17:23:18 -0500
committerMatt Singleton <matt@xcolour.net>2020-09-06 17:23:18 -0500
commit8e209427f5f08bb2ff57d657fb00f88117d4396b (patch)
treec275d20af489651cc48238c6e5a05d52e65cec19
parente46b842ba4a663ce14addc61d9f902f40f7f3c44 (diff)
restore window state and geometry
-rwxr-xr-xbrowser.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/browser.py b/browser.py
index c9bdc55..58b650c 100755
--- a/browser.py
+++ b/browser.py
@@ -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_())