def __init__(self, parent, model): super(cTestsuiteView, self).__init__(parent) self.mapper = QtGui.QDataWidgetMapper() self.mapper.setModel(model) layout = QtGui.QGridLayout() self.setLayout(layout) layout.addWidget(QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "title")), 0, 0) layout.addWidget(QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "id")), 1, 0) layout.addWidget(QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "keywords")), 2, 0) layout.addWidget(QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "description"), alignment=Qt.AlignTop), 3, 0) layout.addWidget(QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "execorder")), 4, 0) ledId = QtGui.QSpinBox(self, maximum=sys.maxint) ledId.setReadOnly(True) # id is always read only ledTitle = QtGui.QLineEdit(self, readOnly=True) ledKeywords = QtGui.QLineEdit(self, readOnly=True) tedDescription = _oatr_commons.getTextViewer(self) ledExecorder = QtGui.QLineEdit(self, readOnly=True) # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment) layout.addWidget(ledTitle, 0, 1, 1, 1) layout.addWidget(ledId, 1, 1, 1, 1) layout.addWidget(ledKeywords, 2, 1, 1, 1) layout.addWidget(tedDescription, 3, 1, 1, 1) layout.addWidget(ledExecorder, 4, 1, 1, 1) layout.setColumnStretch(1, 1) layout.setRowStretch(3, 2) self.mapper.addMapping(ledId, model.fieldIndex('id')) self.mapper.addMapping(ledTitle, model.fieldIndex('title')) self.mapper.addMapping(ledKeywords, model.fieldIndex('keywords')) self.mapper.addMapping(tedDescription, model.fieldIndex('description')) self.mapper.addMapping(ledExecorder, model.fieldIndex('execorder'))
def __init__(self, parent, model): super(cTestsuiteView, self).__init__(parent) self.mapper = QtGui.QDataWidgetMapper() self.mapper.setModel(model) layout = QtGui.QGridLayout() self.setLayout(layout) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "title")), 0, 0) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "id")), 1, 0) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "keywords")), 2, 0) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "description"), alignment=Qt.AlignTop), 3, 0) layout.addWidget( QtGui.QLabel(nafdb.getColumnDisplayName("testsuites", "execorder")), 4, 0) ledId = QtGui.QSpinBox(self, maximum=sys.maxint) ledId.setReadOnly(True) # id is always read only ledTitle = QtGui.QLineEdit(self, readOnly=True) ledKeywords = QtGui.QLineEdit(self, readOnly=True) tedDescription = _oatr_commons.getTextViewer(self) ledExecorder = QtGui.QLineEdit(self, readOnly=True) # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment) layout.addWidget(ledTitle, 0, 1, 1, 1) layout.addWidget(ledId, 1, 1, 1, 1) layout.addWidget(ledKeywords, 2, 1, 1, 1) layout.addWidget(tedDescription, 3, 1, 1, 1) layout.addWidget(ledExecorder, 4, 1, 1, 1) layout.setColumnStretch(1, 1) layout.setRowStretch(3, 2) self.mapper.addMapping(ledId, model.fieldIndex('id')) self.mapper.addMapping(ledTitle, model.fieldIndex('title')) self.mapper.addMapping(ledKeywords, model.fieldIndex('keywords')) self.mapper.addMapping(tedDescription, model.fieldIndex('description')) self.mapper.addMapping(ledExecorder, model.fieldIndex('execorder'))
def __init__(self, parent, model, readOnly = True): super(cTestrunDetailsView, self).__init__(parent) self.mapper = QtGui.QDataWidgetMapper() self.mapper.setModel(model) self.mapper.setItemDelegate(cTestrunItemDelegate()) self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit) layout = QtGui.QGridLayout() self.setLayout(layout) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "id")), 1, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "title")), 0, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "keywords"), alignment=Qt.AlignRight|Qt.AlignVCenter), 1, 4) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "priority"), alignment=Qt.AlignRight|Qt.AlignVCenter), 1, 2) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "purpose"), alignment=Qt.AlignTop), 2, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "prerequisite"), alignment=Qt.AlignTop), 3, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "testdata"), alignment=Qt.AlignTop), 4, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "steps"), alignment=Qt.AlignTop),5, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "notes"), alignment=Qt.AlignTop), 6, 0) layout.addWidget(QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, "scripturl")), 7, 0) columns = "status user date action remark".split() labels = [] for c in columns: lbl = QtGui.QLabel(oadb.getDisplayNameForColumn(oadb.TESTRUN_TABLE, c)) if not readOnly: lbl.setStyleSheet('color:red; text-decoration:underline') labels.append(lbl) layout.addWidget(labels[0], 8, 0) layout.addWidget(labels[1], 9, 0) layout.addWidget(labels[2], 9, 4, alignment=Qt.AlignRight|Qt.AlignVCenter) layout.addWidget(labels[3], 10, 0, alignment=Qt.AlignTop) layout.addWidget(labels[4], 11, 0, alignment=Qt.AlignTop) ledId = QtGui.QSpinBox(self, maximum=sys.maxint) ledId.setReadOnly(True) # id is always read only ledTitle = QtGui.QLineEdit(self, readOnly=True) ledKeywords = QtGui.QLineEdit(self, readOnly=True) tedPurpose = _oatr_commons.getTextViewer(self) tedPrerequisite = _oatr_commons.getTextViewer(self) tedTestdata = _oatr_commons.getTextViewer(self) tedSteps = _oatr_commons.getTextViewer(self) tedNotes = _oatr_commons.getTextViewer(self) ledScripturl = QtGui.QLineEdit(self, readOnly=True) ledPriority = QtGui.QLineEdit(self, readOnly=True) ledPriority.setProperty('oatrname', 'ledPriority') self.swStatus = cTestrunStatusWidget(self, readOnly=readOnly) self.ledTester = QtGui.QLineEdit(self, readOnly=readOnly) self.ledDate = QtGui.QLineEdit(self, readOnly=readOnly) self.tedAction = QtGui.QTextEdit(self, readOnly=readOnly) self.tedAction.setWhatsThis(self.tr("Action taken when the testcase has failed")) self.tedRemark = QtGui.QTextEdit(self, readOnly=readOnly) self.tedRemark.setWhatsThis(self.tr("Remark for executed testcase")) # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment) layout.addWidget(ledId, 1, 1, 1, 1) layout.addWidget(ledTitle, 0, 1, 1, 5) layout.addWidget(ledPriority, 1, 3, 1, 1) layout.addWidget(ledKeywords, 1, 5, 1, 1) layout.addWidget(tedPurpose, 2, 1, 1, 5) layout.addWidget(tedPrerequisite, 3, 1, 1, 5) layout.addWidget(tedTestdata, 4, 1, 1, 5) layout.addWidget(tedSteps, 5, 1, 1, 5) layout.addWidget(tedNotes, 6, 1, 1, 5) layout.addWidget(ledScripturl, 7, 1, 1, 5) layout.addWidget(self.swStatus, 8, 1, 1, 5) layout.addWidget(self.ledDate, 9, 5, 1, 1) layout.addWidget(self.ledTester, 9, 1, 1, 3) layout.addWidget(self.tedAction, 10, 1, 1, 5) layout.addWidget(self.tedRemark, 11, 1, 1, 5) layout.setColumnStretch(1, 1) layout.setColumnStretch(5, 5) layout.setColumnStretch(3, 1) layout.setRowStretch(3, 2) layout.setRowStretch(4, 2) layout.setRowStretch(5, 2) layout.setRowStretch(6, 5) layout.setRowStretch(8, 2) self.mapper.addMapping(ledId, model.fieldIndex('id')) self.mapper.addMapping(ledTitle, model.fieldIndex('title')) self.mapper.addMapping(ledKeywords, model.fieldIndex('keywords')) self.mapper.addMapping(tedPurpose, model.fieldIndex('purpose')) self.mapper.addMapping(tedPrerequisite, model.fieldIndex('prerequisite')) self.mapper.addMapping(tedTestdata, model.fieldIndex('testdata')) self.mapper.addMapping(tedSteps, model.fieldIndex('steps')) self.mapper.addMapping(tedNotes, model.fieldIndex('notes')) self.mapper.addMapping(ledScripturl, model.fieldIndex('scripturl')) self.mapper.addMapping(ledPriority, model.fieldIndex('priority')) self.mapper.addMapping(self.swStatus, model.fieldIndex('status')) self.mapper.addMapping(self.ledTester, model.fieldIndex('user')) self.mapper.addMapping(self.ledDate, model.fieldIndex('date')) self.mapper.addMapping(self.tedAction, model.fieldIndex('action')) self.mapper.addMapping(self.tedRemark, model.fieldIndex('remark'))