Example #1
0
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)
Example #2
0
 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()
Example #3
0
 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)
Example #4
0
 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()
Example #5
0
 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.ubutton = KPushButton('update', self)
     self.listView = TraitList(self.app, self)
     self.vbox = QVBoxLayout(self)
     for member in ['listView', 'scombo', 'tcombo', '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)
Example #6
0
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)
Example #7
0
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
Example #8
0
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
Example #9
0
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)
Example #10
0
 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.ubutton = KPushButton('update', self)
     self.listView = TraitList(self.app, self)
     self.vbox = QVBoxLayout(self)
     for member in ['listView', 'scombo', 'tcombo', '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)