Ejemplo n.º 1
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)
Ejemplo n.º 2
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
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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)