""" Like Gtk application this main executes the app, thi is somewhat writed for
compatibility in porting the app """
- self.show()
sys.exit(self.app.exec_())
def closeEvent(self, event):
triggered=QtGui.qApp.quit)
#profile manager component
- self.addProfile = QtGui.QAction(" Add &Profile ", self,
+ self.addProfileAction = QtGui.QAction(" Add &Profile ", self,
triggered=self.addProfile)
def createMainDialog(self):
""" Build the main dialog layout """
self.setWindowTitle("Profile manager / Dboxswitch - dropbox profile switcher")
+ #add a default action to create a profile
+ self.addButton = QtGui.QPushButton(QtGui.QIcon(appconf.addpicon),
+ "Add Profile")
+ self.addButton.clicked.connect(self.addProfile)
+ self.addButton.setVisible(False)
self.la = QtGui.QFormLayout()
- self.la.sizePolicy = QtGui.QSizePolicy.Expanding
+
+ self.la.addRow(self.addButton)
+ self.la.sizePolicy = QtGui.QSizePolicy.Minimum
self.la.setVerticalSpacing(15)
self.la.setHorizontalSpacing(15)
self.formGroupBox = QtGui.QGroupBox("Manage profiles:")
delButton.setDefaultAction(delAction)
self.profiles.append((label, delButton))
- self.sizeHint()
+ #if profiles was empty
+ if len(profiles) == 0:
+ self.addButton.setVisible(True)
+ else:
+ self.addButton.setVisible(False)
+
super(Gui, self).show()
def hide(self):
for ws in self.profiles:
for w in ws:
+ w.setVisible(False)
w.setParent(None)
- w.close()
super(Gui, self).hide()
def createTrayIcon(self):
self.menuProfiles.addSeparator()
#action and menu item for adding a New Profile
- self.menuProfiles.addAction(self.addProfile)
+ self.menuProfiles.addAction(self.addProfileAction)
self.menuProfiles.activateWindow()
self.menuProfiles.popup(QtGui.QCursor.pos())
def f():
try:
- #self.profileManager.delProfile(pr)
+ self.profileManager.delProfile(pr)
for w in prWidgets:
w.setParent(None)
- w.close()
+ w.setVisible(False)
except AppError, e:
self.showError(str(e))
return f