def setSource(self, url): action, context, ident = split_url(url) if action == 'edit': if context == 'variables': config = self.family.getVariablesConfig(self.family.current) newconfig = config.edit() config.update(newconfig) self.set_family(ident) elif context == 'parents': dialog = FamilyParentAssigner(self, ident) dialog.connect(dialog, SIGNAL('okClicked()'), self.resetView) dialog.show() else: KMessageBox.error(self, 'unable to edit %s for family' % context) elif action == 'delete': if context == 'family': #KMessageBox.information(self, 'delete family %s is unimplemented' % ident) msg = "Really delete family %s" % ident answer = KMessageBox.questionYesNo(self, msg) if answer == KMessageBox.Yes: self.family.delete_family(ident) msg = "family %s deleted" % ident KMessageBox.information(self, msg) self.parent().parent().refreshListView() self.setText('') else: KMessageBox.error(self, 'unable to delete %s for family' % context) else: KMessageBox.error(self, 'action %s unimpletmented' % url)
def setSource(self, url): action, context, ident = split_url(url) if action == 'show': print 'unimpletmented' elif action == 'edit': if context == 'traits': win = TraitAssigner(self.parent(), ident) self.connect(win, SIGNAL('okClicked()'), self.resetView) win.show() elif context == 'variables': self.doc.profile.edit_variables() self.resetView() elif context == 'families': win = FamilyAssigner(self.parent(), ident) self.connect(win, SIGNAL('okClicked()'), self.resetView) win.show() else: KMessageBox.error(self, 'bad edit action %s' % url) elif action == 'change': if context == 'suite': self.emit(PYSIGNAL('changeSuite'), (ident,)) print 'changeSuite emitted' else: KMessageBox.error(self, 'bad change action %s' % url) else: KMessageBox.information(self, 'called %s' % url)
def setSource(self, url): action, context, ident = split_url(url) if action == 'edit': config = self.family.getVariablesConfig(self.family.current) newconfig = config.edit() config.update(newconfig) self.set_family(ident) else: KMessageBox.error(self, 'action %s unimpletmented' % url)
def setSource(self, url): action, context, id_ = split_url(url) if action == 'new': if context == 'machine': handler = self.doc.machine dialog = NewMachineDialog(self, handler) else: self._info('make new <url> %s' % url) else: self._info('%s not supported yet' % url)
def setSource(self, url): parts = split_url(url) if len(parts) == 3: action, context, ident = split_url(url) elif len(parts) > 3: ident = '.'.join(parts[2:]) action = parts[0] context = parts[1] else: raise ValueError , "malformed url: %s" % url if action == 'show': self._perform_show_action(context, ident) elif action == 'edit': self._perform_edit_action(context, ident) elif action == 'new': self._perform_new_action(context, ident) elif action == 'delete': self._perform_delete_action(context, ident) else: raise NotImplementedError(self, url)
def setSource(self, url): parts = split_url(url) if len(parts) == 3: action, context, ident = split_url(url) elif len(parts) > 3: ident = '.'.join(parts[2:]) action = parts[0] context = parts[1] else: raise ValueError, "malformed url: %s" % url if action == 'show': self._perform_show_action(context, ident) elif action == 'edit': self._perform_edit_action(context, ident) elif action == 'new': self._perform_new_action(context, ident) elif action == 'delete': self._perform_delete_action(context, ident) else: raise NotImplementedError(self, url)
def setSource(self, url): action, context, ident = split_url(url) if action == 'show': self._perform_show_action(context, ident) elif action == 'edit': self._perform_edit_action(context, ident) elif action == 'new': self._perform_new_action(context, ident) elif action == 'delete': self._perform_delete_action(context, ident) else: raise NotImplementedError(self, url)
def setSource(self, url): action, context, ident = split_url(url) print "in setSource, url is", url print "in setSource, context is", context if context in self._context_methods: self._context_methods[context](action, ident) elif context.startswith('attribute||'): attribute = pipesplit(context)[1] self._attribute_context(attribute, action, ident) else: KMessageBox.information(self, "unable to handle %s context" % context) return
def setSource(self, url): action, context, ident = split_url(url) if action == 'new': handler = self.doc.diskconfig dialog = NewDiskConfigDialog(self, handler) dialog.show() dialog.connect(dialog, SIGNAL('okClicked()'), self.parent().resetView) self._dialog = dialog elif action == 'edit': self.doc.diskconfig.edit_diskconfig(ident) self.parent().resetView() elif action == 'delete': self.doc.diskconfig.delete(ident) self.parent().resetView() else: msg = "unsupported action: %s" % action KMessageBox.error(self, msg)
def setSource(self, url): action, context, ident = split_url(url) if action == 'show': print 'unimpletmented' elif action == 'edit': if context == 'traits': win = TraitAssigner(self.parent(), ident) self.connect(win, SIGNAL('okClicked()'), self.resetView) win.show() elif context == 'variables': self.doc.profile.edit_variables() self.resetView() elif context == 'families': win = FamilyAssigner(self.parent(), ident) self.connect(win, SIGNAL('okClicked()'), self.resetView) win.show() else: KMessageBox.error(self, 'bad edit action %s' % url) elif action == 'change': if context == 'suite': self.emit(PYSIGNAL('changeSuite'), (ident, )) print 'changeSuite emitted' else: KMessageBox.error(self, 'bad change action %s' % url) elif action == 'delete': if context == 'profile': msg = "Really delete profile %s" % ident answer = KMessageBox.questionYesNo(self, msg) if answer == KMessageBox.Yes: #msg = "we're supposed to delete this profile, but can't yet" self.doc.profile.delete_profile(ident) msg = "profile %s deleted" % ident KMessageBox.information(self, msg) mainwin = self.parent().parent() mainwin.refreshListView() mainwin.resetProfileObject() self.setText('') else: KMessageBox.error(self, "Don't know how to delete %s" % context) else: KMessageBox.information(self, 'called %s' % url)
def setSource(self, url): action, context, ident = split_url(url) if action == 'new': if context == 'machine': handler = self.doc.machine dialog = NewMachineDialog(self, handler) dialog.show() self._dialog = dialog else: KMessageBox.error(self, '%s not supported' % url) elif action == 'edit': if context == 'machine': handler = self.doc.machine dialog = EditMachineDIalog(self, handler, ident) dialog.show() self._dialog = dialog print 'edit machine', dialog.machine else: KMessageBox.error(self, '%s not supported' % url)
def setSource(self, url): action, context, ident = split_url(url) if action == "new": if context == "machine": handler = self.doc.machine dialog = NewMachineDialog(self, handler) dialog.show() self._dialog = dialog else: KMessageBox.error(self, "%s not supported" % url) elif action == "edit": if context == "machine": handler = self.doc.machine dialog = EditMachineDIalog(self, handler, ident) dialog.show() self._dialog = dialog print "edit machine", dialog.machine else: KMessageBox.error(self, "%s not supported" % url)
def setSource(self, url): action, context, id = split_url(url) if action == 'show': print 'unimpletmented' elif action == 'edit': if context == 'traits': win = TraitAssigner(self.app, self.parent(), id) self.connect(win, SIGNAL('okClicked()'), self.resetView) elif context == 'variables': self.doc.profile.edit_variables() self.resetView() elif context == 'families': win = FamilyAssigner(self.app, self.parent(), id) self.connect(win, SIGNAL('okClicked()'), self.resetView) else: self._url_error(url) else: KMessageBox.information(self, 'called %s' % url)
def setSource(self, url): action, context, ident = split_url(url) if action == "show": print "unimpletmented" elif action == "edit": if context == "traits": win = TraitAssigner(self.parent(), ident) self.connect(win, SIGNAL("okClicked()"), self.resetView) win.show() elif context == "variables": self.doc.profile.edit_variables() self.resetView() elif context == "families": win = FamilyAssigner(self.parent(), ident) self.connect(win, SIGNAL("okClicked()"), self.resetView) win.show() else: KMessageBox.error(self, "bad edit action %s" % url) elif action == "change": if context == "suite": self.emit(PYSIGNAL("changeSuite"), (ident,)) print "changeSuite emitted" else: KMessageBox.error(self, "bad change action %s" % url) elif action == "delete": if context == "profile": msg = "Really delete profile %s" % ident answer = KMessageBox.questionYesNo(self, msg) if answer == KMessageBox.Yes: # msg = "we're supposed to delete this profile, but can't yet" self.doc.profile.delete_profile(ident) msg = "profile %s deleted" % ident KMessageBox.information(self, msg) mainwin = self.parent().parent() mainwin.refreshListView() mainwin.resetProfileObject() self.setText("") else: KMessageBox.error(self, "Don't know how to delete %s" % context) else: KMessageBox.information(self, "called %s" % url)
def setSource(self, url): action, context, id_ = split_url(url) fields = [] if context == 'Disks': fields = ['diskname', 'device'] elif context == 'Families': fields = ['family'] elif context == 'Variables': fields = ['trait', 'name', 'value'] if action == 'new': if context == 'Scripts': dialog = NewMTScriptDialog(self) dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewScript) self._dialog = dialog elif fields: dialog = SimpleRecordDialog(self, fields) dialog.context = context dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewRecord) self._dialog = dialog else: self._info('problem with %s' % url) elif action == 'edit': if context == 'Variables': self.doc.mtype.edit_variables() elif context == 'Scripts': self.doc.mtype.edit_script(id_) else: self._info('need to edit %s, %s' % (context, id_)) elif action == 'delete': if context == 'Families': self.doc.mtype.delete_family(id_) elif context == 'Variables': self._info('use edit to delete variables') elif context == 'Scripts': self.doc.mtype.delete_script(id_) elif context == 'Modules': self._info('Deleting modules not supported') else: self._info('need to delete something in context %s, %s' % (context, id_)) else: KMessageBox.information(self, 'called %s' % url) self.resetView()
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 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()