def createProfile(self, profile=None, clearLayout=True): """ Prompts the user to create a new profile. """ if (profile): prof = profile elif (not self.viewWidget() or clearLayout): prof = XViewProfile() else: prof = self.viewWidget().saveProfile() blocked = self.signalsBlocked() self.blockSignals(False) changed = self.editProfile(prof) self.blockSignals(blocked) if (not changed): return act = self.addProfile(prof) act.setChecked(True) # update the interface if (self.viewWidget() and (profile or clearLayout)): self.viewWidget().restoreProfile(prof) if (not self.signalsBlocked()): self.profileCreated.emit(prof)
def accept(self): """ Saves the data to the profile before closing. """ if (not self.uiNameTXT.text()): QMessageBox.information( self, 'Invalid Name', 'You need to supply a name for your layout.') return prof = self.profile() if (not prof): prof = XViewProfile() prof.setName(str(self.uiNameTXT.text())) prof.setDescription(str(self.uiDescriptionTXT.toPlainText())) prof.setIcon(self.uiIconBTN.filepath()) super(XViewProfileDialog, self).accept()