summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-10-05 04:10:50 +0900
committerkali <kali@leap.se>2012-10-05 04:10:50 +0900
commit51dee24be94567334dfb8765cbd3bb23dcae9ee3 (patch)
tree353978aa2f7fb3b51791ffbcf62bacea8e9c947a
parentc06d7e25649cc76dfe7418a520dc823270a3191f (diff)
init QSettings - save window geometry
-rw-r--r--src/leap/app.py8
-rw-r--r--src/leap/baseapp/leap_app.py10
-rw-r--r--src/leap/baseapp/mainwindow.py7
3 files changed, 23 insertions, 2 deletions
diff --git a/src/leap/app.py b/src/leap/app.py
index 3170de4a..a5e09d80 100644
--- a/src/leap/app.py
+++ b/src/leap/app.py
@@ -50,6 +50,14 @@ def main():
logger.info('Starting app')
app = QApplication(sys.argv)
+ # needed for initializing qsettings
+ # it will write .config/leap/leap.conf
+ # top level app settings
+ # in a platform independent way
+ app.setOrganizationName("leap")
+ app.setApplicationName("leap")
+ app.setOrganizationDomain("leap.se")
+
if not QSystemTrayIcon.isSystemTrayAvailable():
QMessageBox.critical(None, "Systray",
"I couldn't detect"
diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py
index 98ca292e..49f7ceda 100644
--- a/src/leap/baseapp/leap_app.py
+++ b/src/leap/baseapp/leap_app.py
@@ -1,5 +1,9 @@
import logging
+import sip
+sip.setapi('QVariant', 2)
+
+from PyQt4 import QtCore
from PyQt4 import QtGui
from leap.gui import mainwindow_rc
@@ -35,7 +39,7 @@ class MainWindowMixin(object):
self.setWindowTitle("LEAP Client")
self.set_app_icon()
- self.resize(400, 300)
+ #self.resize(400, 300)
self.set_statusbarMessage('ready')
logger.debug('set ready.........')
@@ -88,6 +92,10 @@ class MainWindowMixin(object):
"""
cleans state before shutting down app.
"""
+ # save geometry for restoring
+ settings = QtCore.QSettings()
+ settings.setValue("Geometry", self.saveGeometry())
+
# TODO:make sure to shutdown all child process / threads
# in conductor
# XXX send signal instead?
diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py
index 55be55f7..d3656cd4 100644
--- a/src/leap/baseapp/mainwindow.py
+++ b/src/leap/baseapp/mainwindow.py
@@ -30,14 +30,19 @@ class LeapWindow(QtGui.QMainWindow,
def __init__(self, opts):
logger.debug('init leap window')
self.debugmode = getattr(opts, 'debug', False)
-
super(LeapWindow, self).__init__()
if self.debugmode:
self.createLogBrowser()
+
EIPConductorAppMixin.__init__(self, opts=opts)
StatusAwareTrayIconMixin.__init__(self)
MainWindowMixin.__init__(self)
+ settings = QtCore.QSettings()
+ geom = settings.value("Geometry")
+ if geom:
+ self.restoreGeometry(geom)
+
self.initchecks = InitChecksThread(self.run_eip_checks)
# bind signals