class TraitManagerWin(CommandBoxWindow, HasDialogs): def __init__(self, conn): CommandBoxWindow.__init__(self) self.conn = conn self.suites = Suites(self.conn) self.add_menu(["all", "profile"], "selection", self.set_trait_selection) self.tbar.add_button("suite", "select suite", self.suite_selection) self.dialogs = {}.fromkeys(["select suite"]) self.browser = TraitManagerBrowser(self.conn) self.vbox.add(self.browser) def set_trait_selection(self, menuitem, command): print menuitem, command def suite_selection(self, button, data): print button, data dialog = dialogs.CList("select a suite", "select suite") dialog.set_rows(self.suites.select(fields=["suite"])) dialog.set_ok(self.suite_dialog_selected) dialog.set_cancel(self.destroy_dialog) self.dialogs["select suite"] = dialog def suite_dialog_selected(self, *args): print args suite = self.dialogs["select suite"].get_selected_data()[0][0] self.destroy_dialog(self.dialogs["select suite"]) self.suites.set(suite) self.browser.set_suite(suite) self.browser.reset_rows() self.set_title("Managing %s traits" % suite)
class TraitManagerWin(CommandBoxWindow, HasDialogs): def __init__(self, conn): CommandBoxWindow.__init__(self) self.conn = conn self.suites = Suites(self.conn) self.add_menu(['all', 'profile'], 'selection', self.set_trait_selection) self.tbar.add_button('suite', 'select suite', self.suite_selection) self.dialogs = {}.fromkeys(['select suite']) self.browser = TraitManagerBrowser(self.conn) self.vbox.add(self.browser) def set_trait_selection(self, menuitem, command): print menuitem, command def suite_selection(self, button, data): print button, data dialog = dialogs.CList('select a suite', 'select suite') dialog.set_rows(self.suites.select(fields=['suite'])) dialog.set_ok(self.suite_dialog_selected) dialog.set_cancel(self.destroy_dialog) self.dialogs['select suite'] = dialog def suite_dialog_selected(self, *args): print args suite = self.dialogs['select suite'].get_selected_data()[0][0] self.destroy_dialog(self.dialogs['select suite']) self.suites.set(suite) self.browser.set_suite(suite) self.browser.reset_rows() self.set_title('Managing %s traits' % suite)
def __init__(self, parent, name='SuiteTraitComboBox'): QFrame.__init__(self, parent, name) self.app = get_application_pointer() self.conn = self.app.conn self.suiteCursor = Suites(self.conn) self.suites = self.suiteCursor.list() self.traits = Traits(self.conn, self.suites[0]) self.scombo = KComboBox(self, 'SuiteComboBox') self.scombo.insertStrList(self.suites) self.tcombo = KComboBox(self, 'TypeComboBox') self.tcombo.insertStrList(['template', 'script']) self.trcombo = KComboBox(self, 'TraitComboBox') self.update_btn = KPushButton('update', self) self.listView = TraitListView(self) self.vbox = QVBoxLayout(self) for attribute in [ 'listView', 'scombo', 'tcombo', 'trcombo', 'update_btn' ]: widget = getattr(self, attribute) self.vbox.addWidget(widget) # we need to redo the signals and the methods that are called self.connect(self.scombo, SIGNAL('activated(int)'), self.update_traits) self.connect(self.update_btn, SIGNAL('clicked()'), self.refreshlistView)
def __init__(self, app, parent): KDialogBase.__init__(self, parent, 'SuiteSelector') dbwidget(self, app) self.suites = Suites(self.conn) self.listView = KListView(self) self.listView.addColumn('suite') self.setMainWidget(self.listView) self.refreshlistView() self.show()
def __init__(self, conn): CommandBoxWindow.__init__(self) self.conn = conn self.suites = Suites(self.conn) self.add_menu(['all', 'profile'], 'selection', self.set_trait_selection) self.tbar.add_button('suite', 'select suite', self.suite_selection) self.dialogs = {}.fromkeys(['select suite']) self.browser = TraitManagerBrowser(self.conn) self.vbox.add(self.browser)
def __init__(self, conn): CommandBoxWindow.__init__(self) self.conn = conn self.suites = Suites(self.conn) self.add_menu(["all", "profile"], "selection", self.set_trait_selection) self.tbar.add_button("suite", "select suite", self.suite_selection) self.dialogs = {}.fromkeys(["select suite"]) self.browser = TraitManagerBrowser(self.conn) self.vbox.add(self.browser)
def __init__(self, app, parent, name='SuiteTraitCombo'): QWidget.__init__(self, parent, name) dbwidget(self, app) self.suiteCursor = Suites(self.conn) self.suites = self.suiteCursor.list() self.traits = Traits(self.conn, self.suites[0]) self.scombo = SuiteCombo(self, self.suites) self.tcombo = MyCombo(self, 'TypeCombo') self.tcombo.fill(['template', 'script']) self.trcombo = MyCombo(self, 'TraitCombo') self.ubutton = KPushButton('update', self) self.listView = TraitList(self.app, self) self.vbox = QVBoxLayout(self) for member in ['listView', 'scombo', 'tcombo', 'trcombo', 'ubutton']: widget = getattr(self, member) self.vbox.addWidget(widget) self.connect(self.scombo, SIGNAL('highlighted(int)'), self.update_traits) self.connect(self.ubutton, SIGNAL('clicked()'), self.refreshlistView)
class SuiteTraitCombo(QWidget): def __init__(self, app, parent, name='SuiteTraitCombo'): QWidget.__init__(self, parent, name) dbwidget(self, app) self.suiteCursor = Suites(self.conn) self.suites = self.suiteCursor.list() self.traits = Traits(self.conn, self.suites[0]) self.scombo = SuiteCombo(self, self.suites) self.tcombo = MyCombo(self, 'TypeCombo') self.tcombo.fill(['template', 'script']) self.trcombo = MyCombo(self, 'TraitCombo') self.ubutton = KPushButton('update', self) self.listView = TraitList(self.app, self) self.vbox = QVBoxLayout(self) for member in ['listView', 'scombo', 'tcombo', 'trcombo', 'ubutton']: widget = getattr(self, member) self.vbox.addWidget(widget) self.connect(self.scombo, SIGNAL('highlighted(int)'), self.update_traits) self.connect(self.ubutton, SIGNAL('clicked()'), self.refreshlistView) def update_traits(self): suite = str(self.scombo.currentText()) self.traits.set_suite(suite) self.listView.set_suite(suite) self.listView.ftype = str(self.tcombo.currentText()) def refreshlistView(self): trait = str(self.trcombo.currentText()) if trait: self.listView.set_trait(trait) self.listView.ftype = str(self.tcombo.currentText()) suite = str(self.scombo.currentText()) self.listView.set_suite(suite) self.traits.set_suite(suite) traits = [row.trait for row in self.traits.select()] self.trcombo.fill(traits) if trait in traits: self.trcombo.setCurrentItem(traits.index(trait)) self.listView.refreshlistView() def getData(self): return self.listView.getData() def updateData(self, data): self.listView.updateData(data)
class SuiteSelector(KDialogBase): def __init__(self, app, parent): KDialogBase.__init__(self, parent, 'SuiteSelector') dbwidget(self, app) self.suites = Suites(self.conn) self.listView = KListView(self) self.listView.addColumn('suite') self.setMainWidget(self.listView) self.refreshlistView() self.show() def refreshlistView(self): self.listView.clear() for suite in self.suites.list(): item = KListViewItem(self.listView, suite) item.suite = suite
def __init__(self, parent, name='SuiteTraitComboBox'): QFrame.__init__(self, parent, name) self.app = get_application_pointer() self.conn = self.app.conn self.suiteCursor = Suites(self.conn) self.suites = self.suiteCursor.list() self.traits = Traits(self.conn, self.suites[0]) self.scombo = KComboBox(self, 'SuiteComboBox') self.scombo.insertStrList(self.suites) self.tcombo = KComboBox(self, 'TypeComboBox') self.tcombo.insertStrList(['template', 'script']) self.trcombo = KComboBox(self, 'TraitComboBox') self.update_btn = KPushButton('update', self) self.listView = TraitListView(self) self.vbox = QVBoxLayout(self) for attribute in ['listView', 'scombo', 'tcombo', 'trcombo', 'update_btn']: widget = getattr(self, attribute) self.vbox.addWidget(widget) # we need to redo the signals and the methods that are called self.connect(self.scombo, SIGNAL('activated(int)'), self.update_traits) self.connect(self.update_btn, SIGNAL('clicked()'), self.refreshlistView)
class SuiteTraitComboBox(QFrame): def __init__(self, parent, name='SuiteTraitComboBox'): QFrame.__init__(self, parent, name) self.app = get_application_pointer() self.conn = self.app.conn self.suiteCursor = Suites(self.conn) self.suites = self.suiteCursor.list() self.traits = Traits(self.conn, self.suites[0]) self.scombo = KComboBox(self, 'SuiteComboBox') self.scombo.insertStrList(self.suites) self.tcombo = KComboBox(self, 'TypeComboBox') self.tcombo.insertStrList(['template', 'script']) self.trcombo = KComboBox(self, 'TraitComboBox') self.update_btn = KPushButton('update', self) self.listView = TraitListView(self) self.vbox = QVBoxLayout(self) for attribute in ['listView', 'scombo', 'tcombo', 'trcombo', 'update_btn']: widget = getattr(self, attribute) self.vbox.addWidget(widget) # we need to redo the signals and the methods that are called self.connect(self.scombo, SIGNAL('activated(int)'), self.update_traits) self.connect(self.update_btn, SIGNAL('clicked()'), self.refreshlistView) def update_traits(self, suite_index): suite = self.suites[suite_index] self.traits.set_suite(suite) self.listView.set_suite(suite) self.listView.file_type = str(self.tcombo.currentText()) self._update_traits_combobox() def _update_traits_combobox(self): traits = [row.trait for row in self.traits.select()] traits.sort() self.trcombo.clear() self.trcombo.insertStrList(traits) return traits def refreshlistView(self): trait = str(self.trcombo.currentText()) if trait: self.listView.set_trait(trait) self.listView.file_type = str(self.tcombo.currentText()) suite = str(self.scombo.currentText()) self.traits.set_suite(suite) self.listView.set_suite(suite) traits = self._update_traits_combobox() if trait in traits: self.trcombo.setCurrentItem(traits.index(trait)) self.listView.refreshlistView() # returns template or script contents def getData(self): return self.listView.getData() # replace template or script contents def updateData(self, data): self.listView.updateData(data)
class SuiteTraitComboBox(QFrame): def __init__(self, parent, name='SuiteTraitComboBox'): QFrame.__init__(self, parent, name) self.app = get_application_pointer() self.conn = self.app.conn self.suiteCursor = Suites(self.conn) self.suites = self.suiteCursor.list() self.traits = Traits(self.conn, self.suites[0]) self.scombo = KComboBox(self, 'SuiteComboBox') self.scombo.insertStrList(self.suites) self.tcombo = KComboBox(self, 'TypeComboBox') self.tcombo.insertStrList(['template', 'script']) self.trcombo = KComboBox(self, 'TraitComboBox') self.update_btn = KPushButton('update', self) self.listView = TraitListView(self) self.vbox = QVBoxLayout(self) for attribute in [ 'listView', 'scombo', 'tcombo', 'trcombo', 'update_btn' ]: widget = getattr(self, attribute) self.vbox.addWidget(widget) # we need to redo the signals and the methods that are called self.connect(self.scombo, SIGNAL('activated(int)'), self.update_traits) self.connect(self.update_btn, SIGNAL('clicked()'), self.refreshlistView) def update_traits(self, suite_index): suite = self.suites[suite_index] self.traits.set_suite(suite) self.listView.set_suite(suite) self.listView.file_type = str(self.tcombo.currentText()) self._update_traits_combobox() def _update_traits_combobox(self): traits = [row.trait for row in self.traits.select()] traits.sort() self.trcombo.clear() self.trcombo.insertStrList(traits) return traits def refreshlistView(self): trait = str(self.trcombo.currentText()) if trait: self.listView.set_trait(trait) self.listView.file_type = str(self.tcombo.currentText()) suite = str(self.scombo.currentText()) self.traits.set_suite(suite) self.listView.set_suite(suite) traits = self._update_traits_combobox() if trait in traits: self.trcombo.setCurrentItem(traits.index(trait)) self.listView.refreshlistView() # returns template or script contents def getData(self): return self.listView.getData() # replace template or script contents def updateData(self, data): self.listView.updateData(data)