Moved addProfile action in createActions
authorstack <stack@inventati.org>
Sun, 8 Jul 2012 16:54:38 +0000 (18:54 +0200)
committerstack <stack@inventati.org>
Sun, 8 Jul 2012 16:56:46 +0000 (18:56 +0200)
in gui it is best to build all "static" actions on init, using the
method createActions, and attach them where needed

gui.py

diff --git a/gui.py b/gui.py
index 5f16273..17a4e14 100755 (executable)
--- a/gui.py
+++ b/gui.py
@@ -89,6 +89,10 @@ class Gui(QtGui.QDialog):
         self.quitAction = QtGui.QAction("&Quit", self,
                 triggered=QtGui.qApp.quit)
 
         self.quitAction = QtGui.QAction("&Quit", self,
                 triggered=QtGui.qApp.quit)
 
+        #profile manager component
+        self.addProfile = QtGui.QAction("  Add &Profile  ", self,
+                triggered=self.addProfile, icon=QtGui.QIcon(appconf.icon))
+
 
     def createTrayIcon(self):
          """ Builds a new tray icon with a context menu and an action for the profile manager menu """
 
     def createTrayIcon(self):
          """ Builds a new tray icon with a context menu and an action for the profile manager menu """
@@ -130,12 +134,9 @@ class Gui(QtGui.QDialog):
 
                 self.menuProfiles.addAction(menuItem_Profile)
 
 
                 self.menuProfiles.addAction(menuItem_Profile)
 
-            #menuItem_Profile = self.menuProfiles.addAction("")
-            #self.menuProfiles.addAction(menuItem_Profile)
             self.menuProfiles.addSeparator()
             self.menuProfiles.addSeparator()
-            menuItem_Profile = QtGui.QAction("  Add &Profile  ", self,
-            triggered=self.addProfile, icon=QtGui.QIcon(appconf.icon))
-            self.menuProfiles.addAction(menuItem_Profile)
+            #action and menu item for adding a New Profile
+            self.menuProfiles.addAction(self.addProfile)
 
             self.menuProfiles.activateWindow()
             self.menuProfiles.popup(QtGui.QCursor.pos())
 
             self.menuProfiles.activateWindow()
             self.menuProfiles.popup(QtGui.QCursor.pos())