From 3e2eb0cb1878a9494650ea1278ef2f9211ebdaac Mon Sep 17 00:00:00 2001
From: kali <kali@leap.se>
Date: Fri, 5 Oct 2012 10:10:04 +0900
Subject: add menu for running wizard at will

it's still buggy in that it does not bother to stop
the ongoing checks or connection. we should take care of that soon.
---
 src/leap/baseapp/leap_app.py   | 46 +++++++++++++++++++++++++++++++++++++++---
 src/leap/gui/firstrunwizard.py |  8 ++++----
 2 files changed, 47 insertions(+), 7 deletions(-)

(limited to 'src')

diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py
index 49f7ceda..460d1269 100644
--- a/src/leap/baseapp/leap_app.py
+++ b/src/leap/baseapp/leap_app.py
@@ -27,9 +27,9 @@ class MainWindowMixin(object):
         widget = QtGui.QWidget()
         self.setCentralWidget(widget)
 
+        mainLayout = QtGui.QVBoxLayout()
         # add widgets to layout
         #self.createWindowHeader()
-        mainLayout = QtGui.QVBoxLayout()
         #mainLayout.addWidget(self.headerBox)
         mainLayout.addWidget(self.statusIconBox)
         if self.debugmode:
@@ -37,11 +37,51 @@ class MainWindowMixin(object):
             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')
-        logger.debug('set 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)
diff --git a/src/leap/gui/firstrunwizard.py b/src/leap/gui/firstrunwizard.py
index 1012f64c..02ace77e 100755
--- a/src/leap/gui/firstrunwizard.py
+++ b/src/leap/gui/firstrunwizard.py
@@ -194,10 +194,10 @@ class IntroPage(QtGui.QWizardPage):
         label = QtGui.QLabel(
             "Now we will guide you through "
             "some configuration that is needed before you "
-            "connect for the first time.<br><br>"
-            "If you ever need to modify this options again, "
-            "you can access from the '<i>Settings</i>' menu in the "
-            "main window of the app.")
+            "can connect for the first time.<br><br>"
+            "If you ever need to modify these options again, "
+            "you can find the wizard in the '<i>Settings</i>' menu from the "
+            "main window of the Leap App.")
 
         label.setWordWrap(True)
 
-- 
cgit v1.2.3