def __init__(self, parent, parentTableName, tagTableName): QWidget.__init__(self, parent) self.parentTableName = parentTableName self.tagTableName = tagTableName self.record = None self.lvi = None self.grdTags = QGridLayout(self) self.grdTags.setSpacing(6) self.grdTags.setMargin(11) self.cmbTags = kuraCmbTags(self, parentTableName) self.lblTags = guiLabel(self,'lblTags') self.lblTags.setText(self.tr('&Tag')) self.lblValue = guiLabel(self,'lblValue') self.lblValue.setText(self.tr('&Value')) self.cmbTagValues = kuraCmbTagValues(self, tagTableName) self.lblNote = guiLabel(self,'lblNote') self.lblNote.setText(self.tr('&Note')) self.lblNote.setAlignment(guiLabel.AlignTop | guiLabel.AlignLeft) self.txtNote = guiMultiLineEdit(self,'txtNote') self.lblDateStamp = guiLabel(self,'lblDateStamp') self.lblDateStamp.setText(self.tr('Last changed')) self.txtDatestamp = guiLabel(self,'txtDatestamp') self.txtDatestamp.setFrameShape(guiLabel.Panel) self.txtDatestamp.setFrameShadow(guiLabel.Sunken) self.lblTags.setBuddy(self.cmbTags) self.lblValue.setBuddy(self.cmbTagValues) self.lblNote.setBuddy(self.txtNote) self.bnSave = QPushButton("&Save", self) self.grdTags.addWidget(self.lblTags,0,0) self.grdTags.addWidget(self.cmbTags,0,1) self.grdTags.addWidget(self.lblValue,1,0) self.grdTags.addWidget(self.cmbTagValues,1,1) self.grdTags.addWidget(self.lblNote,2,0) self.grdTags.addWidget(self.txtNote,2,1) self.grdTags.addWidget(self.lblDateStamp,4,0) self.grdTags.addWidget(self.txtDatestamp,4,1) self.grdTags.addWidget(self.bnSave, 0, 2) self.connect(self.cmbTags, PYSIGNAL("recSelected"), self.cmbTagValues.slotRefresh) self.connect(self.bnSave, SIGNAL("clicked()"), self.save)
def __init__(self, parent, parentTableName, record): QWidget.__init__(self, parent) self.parentTableName=parentTableName self.record=record self.tableName=record.table if self.record.getPrimaryKey()==None: self.mode=INSERT else: self.mode=UPDATE self.grdTags = QGridLayout(self) self.grdTags.setSpacing(6) self.grdTags.setMargin(11) self.cmbTags = kuraCmbTags(self, parentTableName) self.lblTags = guiLabel(self,'lblTags') self.lblTags.setText(self.tr('&Tag')) self.lblValue = guiLabel(self,'lblValue') self.lblValue.setText(self.tr('&Value')) self.cmbTagValues = kuraCmbTagValues(self, self.tableName) self.lblNote = guiLabel(self,'lblNote') self.lblNote.setText(self.tr('&Note')) self.lblNote.setAlignment(guiLabel.AlignTop | guiLabel.AlignLeft) self.txtNote = guiMultiLineEdit(self,'txtNote') self.lblUser = guiLabel(self,'lblUser') self.lblUser.setText(self.tr('User')) self.txtUser = guiLabel(self,'txtUser') self.txtUser.setFrameShadow(guiLabel.Sunken) self.txtUser.setFrameShape(guiLabel.Panel) self.lblDateStamp = guiLabel(self,'lblDateStamp') self.lblDateStamp.setText(self.tr('Last changed')) self.txtDatestamp = guiLabel(self,'txtDatestamp') self.txtDatestamp.setFrameShape(guiLabel.Panel) self.txtDatestamp.setFrameShadow(guiLabel.Sunken) self.lblTags.setBuddy(self.cmbTags) self.lblValue.setBuddy(self.cmbTagValues) self.lblNote.setBuddy(self.txtNote) self.grdTags.addWidget(self.lblTags,0,0) self.grdTags.addWidget(self.cmbTags,0,1) self.grdTags.addWidget(self.lblValue,1,0) self.grdTags.addWidget(self.cmbTagValues,1,1) self.grdTags.addWidget(self.lblNote,2,0) self.grdTags.addWidget(self.txtNote,2,1) self.grdTags.addWidget(self.lblUser,3,0) self.grdTags.addWidget(self.txtUser,3,1) self.grdTags.addWidget(self.lblDateStamp,4,0) self.grdTags.addWidget(self.txtDatestamp,4,1) self.connect(self.cmbTags, PYSIGNAL("recSelected"),self.cmbTagValues.slotRefresh) self.cmbTags.setCurrentItem(record.tag) self.cmbTagValues.slotRefresh(record.tag) if record.value != None: self.cmbTagValues.slotSetCurrentItem(record.value) self.txtNote.setText(record.note) self.txtUser.setText(record.user) self.txtDatestamp.setText(str(record.datestamp)) self.setTabOrder(self.cmbTags,self.cmbTagValues) self.setTabOrder(self.cmbTagValues,self.txtNote)