summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/leap_app.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/baseapp/leap_app.py')
-rw-r--r--src/leap/baseapp/leap_app.py58
1 files changed, 53 insertions, 5 deletions
diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py
index 208c4e7c..460d1269 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
@@ -23,22 +27,62 @@ class MainWindowMixin(object):
widget = QtGui.QWidget()
self.setCentralWidget(widget)
- self.createWindowHeader()
-
- # add widgets to layout
mainLayout = QtGui.QVBoxLayout()
- mainLayout.addWidget(self.headerBox)
+ # add widgets to layout
+ #self.createWindowHeader()
+ #mainLayout.addWidget(self.headerBox)
mainLayout.addWidget(self.statusIconBox)
if self.debugmode:
mainLayout.addWidget(self.statusBox)
mainLayout.addWidget(self.loggerBox)
widget.setLayout(mainLayout)
+ self.createMainActions()
+ self.createMainMenus()
+
self.setWindowTitle("LEAP Client")
self.set_app_icon()
- self.resize(400, 300)
self.set_statusbarMessage('ready')
+ def createMainActions(self):
+ #self.openAct = QtGui.QAction("&Open...", self, shortcut="Ctrl+O",
+ #triggered=self.open)
+
+ self.firstRunWizardAct = QtGui.QAction(
+ "&First run wizard...", self,
+ triggered=self.launch_first_run_wizard)
+ self.aboutAct = QtGui.QAction("&About", self, triggered=self.about)
+
+ #self.aboutQtAct = QtGui.QAction("About &Qt", self,
+ #triggered=QtGui.qApp.aboutQt)
+
+ def createMainMenus(self):
+ self.connMenu = QtGui.QMenu("&Connections", self)
+ #self.viewMenu.addSeparator()
+ self.connMenu.addAction(self.quitAction)
+
+ self.settingsMenu = QtGui.QMenu("&Settings", self)
+ self.settingsMenu.addAction(self.firstRunWizardAct)
+
+ self.helpMenu = QtGui.QMenu("&Help", self)
+ self.helpMenu.addAction(self.aboutAct)
+ #self.helpMenu.addAction(self.aboutQtAct)
+
+ self.menuBar().addMenu(self.connMenu)
+ self.menuBar().addMenu(self.settingsMenu)
+ self.menuBar().addMenu(self.helpMenu)
+
+ def launch_first_run_wizard(self):
+ settings = QtCore.QSettings()
+ settings.setValue('FirstRunWizardDone', False)
+ logger.debug('should run first run wizard again...')
+
+ from leap.gui.firstrunwizard import FirstRunWizard
+ wizard = FirstRunWizard(
+ parent=self,
+ success_cb=self.initReady.emit)
+ wizard.show()
+
def set_app_icon(self):
icon = QtGui.QIcon(APP_LOGO)
self.setWindowIcon(icon)
@@ -88,6 +132,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?