def create_entry(self, *args): var = dict(self.editor.dialogs['create'].items()) debug('var is %s' % var) self.environ[self.trait][var['name']] = var['value'] tagname = ujoin(self.trait, var['name']) self.editor.make_tag(tagname) self.editor.destroy_dialog(self.editor.dialogs['create'])
def __set_suite_cursors__(self, suite): self.traits = StatementCursor(self.conn, 'traits') self.traits.set_table(ujoin(suite, 'traits')) self.traitparent = TraitParent(self.conn, suite) self.traitpackage = TraitPackage(self.conn, suite) self.traittemplate = TraitTemplate(self.conn, suite) self.family = Family(self.conn)
def __init__(self, conn, suite, name='TraitsWindow'): self.cmd = StatementCursor(conn, name=name) self.cmd.set_table(ujoin(suite, 'traits')) rows = self.cmd.select() packer = lambda x : rowpacker('trait', x) DragListWindow.__init__(self, '%s traits' % suite, packer, rows, TARGETS.get('trait', suite), name=name) self.set_size_request(400, 300)
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 __init__(self, suite, traits_table, packages_table): packs_column = PkBigname('package') packs_column.set_fk(packages_table) action_column = PkName('action') action_column.constraint.default = 'install' columns = [packs_column, action_column] tablename = ujoin(suite, 'trait', 'package') _TraitRelation.__init__(self, traits_table, tablename, columns)
def __init__(self, suite, traits_table, prio_table): tablename = ujoin(suite, 'traits') columns = trait_columns() trait = getcolumn('trait', columns) priority = getcolumn('priority', columns) trait.set_fk(traits_table) priority.set_fk(prio_table) Table.__init__(self, tablename, columns)
def __init__(self, suite, traits_table, packages_table): tablename = ujoin(suite, 'templates') packs_column = PkBigname('package') packs_column.set_fk(packages_table) tcolumns = template_columns() tcolumns[-1].set_fk('textfiles') columns = tcolumns[:1] + [packs_column] + tcolumns[1:] _TraitRelation.__init__(self, traits_table, tablename, columns)
def __init__(self, suite, traits_table): tablename = ujoin(suite, 'scripts') script_column = PkName('script') script_column.set_fk('scriptnames') sfile_column = Num('scriptfile') sfile_column.set_fk('textfiles') script_columns = [script_column, sfile_column] _TraitRelation.__init__(self, traits_table, tablename, script_columns)
def insert_item(self, order, fields, value): fieldkeys = self['___field_keys___'] orders = self['___orders___'] for k,v in zip(orders[order], fields): fieldkeys[k].add(v) fullkey = ujoin(*fields) self[fullkey] = value self['___field_keys___'] = fieldkeys
def __init__(self, conn, suite): table = ujoin(suite, 'templates') TraitRelation.__init__(self, conn, suite, table, name='TraitTemplate') self.traitparent = TraitParent(conn, suite) self.template = Template() self.template_path = None self.textfiles = TextFileManager(self.conn) self._jtable = '%s as s join textfiles as t ' % table self._jtable += 'on s.templatefile = t.fileid'
def __init__(self, profiles_table): profile_col = PkName('profile') profile_col.set_fk(profiles_table) trait_col = PkName('trait') name_col = PkBigname('name') value_col = Text('value') cols = [profile_col, trait_col, name_col, value_col] tablename = ujoin('profile', 'variables') Table.__init__(self, tablename, cols)
def __init__(self, suite, traits_table, packages_table): packs_column = PkBigname('package') if not os.environ.has_key('PAELLA_DB_NOPACKAGETABLES'): packs_column.set_fk(packages_table) action_column = PkName('action') action_column.constraint.default = 'install' columns = [packs_column, action_column] tablename = ujoin(suite, 'trait', 'package') _TraitRelation.__init__(self, traits_table, tablename, columns)
def __init__(self, mach_types_table): mtype_col = PkName('machine_type') mtype_col.set_fk(mach_types_table) trait_col = PkName('trait') name_col = PkBigname('name') value_col = Text('value') cols = [mtype_col, trait_col, name_col, value_col] tablename = ujoin('machine_type', 'variables') Table.__init__(self, tablename, cols)
def __init__(self, mach_types_table): mtype_col = PkName('machine_type') mtype_col.set_fk(mach_types_table) tablename = ujoin('machine_type', 'scripts') script_column = PkName('script') script_column.set_fk('scriptnames') sfile_column = Num('scriptfile') sfile_column.set_fk('textfiles') script_columns = [mtype_col, script_column, sfile_column] Table.__init__(self, tablename, script_columns)
def __init__(self, machines_table): machine_col = PkName('machine') machine_col.set_fk(machines_table) tablename = ujoin('machine', 'scripts') script_column = PkName('script') script_column.set_fk('scriptnames') sfile_column = Num('scriptfile') sfile_column.set_fk('textfiles') columns = [machine_col, script_column, sfile_column] Table.__init__(self, tablename, columns)
def insert_suite_packages(cursor, repos, quick=False): prow = package_to_row if quick: prow = package_to_row_quick suite = repos.source.suite if isnonus(suite): suite = suite.split('/')[0] table = ujoin(suite, 'packages') for section in repos.source.sections: for package in repos.full_parse(section).values(): cursor.insert(table, prow(package))
def insert_more_packages(cursor, repos, suite=None, quick=False): prow = package_to_row if quick: prow = package_to_row_quick repos.source.set_path() repos.parse_release() table = ujoin(suite, 'packages') for package in repos.full_parse().values(): try: cursor.insert(table, prow(package)) except OperationalError: pass
def __init__(self, conn, suite): Element.__init__(self, 'traits') self.conn = conn self.suite = suite self.setAttribute('suite', self.suite) self._traits_ = StatementCursor(self.conn, 'Traits') self._traits_.set_table(ujoin(self.suite, 'traits')) self.traitnames = [row.trait for row in self._traits_.select(order='trait')] for t in self.traitnames: t_element = Element('trait') t_element.setAttribute('name', t) self.appendChild(t_element)
def __init__(self, conn, suite, name='TraitsWindow'): self.cmd = StatementCursor(conn, name=name) self.cmd.set_table(ujoin(suite, 'traits')) rows = self.cmd.select() packer = lambda x: rowpacker('trait', x) DragListWindow.__init__(self, '%s traits' % suite, packer, rows, TARGETS.get('trait', suite), name=name) self.set_size_request(400, 300)
def __init__(self, conn, suite, name='PackagesWindow'): self.cmd = StatementCursor(conn, name=name) table = ujoin(suite, 'packages') self.cmd.set_table(table) section_query ='select distinct section from %s' % table sections = [x.section for x in self.cmd.get(section_query)] self.section_combo = MyCombo(sections) self.section_combo.set(sections[0]) rows = self.cmd.select(clause="section = '%s'" % sections[0]) packer = lambda x : rowpacker('package', x) DragListWindow.__init__(self, '%s packages' % suite, packer, rows, TARGETS.get('package', suite), name=name) self.vbox.pack_start(self.section_combo,0,0,0) self.set_size_request(400, 300) self.set_ok(self.set_packages)
def __init__(self, conn, suite, name='PackagesWindow'): self.cmd = StatementCursor(conn, name=name) table = ujoin(suite, 'packages') self.cmd.set_table(table) section_query = 'select distinct section from %s' % table sections = [x.section for x in self.cmd.get(section_query)] self.section_combo = MyCombo(sections) self.section_combo.set(sections[0]) rows = self.cmd.select(clause="section = '%s'" % sections[0]) packer = lambda x: rowpacker('package', x) DragListWindow.__init__(self, '%s packages' % suite, packer, rows, TARGETS.get('package', suite), name=name) self.vbox.pack_start(self.section_combo, 0, 0, 0) self.set_size_request(400, 300) self.set_ok(self.set_packages)
def __init__(self, suite): tablename = ujoin(suite, 'packages') Table.__init__(self, tablename, packages_columns())
def _table(self, table): return ujoin(self.name, table)
def __make_superdict__(self): self.__superdict__ = {} for field in self.main_values: for key in self.__keyfunction__(field): self.__superdict__[ujoin(field, key)] = (field, key)
def __init__(self, conn, suite, trait): self.suite = suite table = ujoin(suite, 'variables') Environment.__init__(self, conn, table, 'trait') self.set_main(trait)
def __init__(self, conn, suite): table = ujoin(suite, 'debconf') _TraitRelation.__init__(self, conn, suite, table, name='TraitDebconf')
def __init__(self, suite, traits_table, packages_table): tablename = ujoin(suite, 'debconf') _TraitRelation.__init__(self, traits_table, tablename, debconf_columns())
def __init__(self, conn, suite): table = ujoin(suite, 'trait', 'package') TraitRelation.__init__(self, conn, suite, table, name='TraitPackage') self.cmd.set_fields(['package', 'action']) self.traitparent = TraitParent(conn, suite)
def __init__(self, conn, suite): table = ujoin(suite, 'trait', 'parent') TraitRelation.__init__(self, conn, suite, table, name='TraitParent') self.graph = kjGraph([(r.trait, r.parent) for r in self.cmd.select()])
def make_tag(self, menuitem, name, parent): parentname = parent.get_name() tagname = ujoin(parentname, name) self.editor.make_tag(tagname)
def reset_rows(self): rows = self.main.select(fields=['trait'], table=ujoin(self.suite, 'traits')) self.set_rows(rows) self.set_row_select(self.trait_selected)
def get_value(self, keys): return self[ujoin(*keys)]
def __init__(self, suite, traits_table): tablename = ujoin(suite, 'templates') tcolumns = template_columns() tcolumns[-1].set_fk('textfiles') columns = tcolumns _TraitRelation.__init__(self, traits_table, tablename, columns)
def set_suite(self, suite): self.suite = suite self.set_table(ujoin(self.suite, 'traits'))
def __init__(self, suite, traits_table): cols = [PkBigname('name'), Text('value')] tablename = ujoin(suite, 'variables') _TraitRelation.__init__(self, traits_table, tablename, cols)
def __init__(self, suite, traits_table): parent_column = PkName('parent') parent_column.set_fk(traits_table, 'trait') columns = [parent_column] tablename = ujoin(suite, 'trait', 'parent') _TraitRelation.__init__(self, traits_table, tablename, columns)
def __init__(self, conn, suite): table = ujoin(suite, 'scripts') TraitRelation.__init__(self, conn, suite, table, name='TraitScript') self.textfiles = TextFileManager(self.conn) self._jtable = '%s as s join textfiles as t ' % table self._jtable += 'on s.scriptfile = t.fileid'
def insert_more_packages(cursor, repos, suite=None, quick=False): repos.source.set_path() repos.parse_release() table = ujoin(suite, 'packages') packages = repos.full_parse().values() _insert_some_more_packages(cursor, table, packages, quick=quick)