def _make_box(self, text, choices): lbl = QLabel(self.frame) lbl.setText(text) box = KComboBox(self.frame) box.insertStrList(choices) self.vbox.addWidget(lbl) self.vbox.addWidget(box) return lbl, box
def __init__(self, parent, name='ScriptNameComboBox'): KComboBox.__init__(self, parent, name) self.app = get_application_pointer() self.cursor = StatementCursor(self.app.conn) self.scriptnames = [ row.script for row in self.cursor.select(table='scriptnames') ] self.insertStrList(self.scriptnames)
def __init__(self, parent, type, name='ScriptNameComboBox'): KComboBox.__init__(self, parent, name) self.app = get_application_pointer() self.cursor = StatementCursor(self.app.conn) clause=In('type', ['both', type]) rows = self.cursor.select(table='scriptnames', clause=clause) #self.scriptnames = [row.script for row in self.cursor.select(table='scriptnames')] self.scriptnames = [row.script for row in rows] self.insertStrList(self.scriptnames)
def __init__(self, parent, type, name='ScriptNameComboBox'): KComboBox.__init__(self, parent, name) self.app = get_application_pointer() self.cursor = StatementCursor(self.app.conn) clause = In('type', ['both', type]) rows = self.cursor.select(table='scriptnames', clause=clause) #self.scriptnames = [row.script for row in self.cursor.select(table='scriptnames')] self.scriptnames = [row.script for row in rows] self.insertStrList(self.scriptnames)
class NewExtraFieldDialog(SimpleEntryDialog): def __init__(self, parent, etype, name='NewExtraFieldDialog'): label = "Enter a new extra field for entity type %s" % etype SimpleEntryDialog.__init__(self, parent, label=label, name=name) self.combo = KComboBox(self.frame) types = ['name', 'bool', 'int', 'url', 'text'] self.combo.insertStrList(types) self.etype = etype self.vbox.addWidget(self.combo) def ok_clicked(self): fieldname = self._get_entry().strip() fieldtype = str(self.combo.currentText()) if fieldname: self.app.db.create_extra_field(self.etype, fieldname, fieldtype=fieldtype)
class SelectEntityTypeDialog(VboxDialog): def __init__(self, parent, name='SelectEntityTypeDialog'): VboxDialog.__init__(self, parent, name=name) self.label = QLabel('Select entity type', self.frame) self.combo = KComboBox(self.frame) self.vbox.addWidget(self.label) self.vbox.addWidget(self.combo) #etypes = self.app.db.get_entity_types() db = self.app.db etypes = [et.type for et in db.session.query(db.EntityType).all()] self.combo.insertStrList(etypes) self.connect(self.combo, SIGNAL('activated(const QString &)'), self._etype_selected) def _etype_selected(self, etype): self.emit(SIGNAL('okClicked()'), tuple()) self.close()
def __init__(self, parent, etype, name='NewExtraFieldDialog'): label = "Enter a new extra field for entity type %s" % etype SimpleEntryDialog.__init__(self, parent, label=label, name=name) self.combo = KComboBox(self.frame) types = ['name', 'bool', 'int', 'url', 'text'] self.combo.insertStrList(types) self.etype = etype self.vbox.addWidget(self.combo)
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, 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, parent, name='BaseEntityDataFrame'): AppFrame.__init__(self, parent, name) self.entityid = None numrows = 2 numcols = 1 margin = 3 space = 2 self.grid = QGridLayout(self, numrows, numcols, margin, space, 'BaseEntityDataLayout') self.app = get_application_pointer() self.name_lbl = QLabel('Name', self) self.name_entry = KLineEdit('', self) self.grid.addWidget(self.name_lbl, 0, 0) self.grid.addWidget(self.name_entry, 1, 0) self.etype_lbl = QLabel('type', self) self.etype_combo = KComboBox(self, 'etype_combo') db = self.app.db etypes = db.session.query(db.EntityType).all() self.etype_combo.insertStrList([e.type for e in etypes]) self.connect(self.etype_combo, SIGNAL('activated(const QString &)'), self.change_etype) self.grid.addWidget(self.etype_lbl, 2, 0) self.grid.addWidget(self.etype_combo, 3, 0) self.url_lbl = QLabel('url', self) self.url_entry = KLineEdit('', self) self.grid.addWidget(self.url_lbl, 4, 0) self.grid.addWidget(self.url_entry, 5, 0) grid_rownum = 6 self.desc_lbl = QLabel('Description', self) self.desc_entry = KTextEdit(self, 'description_entry') self.desc_entry.setTextFormat(self.PlainText) self.grid.addMultiCellWidget(self.desc_lbl, 6, 6, 0, 0) self.grid.addMultiCellWidget(self.desc_entry, 7, 10, 0, 0)
def __init__(self, parent): KComboBox.__init__(self, parent, 'MTScriptComboBox') self.insertStrList(MTSCRIPTS)
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)
def __init__(self, parent, name='ScriptNameComboBox'): KComboBox.__init__(self, parent, name) self.app = get_application_pointer() self.cursor = StatementCursor(self.app.conn) self.scriptnames = [row.script for row in self.cursor.select(table='scriptnames')] self.insertStrList(self.scriptnames)
def __init__(self, parent): KComboBox.__init__(self, parent, 'MachineScriptComboBox') self.insertStrList(MACHINE_SCRIPTS)
def __init__(self, parent, name='SuiteComboBox'): KComboBox.__init__(self, parent, name) self.initPaellaCommon() self.suites = SuiteCursor(self.conn) self.insertStrList(self.suites.get_suites())
class BaseEntityDataFrame(AppFrame): def __init__(self, parent, name='BaseEntityDataFrame'): AppFrame.__init__(self, parent, name) self.entityid = None numrows = 2 numcols = 1 margin = 3 space = 2 self.grid = QGridLayout(self, numrows, numcols, margin, space, 'BaseEntityDataLayout') self.app = get_application_pointer() self.name_lbl = QLabel('Name', self) self.name_entry = KLineEdit('', self) self.grid.addWidget(self.name_lbl, 0, 0) self.grid.addWidget(self.name_entry, 1, 0) self.etype_lbl = QLabel('type', self) self.etype_combo = KComboBox(self, 'etype_combo') db = self.app.db etypes = db.session.query(db.EntityType).all() self.etype_combo.insertStrList([e.type for e in etypes]) self.connect(self.etype_combo, SIGNAL('activated(const QString &)'), self.change_etype) self.grid.addWidget(self.etype_lbl, 2, 0) self.grid.addWidget(self.etype_combo, 3, 0) self.url_lbl = QLabel('url', self) self.url_entry = KLineEdit('', self) self.grid.addWidget(self.url_lbl, 4, 0) self.grid.addWidget(self.url_entry, 5, 0) grid_rownum = 6 self.desc_lbl = QLabel('Description', self) self.desc_entry = KTextEdit(self, 'description_entry') self.desc_entry.setTextFormat(self.PlainText) self.grid.addMultiCellWidget(self.desc_lbl, 6, 6, 0, 0) self.grid.addMultiCellWidget(self.desc_entry, 7, 10, 0, 0) #self.works_frame = BaseGuestWorksFrame(self) #self.grid.addMultiCellWidget(self.works_frame, 8, 8, 0, 1) def change_etype(self, etype): print 'change_etype', etype def get_data(self): name = str(self.name_entry.text()) etype = str(self.etype_combo.currentText()) url = str(self.url_entry.text()) desc = str(self.desc_entry.text()) data = dict(name=name, type=etype, url=url, desc=desc) if self.entityid is not None: data['entityid'] = self.entityid return data def set_entity(self, entity): self.entity = entity self.set_data(entity) def set_data(self, entity): self.entityid = entity.entityid self.name_entry.setText(entity.name) self.etype_combo.setCurrentText(entity.type) self.url_entry.setText(entity.url) self.desc_entry.setText(entity.desc)