Remember main window geometry and state on exit
Main window geometry and state is saved on exit and restored on load. Uses default QSettings in python.
This commit is contained in:
parent
b776eb7f36
commit
3911525d75
|
@ -724,6 +724,8 @@ class MyForm(QtGui.QMainWindow):
|
||||||
QtCore.QObject.connect(self.ui.horizontalSliderTTL, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.ui.horizontalSliderTTL, QtCore.SIGNAL(
|
||||||
"valueChanged(int)"), self.updateTTL)
|
"valueChanged(int)"), self.updateTTL)
|
||||||
|
|
||||||
|
self.readSettings()
|
||||||
|
|
||||||
# Check to see whether we can connect to namecoin. Hide the 'Fetch Namecoin ID' button if we can't.
|
# Check to see whether we can connect to namecoin. Hide the 'Fetch Namecoin ID' button if we can't.
|
||||||
try:
|
try:
|
||||||
options = {}
|
options = {}
|
||||||
|
@ -2741,6 +2743,11 @@ class MyForm(QtGui.QMainWindow):
|
||||||
# unregister the messaging system
|
# unregister the messaging system
|
||||||
if self.mmapp is not None:
|
if self.mmapp is not None:
|
||||||
self.mmapp.unregister()
|
self.mmapp.unregister()
|
||||||
|
|
||||||
|
settings = QSettings("Mailchuck Ltd.", "PyBitmessage")
|
||||||
|
settings.setValue("geometry", self.saveGeometry())
|
||||||
|
settings.setValue("state", self.saveState())
|
||||||
|
|
||||||
self.statusBar().showMessage(_translate(
|
self.statusBar().showMessage(_translate(
|
||||||
"MainWindow", "All done. Closing user interface..."))
|
"MainWindow", "All done. Closing user interface..."))
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
@ -3584,6 +3591,20 @@ class MyForm(QtGui.QMainWindow):
|
||||||
|
|
||||||
self.statusBar().showMessage(data)
|
self.statusBar().showMessage(data)
|
||||||
|
|
||||||
|
def readSettings(self):
|
||||||
|
settings = QSettings("Mailchuck Ltd.", "PyBitmessage")
|
||||||
|
try:
|
||||||
|
geom = settings.value("geometry")
|
||||||
|
self.restoreGeometry(geom.toByteArray() if hasattr(geom, 'toByteArray') else geom)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
state = settings.value("state")
|
||||||
|
self.restoreState(state.toByteArray() if hasattr(state, 'toByteArray') else state)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class helpDialog(QtGui.QDialog):
|
class helpDialog(QtGui.QDialog):
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user