def _trait_select_dialog(self, name): dialog = dialogs.CList(name, name=name) self.main.set_table(ujoin(self.browser.suite, 'traits')) traits = self.main.select(fields=['trait']) dialog.set_rows(traits) dialog.set_ok(self.select_trait) dialog.set_cancel(self.destroy_dialog) self.dialogs[name] = dialog
def ask_remove_key(self): if self.dialogs['remove'] is None: self.dialogs['remove'] = dialogs.CList('remove which item', name='remove') d = self.dialogs['remove'] d.set_rows(self.record.keys(), ['name']) self.dialogs['remove'].set_cancel(self.destroy_dialog) self.dialogs['remove'].set_ok(self.remove_item)
def pull_from_tar(self, button, fileselect): info, tfile = fileselect.extract_file() template = tfile.name action = 'attach' if self.dialogs[action] is None: msg = 'attach to which package?' self.dialogs[action] = dialogs.CList(msg, name=action) lbox = self.dialogs[action] lbox.set_rows(self.traitpackage.packages()) lbox.set_ok(self.insert_new_template_from_tar) lbox.set_cancel(self.destroy_dialog) lbox.set_data('tarmember', (info, tfile))
def set_trait_selection(self, menuitem, command): print menuitem, command if command == 'all': self.browser.trait_selection = '_all_traits_' self.browser.reset_rows() else: dialog = dialogs.CList('hi there', name='select profile') profiles = self.main.select(fields=['profile'], table='profiles', clause=Eq('suite', self.suite)) dialog.set_rows(profiles) dialog.set_ok(self.profile_dialog_selected) dialog.set_cancel(self.destroy_dialog) self.dialogs['select profile'] = dialog
def ask_dialog(self, button, data): if not self.dialogs[data]: if data == 'create': self.dialogs[data] = dialogs.Entry('create profile', name='create') self.dialogs[data].set_ok(self.create_profile) elif data == 'copy': self.dialogs[data] = dialogs.CList('copy profile', name='copy') dialog = self.dialogs[data] dialog.set_rows( self.profiles.select(fields='profile', order='profile')) dialog.set_ok(self.src_profile_selected) elif data == 'export': pdb = PaellaDatabase(self.conn) profiles = pdb.profiles self.dialogs[data].set_cancel(self.destroy_dialog)
def edit_command(self, menuitem, name): if self.conn is None: dialogs.Message('Not Connected') else: if name == 'profiles': self.workspace['profiles'] = ProfileGenWin( self.conn, self.dbname) elif name in ['suitemanager']: if not self.dialogs[name]: msg = 'select a suite' self.dialogs[name] = dialogs.CList(msg, name=name) lbox = self.dialogs[name] lbox.set_rows(self.main.select(table='suites')) lbox.set_ok(self.suite_selected) lbox.set_cancel(self.destroy_dialog) else: self.run_tbar(None, name)
def edit_command(self, menuitem, name): if self.conn is None: dialogs.Message('Not Connected') else: if name == 'profiles': self.workspace['profiles'] = ProfileGenWin( self.conn, self.dbname) elif name in ['suitemanager']: if not self.dialogs[name]: msg = 'select a suite' self.dialogs[name] = dialogs.CList(msg, name=name) lbox = self.dialogs[name] lbox.set_rows(self.main.select(table='suites')) lbox.set_ok(self.suite_selected) lbox.set_cancel(self.destroy_dialog) elif name == 'traitmanager': self.workspace['traitmanager'] = TraitManagerWin(self.conn) elif name == 'machines': self.workspace['machines'] = MainMachineWin(self.conn) else: raise Error, 'bad edit_command'