def __init__(self, parent, name='PaellaConnectionDialog'): fields = ['dbhost', 'dbname', 'dbusername', 'dbpassword'] BaseRecordDialog.__init__(self, parent, fields, name=name) self.frame.text_label.setText('Connect to a database.') self.setButtonOKText('connect', 'connect') self.app = get_application_pointer() # setup the password entry entry = self.frame.entries['dbpassword'] entry.setEchoMode(entry.Password) if os.environ.has_key('PAELLA_DBPASSWD'): entry.setText(os.environ['PAELLA_DBPASSWD'])
def newProfile(self): win = BaseRecordDialog(self, ['name']) win.frame.text_label.setText('Name for new profile:') win.connect(win, SIGNAL('okClicked()'), self.insertNewProfile) skeleton = self.cfg.get('management_gui', 'template_profile') if skeleton not in self.profile.get_profile_list(): msg = 'Name for new profile: (skeleton does not exist yet.)' win.frame.text_label.setText(msg) win.setRecordData(dict(name=skeleton)) win.show() self._dialog = win
def newProfile(self): win = BaseRecordDialog(self, ["name"]) win.frame.text_label.setText("Name for new profile:") win.connect(win, SIGNAL("okClicked()"), self.insertNewProfile) skeleton = self.cfg.get("management_gui", "template_profile") if skeleton not in self.profile.get_profile_list(): msg = "Name for new profile: (skeleton does not exist yet.)" win.frame.text_label.setText(msg) win.setRecordData(dict(name=skeleton)) win.show() self._dialog = win
def _perform_edit_action(self, context, ident): if context == 'templates': if self._current_tarball is None: self.selectSystemTarballDialog() else: msg = 'use %s as the current tarball?' % self._current_tarball yesno = KMessageBox.questionYesNo(self, msg) if yesno == KMessageBox.Yes: self.selectWithinSystemTarballDialog(self._current_tarball) else: self._current_tarball = None self.selectSystemTarballDialog() elif context == 'packages': raise RuntimeError, 'packages not implemented yet' elif context == 'script': self.doc.trait.edit_script(ident) elif context == 'parents': win = ParentAssigner(self, ident, self.doc.suite) win.connect(win, SIGNAL('okClicked()'), self.resetView) win.show() elif context == 'variables': #KMessageBox.information(self, 'edit variables') debug('edit variables', ident) win = TraitVariablesWindow(self, self.doc.suite, ident) win.show() elif context == 'template': template = ident self.doc.trait.edit_template(template) elif context == 'templatedata': template = ident row = self.doc.trait.get_template_row(template) data = {} fields = ['template', 'owner', 'grp_owner', 'mode'] for f in fields: data[f] = row[f] win = BaseRecordDialog(self, fields, record=data) win.template = template win.connect(win, SIGNAL('okClicked()'), self.slotUpdateTemplateData) win.show() self._dialog = win elif context == 'description': #KMessageBox.information(self, 'edit description for %s' % ident) win = TraitDescriptionWindow(self, ident, self.doc.suite) win.show() else: raise MethodNotImplementedError(self, 'TraitView._perform_edit_action')
def setSource(self, url): action, context, ident = split_url(url) fields = [] dialog_message = 'We need a message here' if context == 'Disks': fields = ['diskname', 'device'] dialog_message = 'Add a new disk.' elif context == 'Families': fields = ['family'] dialog_message = 'Add a new family.' elif context == 'Variables': fields = ['trait', 'name', 'value'] dialog_message = 'Add a new variable.' elif context == 'machine_type': fields = ['name'] dialog_message = 'Add a new machine type.' if action == 'new': if context == 'Scripts': dialog = NewMTScriptDialog(self) dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewScript) self._dialog = dialog elif fields: dialog = BaseRecordDialog(self, fields) dialog.context = context dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewRecord) dialog.frame.setText(dialog_message) self._dialog = dialog else: KMessageBox.error(self, 'problem with %s' % url) elif action == 'edit': self._perform_edit_action(context, ident) elif action == 'delete': self._perform_delete_action(context, ident) else: msg = 'Problem with action in url %s' % url KMessageBox.error(self, msg) if self._dialog is not None: self._dialog.connect(self._dialog, SIGNAL('cancelClicked()'), self._destroy_dialog) self._dialog.show() self.resetView()
def insertNewProfile(self): win = self._dialog profile = win.getRecordData()['name'] profile_list = self.profile.get_profile_list() if profile not in profile_list: skeleton = self.cfg.get('management_gui', 'template_profile') if skeleton in profile_list: self.profile.copy_profile(skeleton, profile) self.refreshListView() else: dlg = BaseRecordDialog(win, ['suite']) dlg.frame.text_label.setText('Select a suite for this profile') dlg.connect(dlg, SIGNAL('okClicked()'), self.insertNewProfilewithSuite) dlg.show() dlg.profile = profile win.suite_dialog = dlg KMessageBox.information(self, 'need to select suite here') # need to determine if skeleton exists KMessageBox.information(self, 'make profile %s' % profile) else: KMessageBox.error(self, 'Profile %s already exists.' % profile)
def insertNewProfile(self): win = self._dialog profile = win.getRecordData()["name"] profile_list = self.profile.get_profile_list() if profile not in profile_list: skeleton = self.cfg.get("management_gui", "template_profile") if skeleton in profile_list: self.profile.copy_profile(skeleton, profile) self.refreshListView() else: dlg = BaseRecordDialog(win, ["suite"]) dlg.frame.text_label.setText("Select a suite for this profile") dlg.connect(dlg, SIGNAL("okClicked()"), self.insertNewProfilewithSuite) dlg.show() dlg.profile = profile win.suite_dialog = dlg KMessageBox.information(self, "need to select suite here") # need to determine if skeleton exists KMessageBox.information(self, "make profile %s" % profile) else: KMessageBox.error(self, "Profile %s already exists." % profile)
def __init__(self, parent, name='NewTraitVariableDialog'): BaseRecordDialog.__init__(self, parent, ['name', 'value'], name=name) self.frame.text_label.setText('Make a new trait variable.')
def _perform_new_action(self, context, ident): if context == 'package': win = BaseRecordDialog(self, ['package', 'action']) win.connect(win, SIGNAL('okClicked()'), self.slotAddPackage) win.setRecordData(dict(action='install')) win.show() self._dialog = win elif context == 'script': win = ScriptNameDialog(self, 'trait') win.connect(win, SIGNAL('okClicked()'), self.slotMakeNewScript) win.show() self._dialog = win else: raise MethodNotImplementedError(self, 'TraitView._perform_new_action')
def __init__(self, parent, name='NewTraitDialog'): BaseRecordDialog.__init__(self, parent, ['name'], name=name) self.setCaption('Add a new trait')
def slotNew(self): win = BaseRecordDialog(self, ['name']) win.connect(win, SIGNAL('okClicked()'), self.slotNewSuiteNamed) self._dialog = win win.show()
def __init__(self, parent, name='NewFamilyDialog'): BaseRecordDialog.__init__(self, parent, ['name'], name=name) self.setCaption('Add a new family')