def __init__(self, conn): self.conn = conn self.cfg = PaellaConfig() self.client_path = self.cfg.get('management_gui', 'client_path') self.client_cfg = Configuration( files=[os.path.join(self.client_path, 'config')]) self.clients = self.client_cfg.sections()
def __init__(self, conn, suite): self.menu = make_menu(_MODTRAIT, self.modify_trait) ListNoteBook.__init__(self) self.conn = conn self.traits = Traits(self.conn, suite) self.trait_selection = '_all_traits_' self.reset_rows() self.cfg = PaellaConfig() self._parents = TraitParent(self.conn, suite) self.cursor = StatementCursor(self.conn) self.template_path = '/nowhere' self.tarball_path = self.cfg.get('management_gui', 'bkuptarball_path') self.suite = suite
def __init__(self, conn, name='ClientManager'): CommandBoxWindow.__init__(self) self.set_title('Client Manager') self.conn = conn self.cfg = PaellaConfig() client_cmds = ['import', 'export', 'remove'] self.add_menu(client_cmds, 'client', self.menu_command) self.client_view = ScrollCList() self.vbox.add(self.client_view) self.client_path = self.cfg.get('management_gui', 'client_path') self.client_cfg = Configuration( files=[os.path.join(self.client_path, 'config')]) self.clients = self.client_cfg.sections() self.client_view.set_rows(self.clients, ['client']) self.dialogs = {}.fromkeys(client_cmds)
def __init__(self, conn, suite, trait): self.menu = make_menu(TEMPL_CMDS, self.template_command) self.conn = conn self.current_trait = trait self.traittemplate = TraitTemplate(self.conn, suite) self.traittemplate.set_trait(self.current_trait) self.traitpackage = TraitPackage(self.conn, suite) self.traitpackage.set_trait(self.current_trait) self.current_template = None self.cfg = PaellaConfig() self.template_path = '/nowhere' self._tmp_path = '/nowhere' self.tarball_path = self.cfg.get('management_gui', 'bkuptarball_path') ListNoteBook.__init__(self) self.set_suite(suite) self.extracted = None self.reset_rows() self.dialogs = {}.fromkeys(['attach', 'rootsel'])
def __init__(self, conn, name='ProfileGenWin'): actions = ['create', 'copy', 'export', 'import'] CommandBoxWindow.__init__(self, name=name) self.set_title(name) self.cfg = PaellaConfig() self.conn = conn self.cmd = StatementCursor(conn, name) self.suites = [x.suite for x in self.cmd.select(table='suites')] self.profiles = StatementCursor(conn, 'profiles') self.profiles.set_table('profiles') self.menu_bar = SimpleMenuBar() self.vbox.pack_start(self.menu_bar, 0, 0, 0) self.dialogs = {}.fromkeys(actions) self.add_menu(actions, 'main', self.ask_dialog) self.add_menu(self.suites, 'traits', self.show_traits) self.tbar.add_button('families', 'show all families', self.families_window) self.add_menu(self.suites, 'traitgen', self.show_traitgen) self.browser = ProfileBrowser(self.conn, self.suites) self.vbox.add(self.browser) self.set_size_request(400, 300)
def __init__(self, conn): object.__init__(self) self.cfg = PaellaConfig() self.conn = conn self.import_dir = self.cfg.get('database', 'import_path') self.export_dir = self.cfg.get('database', 'export_path')
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 profile_dialog_selected(self, *args): profile = self.dialogs['select profile'].get_selected_data()[0][0] self.destroy_dialog(self.dialogs['select profile']) self.browser.trait_selection = profile self.browser.reset_rows() if __name__ == '__main__': from useless.db.lowlevel import QuickConn g = PaellaConfig() conn = QuickConn(g) rconn = RepositoryConnection() #tb = TemplateBrowser(conn) #tb.set_suite('woody') #win = MenuWindow() #win.vbox.add(tb) win = TemplateManager(conn, rconn) win.connect('destroy', mainquit) mainloop() pass
from useless.sqlgen.clause import one_many, Eq, In, NotIn from paella.db import PaellaConnection, PaellaConfig from paella.db.trait import Trait def substring(field, substr): return 'substring(%s from 1 for %s)' % (field, len(substr)) def substring_clause(section): return "%s = '%s'" % (substring('section', section), section) cfg = PaellaConfig('management_gui') suites = [s.strip() for s in cfg['management_suites'].split(',')] TARGETS = FlavoredTargets(23, ['trait', 'package'], suites) print TARGETS.flavors class DragListWindow(dialogs.CList): def __init__(self, message, packer, rows, targets, name='DragListWindow'): dialogs.CList.__init__(self, message, name=name, dnd=self.drag_rows, targets=targets) self.set_rows(rows) self.__packer__ = packer self.set_select_mode('multi')
def __init__(self, name='SystemTarWindow', **kw): FileSelection.__init__(self, **kw) self.cfg = PaellaConfig() self.dialogs = {}.fromkeys(['dbname', 'traits', 'templates']) self.tar = SystemTar(None, self.cfg) self.show()