class SuiteManagerWindow(BaseSplitWindow, BasePaellaWindow): def __init__(self, parent, name='SuiteManagerWindow'): BaseSplitWindow.__init__(self, parent, SuiteManagerView, name=name) self.initPaellaCommon() self.suitecursor = SuiteCursor(self.conn) self.refreshListView() self.initActions() self.initMenus() self.initToolbar() self.resize(800, 300) self.splitter.setSizes([100, 700]) def initActions(self): collection = self.actionCollection() self.newAction = KStdAction.openNew(self.slotNew, collection) self.quitAction = KStdAction.quit(self.close, collection) def initMenus(self): pass def initToolbar(self): toolbar = self.toolBar() self.newAction.plug(toolbar) self.quitAction.plug(toolbar) def initlistView(self): self.listView.addColumn('suite') def refreshListView(self): self.listView.clear() for suite in self.suitecursor.get_suites(): item = KListViewItem(self.listView, suite) item.suite = suite def selectionChanged(self): item = self.listView.currentItem() self.mainView.set_suite(item.suite) def slotNew(self): win = BaseRecordDialog(self, ['name']) win.connect(win, SIGNAL('okClicked()'), self.slotNewSuiteNamed) self._dialog = win win.show() def slotNewSuiteNamed(self): win = self._dialog suite = win.getRecordData()['name'] suite = suite.strip() if not suite: raise RuntimeError, 'no suite in slotNewSuiteNamed' win = SuiteAptAssigner(self, suite) win.show() def _destroy_dialog(self): self._dialog = None def _connect_dialog_destroy(self, dialog): pass
def get_all_defaults(self): suite_cursor = SuiteCursor(self.conn) suites = suite_cursor.get_suites() stmt = select_multisuite_union(suites, 'variables') print stmt self.cursor.execute(stmt) return self.cursor.fetchall()
class SuiteComboBox(KComboBox, BasePaellaWidget): def __init__(self, parent, name='SuiteComboBox'): KComboBox.__init__(self, parent, name) self.initPaellaCommon() self.suites = SuiteCursor(self.conn) self.insertStrList(self.suites.get_suites())