class ClientTagEditorWin(SimpleWindow): def __init__(self, app, parent, clientid): SimpleWindow.__init__(self, app, parent, 'ContactEditor') self.app = app self.manager = ClientManager(self.app) self.clientid = clientid self.fields = ['tag', 'value'] self.dialogs = {} self.mainView = TagRowView(self.app, self, clientid) self.setCentralWidget(self.mainView) self.setCaption('ClientTagEditor') self.resize(300, 500) self.show() def initActions(self): collection = self.actionCollection() self.newAction = KStdAction.openNew(self.slotNewTag, collection) self.editAction = KStdAction.replace(self.slotEditTag, collection) self.quitAction = KStdAction.quit(self.close, collection) def initMenus(self): mainMenu = KPopupMenu(self) self.newAction.plug(mainMenu) self.editAction.plug(mainMenu) self.quitAction.plug(mainMenu) self.menuBar().insertItem('&Main', mainMenu) self.menuBar().insertItem('&Help', self.helpMenu('')) def initToolbar(self): toolbar = self.toolBar() self.newAction.plug(toolbar) self.editAction.plug(toolbar) self.quitAction.plug(toolbar) def slotNewTag(self): dlg = SimpleRecordDialog(self, ['tag', 'value']) dlg.connect(dlg, SIGNAL('okClicked()'), self.insertTag) dlg.connect(dlg, PYSIGNAL('updated()'), self.mainView.refreshlistView) self.dialogs['new-tag'] = dlg def slotEditTag(self): print 'slotEditTag' def insertTag(self): dlg = self.dialogs['new-tag'] data = dlg.getRecordData() print 'data', data #data['clientid'] = self.clientid self.manager.appendTag(self.clientid, data['tag'], data['value']) #self.manager.updateContact(contactid, data) dlg.emit(PYSIGNAL('updated()'), ()) dlg.close()