+ 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.addRow(self.addButton)
+ self.la.sizePolicy = QtGui.QSizePolicy.Minimum
+ self.la.setVerticalSpacing(15)
+ self.la.setHorizontalSpacing(15)
+ self.formGroupBox = QtGui.QGroupBox("Manage profiles:")
+ self.formGroupBox.setLayout(self.la)
+ mainLayout = QtGui.QVBoxLayout()
+ mainLayout.addWidget(self.formGroupBox)
+ self.setLayout(mainLayout)
+
+
+ def show(self):
+ """ Show the main dialog for dealing with profiles """
+
+ profiles = self.profileManager.getProfilesList()
+
+ for pr in profiles:
+ prname = self.profileManager.getBaseProfileName(pr)
+ delButton = QtGui.QToolButton()
+ label = QtGui.QLabel(prname)
+ self.la.addRow(label, delButton)
+ delAction = QtGui.QAction(QtGui.QIcon(appconf.delpicon),"Delete", self,
+ triggered=self.deleteProfileAction(prname, (label, delButton)))
+ delButton.setDefaultAction(delAction)
+ self.profiles.append((label, delButton))
+
+ #if profiles was empty
+ if len(profiles) == 0:
+ self.addButton.setVisible(True)
+ else:
+ self.addButton.setVisible(False)
+
+ super(Gui, self).show()
+
+ def hide(self):
+ """ Hides the main dialog """
+
+ #Hides all the profiles in the Dialog
+ #User can deal with profiles like removing the dir manually
+
+ for ws in self.profiles:
+ for w in ws:
+ w.setVisible(False)
+ w.setParent(None)
+ super(Gui, self).hide()