def template_command(self, meuitem, command): if command in ['new']: path = self.trait_temp_path(filesel=True) select_a_file('new', path, self.fileselect_ok) elif command == 'diff': path = self.suite_template_path(filesel=True) select_a_file('load', path, self.fileselect_ok) elif command == 'save': self.save_template() elif command == 'load': path = self.suite_template_path(filesel=True) select_a_file('load', path, self.fileselect_ok) elif command == 'done': try: template = self.get_selected_data()[0].template self.remove_page(template) except IndexError: pass elif command == 'drop': print 'need to drop template' rows = self.get_selected_data() if len(rows): row = rows[0] self.traittemplate.drop_template(row.package, row.template) self.remove_page(row.template) self.reset_rows() else: dialogs.Message('a template must be selected') elif command == 'root': if self.dialogs['rootsel'] is None: path = self.tarball_path + '/' select_a_file('root', path, self.tarball_selected) elif command == 'edit': self.edit_template()
def modify_trait(self, menuitem, action): if action == 'hello': dialogs.Message('hello') elif action in ['import', 'update']: filesel = select_a_file(action, self.tarball_path + '/', self.select_trait_tarball) elif action in ['updatedir', 'exportdir', 'importdir']: filesel = select_a_file(action, self.tarball_path + '/', self.select_traitdir) elif action == 'export': try: trait = self.listbox.get_selected_data()[0].trait #self.pages[trait].extract_packages() self.select_export_path(trait) except IndexError: dialogs.Message('no trait selected') elif action == 'extract': try: trait = self.listbox.get_selected_data()[0].trait self.pages[trait].extract_packages() except IndexError: dialogs.Message('no trait selected')
def select_export_path(self, trait): filesel = select_a_file(trait, self.tarball_path + '/', self.export_path_selected)
def select_configdat(self, button=None, data=None, action='getconfig'): select_a_file(action, '/', self.filesel_ok)