Пример #1
0
 def updateView(self, data):
     try:
         itemList = json.loads(data)
     except:
         return
     for label, col in zip([self.tr('Old value'), self.tr('New value')], [1, 2]):
         lbl = QtGui.QLabel(label)
         lbl.setStyleSheet("font-weight: bold; background-color:rgba(255, 10, 10, 10%); border-style: outset; border-width:2px; border-color:#909090;")
         self.layout().addWidget(lbl, 0, col, alignment=Qt.AlignTop)
     row = 1
     for item in itemList:
         for field, col in zip(['old', 'new'], [1, 2]):
             if self._isHtml(item['old']) or self._isHtml(item['new']):
                 widget = _naf_textviewer.cTextEditor(self, readOnly=True)
                 widget.setImageProvider(_imageProvider)
                 QtGui.QTextEdit(readOnly=True)
                 widget.setHtml(item[field])
                 alignment=Qt.AlignTop 
             else:
                 widget = QtGui.QLineEdit()
                 widget.setText(unicode(item[field]))
                 alignment=Qt.AlignVCenter
             self.layout().addWidget(widget, row, col, alignment=Qt.AlignTop)
         if item.has_key('table'):
             # this key is available in version 0.3.1 and newer
             s = nafdb.getColumnDisplayName(item['table'], item['column'])
         else:
             s = item['column']
         self.layout().addWidget(QtGui.QLabel(s, alignment=alignment), row, 0)
         row = row + 1
     self.layout().addItem(QtGui.QSpacerItem(1,1, 1, -1), row, 0)
Пример #2
0
    def __init__(self, parent, isEditable=False):
        super(cImageView, self).__init__(parent)
        self.defaultTitle = self.tr("New Image")
        self.editTitle = self.tr("Edit image")
        self.detailsView = self
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setModel(cImageModel())
        self.mapper.setItemDelegate(cImageItemDelegate())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)
        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("format")), 4, 0)
        layout.addWidget(QtGui.QLabel(lbl("source")), 4, 2)
        layout.addWidget(QtGui.QLabel(lbl("image"), alignment=Qt.AlignTop), 5, 0)

        lblDescription = self.makeEditLinkLabel("description", not isEditable)
        lblDescription.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblDescription, 3, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True) # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=not isEditable)
        cbxKeywords = QtGui.QComboBox(self, enabled=isEditable, editable=True)
        cbxKeywords.setModel(self.mapper.model().getHistoryModel('keywords_view'))
        tedDescription = _naf_textviewer.cTextEditor(self, readOnly=not isEditable)
        cbxSource = QtGui.QComboBox(self, enabled=isEditable, editable=True)
        cbxSource.setModel(self.mapper.model().getHistoryModel('source_view'))
        ledFormat = QtGui.QLineEdit(self, readOnly=True)
        imgViewer = _naf_imageviewer.cImageViewer(self, isEditable=isEditable)
        imgViewer.imageLoadedSignal.connect(ledFormat.setText)

        tedDescription.setImageProvider(nafdb.getImageForId)

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId,          0, 1, 1, 3)
        layout.addWidget(ledTitle,       1, 1, 1, 3)
        layout.addWidget(cbxKeywords,    2, 1, 1, 3)
        layout.addWidget(tedDescription, 3, 1, 1, 3)
        layout.addWidget(ledFormat,      4, 1, 1, 1)
        layout.addWidget(cbxSource,      4, 3, 1, 1)
        layout.addWidget(imgViewer,      5, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 5)
        layout.setRowStretch(3, 1)
        layout.setRowStretch(5, 10)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(tedDescription, columns.index('description'))
        self.mapper.addMapping(cbxSource, columns.index('source'))
        self.mapper.addMapping(ledFormat, columns.index('format'))
        self.mapper.addMapping(imgViewer, columns.index('image'))
Пример #3
0
    def __init__(self, parent, readOnly=True):
        super(cFeatureDetailsView, self).__init__(parent)
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cFeatureModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)

        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("priority")), 3, 0)
        layout.addWidget(QtGui.QLabel(lbl("risk")), 3, 2)
        layout.addWidget(QtGui.QLabel(lbl("status")), 3, 4)
        lblDescription = self.makeEditLinkLabel("description", readOnly)
        lblDescription.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblDescription, 4, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True) # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=readOnly)
        cbxKeywords = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxKeywords.setModel(self.mapper.model().getHistoryModel('keywords_view'))
        cbxPriority = QtGui.QComboBox(self, enabled=not readOnly)
        cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT'))
        cbxStatus = QtGui.QComboBox(self, enabled=not readOnly)
        cbxStatus.setModel(self.mapper.model().getLookupModel('statusLUT'))
        cbxRisk = QtGui.QComboBox(self, enabled=not readOnly)
        cbxRisk.setModel(self.mapper.model().getLookupModel('riskLUT'))
        tedDescription = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedDescription.setImageProvider(nafdb.getImageForId)

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId,          0, 1, 1, 5)
        layout.addWidget(ledTitle,       1, 1, 1, 5)
        layout.addWidget(cbxKeywords,    2, 1, 1, 5)
        layout.addWidget(cbxPriority,    3, 1, 1, 1)
        layout.addWidget(cbxRisk,        3, 3, 1, 1)
        layout.addWidget(cbxStatus,      3, 5, 1, 1)
        layout.addWidget(tedDescription, 4, 1, 1, 5)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 1)
        layout.setColumnStretch(5, 1)
        layout.setRowStretch(4, 1)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(cbxPriority, columns.index('priority'))
        self.mapper.addMapping(cbxStatus, columns.index('status'))
        self.mapper.addMapping(cbxRisk, columns.index('risk'))
        self.mapper.addMapping(tedDescription, columns.index('description'))
Пример #4
0
    def __init__(self, parent, isEditable=False):
        super(cSimplesectionView, self).__init__(parent)
        self.defaultTitle = self.tr("New Text Section")
        self.editTitle = self.tr("Edit text section")
        self.detailsView = self
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cSimplesectionModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)
        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)

        lblContent = self.makeEditLinkLabel("content", not isEditable)
        lblContent.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblContent, 3, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True)  # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=not isEditable)
        cbxKeywords = QtGui.QComboBox(self, enabled=isEditable, editable=True)
        cbxKeywords.setModel(
            self.mapper.model().getHistoryModel('keywords_view'))
        tedContent = _naf_textviewer.cTextEditor(self, readOnly=not isEditable)
        tedContent.setImageProvider(nafdb.getImageForId)

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId, 0, 1, 1, 3)
        layout.addWidget(ledTitle, 1, 1, 1, 3)
        layout.addWidget(cbxKeywords, 2, 1, 1, 3)
        layout.addWidget(tedContent, 3, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 1)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(tedContent, columns.index('content'))
Пример #5
0
    def __init__(self, parent, isEditable=False):
        super(cSimplesectionView, self).__init__(parent)
        self.defaultTitle = self.tr("New Text Section")
        self.editTitle = self.tr("Edit text section")
        self.detailsView = self
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cSimplesectionModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)
        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)

        lblContent = self.makeEditLinkLabel("content", not isEditable)
        lblContent.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblContent, 3, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True) # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=not isEditable)
        cbxKeywords = QtGui.QComboBox(self, enabled=isEditable, editable=True)
        cbxKeywords.setModel(self.mapper.model().getHistoryModel('keywords_view'))
        tedContent = _naf_textviewer.cTextEditor(self, readOnly=not isEditable)
        tedContent.setImageProvider(nafdb.getImageForId)

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId,          0, 1, 1, 3)
        layout.addWidget(ledTitle,       1, 1, 1, 3)
        layout.addWidget(cbxKeywords,    2, 1, 1, 3)
        layout.addWidget(tedContent,     3, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 1)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(tedContent, columns.index('content'))
Пример #6
0
    def __init__(self, parent, controller):
        super(cReportView, self).__init__(parent)
        self.controller = controller
        self.setMinimumSize(640, 480)
        self.setSizeGripEnabled(True)
        self.setWindowTitle(self.tr("Report"))
        self.reportText = _naf_textviewer.cTextEditor(readOnly=True)
        self.reportText.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Sunken)

        self.editButtonBox = QtGui.QDialogButtonBox()
        btnUpdate = QtGui.QPushButton(self.tr("&Update"))
        btnUpdate.clicked.connect(self.updateReport)
        btnSave = QtGui.QPushButton(self.tr("&Save"))
        btnSave.clicked.connect(self.saveReport)
        self.editButtonBox.addButton(btnUpdate, QtGui.QDialogButtonBox.ActionRole)
        self.editButtonBox.addButton(btnSave, QtGui.QDialogButtonBox.ActionRole)
        self.editButtonBox.addButton(QtGui.QDialogButtonBox.Close)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.reportText)
        layout.addWidget(self.editButtonBox)
        self.setLayout(layout)
        self.editButtonBox.rejected.connect(self.hide)
Пример #7
0
 def updateView(self, data):
     try:
         itemList = json.loads(data)
     except:
         return
     for label, col in zip(
         [self.tr('Old value'), self.tr('New value')], [1, 2]):
         lbl = QtGui.QLabel(label)
         lbl.setStyleSheet(
             "font-weight: bold; background-color:rgba(255, 10, 10, 10%); border-style: outset; border-width:2px; border-color:#909090;"
         )
         self.layout().addWidget(lbl, 0, col, alignment=Qt.AlignTop)
     row = 1
     for item in itemList:
         for field, col in zip(['old', 'new'], [1, 2]):
             if self._isHtml(item['old']) or self._isHtml(item['new']):
                 widget = _naf_textviewer.cTextEditor(self, readOnly=True)
                 widget.setImageProvider(_imageProvider)
                 QtGui.QTextEdit(readOnly=True)
                 widget.setHtml(item[field])
                 alignment = Qt.AlignTop
             else:
                 widget = QtGui.QLineEdit()
                 widget.setText(unicode(item[field]))
                 alignment = Qt.AlignVCenter
             self.layout().addWidget(widget,
                                     row,
                                     col,
                                     alignment=Qt.AlignTop)
         if item.has_key('table'):
             # this key is available in version 0.3.1 and newer
             s = nafdb.getColumnDisplayName(item['table'], item['column'])
         else:
             s = item['column']
         self.layout().addWidget(QtGui.QLabel(s, alignment=alignment), row,
                                 0)
         row = row + 1
     self.layout().addItem(QtGui.QSpacerItem(1, 1, 1, -1), row, 0)
Пример #8
0
    def __init__(self, parent, controller):
        super(cReportView, self).__init__(parent)
        self.controller = controller
        self.setMinimumSize(640, 480)
        self.setSizeGripEnabled(True)
        self.setWindowTitle(self.tr("Report"))
        self.reportText = _naf_textviewer.cTextEditor(readOnly=True)
        self.reportText.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Sunken)

        self.editButtonBox = QtGui.QDialogButtonBox()
        btnUpdate = QtGui.QPushButton(self.tr("&Update"))
        btnUpdate.clicked.connect(self.updateReport)
        btnSave = QtGui.QPushButton(self.tr("&Save"))
        btnSave.clicked.connect(self.saveReport)
        self.editButtonBox.addButton(btnUpdate,
                                     QtGui.QDialogButtonBox.ActionRole)
        self.editButtonBox.addButton(btnSave,
                                     QtGui.QDialogButtonBox.ActionRole)
        self.editButtonBox.addButton(QtGui.QDialogButtonBox.Close)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.reportText)
        layout.addWidget(self.editButtonBox)
        self.setLayout(layout)
        self.editButtonBox.rejected.connect(self.hide)
Пример #9
0
    def __init__(self, parent, readOnly=True):
        super(cRequirementDetailsView, self).__init__(parent)
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cRequirementModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)

        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("priority")), 3, 0)
        layout.addWidget(QtGui.QLabel(lbl("status")), 3, 2)
        layout.addWidget(QtGui.QLabel(lbl("complexity")), 5, 0)
        layout.addWidget(QtGui.QLabel(lbl("assigned")), 5, 2)
        layout.addWidget(QtGui.QLabel(lbl("effort")), 6, 0)
        layout.addWidget(QtGui.QLabel(lbl("category")), 4, 2)
        layout.addWidget(QtGui.QLabel(lbl("origin")), 9, 0)
        layout.addWidget(QtGui.QLabel(lbl("risk")), 4, 0)
        layout.addWidget(QtGui.QLabel(lbl("baseline")), 6, 2)
        layout.addWidget(QtGui.QLabel(lbl("testability")), 8, 0)

        lblRationale = self.makeEditLinkLabel("rationale", readOnly)
        lblRationale.linkActivated.connect(self.sendEditSignal)

        lblDescription = self.makeEditLinkLabel("description", readOnly)
        lblDescription.linkActivated.connect(self.sendEditSignal)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True) # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=readOnly)

        cbxKeywords = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxKeywords.setModel(self.mapper.model().getHistoryModel('keywords_view'))

        tedDescription = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        cbxAssigned = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxAssigned.setModel(self.mapper.model().getHistoryModel('assigned_view'))

        tedRationale = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedRationale.setImageProvider(nafdb.getImageForId)
        self.mapper.addMapping(tedRationale, columns.index('rationale'))

        cbxOrigin = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxOrigin.setModel(self.mapper.model().getHistoryModel('origin_view'))

        cbxPriority = QtGui.QComboBox(self, enabled=not readOnly)
        cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT'))

        cbxStatus = QtGui.QComboBox(self, enabled=not readOnly)
        cbxStatus.setModel(self.mapper.model().getLookupModel('statusLUT'))

        cbxComplexity = QtGui.QComboBox(self, enabled=not readOnly)
        cbxComplexity.setModel(self.mapper.model().getLookupModel('complexityLUT'))

        cbxEffort = QtGui.QComboBox(self, enabled=not readOnly)
        cbxEffort.setModel(self.mapper.model().getLookupModel('effortLUT'))

        cbxCategory = QtGui.QComboBox(self, enabled=not readOnly)
        cbxCategory.setModel(self.mapper.model().getLookupModel('categoryLUT'))

        tedDescription.setImageProvider(nafdb.getImageForId)
        
        cbxRisk = QtGui.QComboBox(self, enabled=not readOnly)
        cbxRisk.setModel(self.mapper.model().getLookupModel('riskLUT'))
        
        cbxBaseline =  QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxBaseline.setModel(self.mapper.model().getHistoryModel('baseline_view'))
        
        cbxTestability =  QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxTestability.setModel(self.mapper.model().getHistoryModel('testability_view'))

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId,          0, 1, 1, 3)
        layout.addWidget(ledTitle,       1, 1, 1, 3)
        layout.addWidget(cbxKeywords,    2, 1, 1, 3)
        layout.addWidget(cbxPriority,    3, 1, 1, 1)
        layout.addWidget(cbxRisk,        4, 1, 1, 1)
        layout.addWidget(cbxComplexity,  5, 1, 1, 1)
        layout.addWidget(cbxEffort,      6, 1, 1, 1)
        
        layout.addWidget(cbxStatus,      3, 3, 1, 1)
        layout.addWidget(cbxCategory,    4, 3, 1, 1)
        layout.addWidget(cbxAssigned,    5, 3, 1, 1)
        layout.addWidget(cbxBaseline,    6, 3, 1, 1)
        
        layout.addWidget(lblDescription, 7, 0)
        layout.addWidget(tedDescription, 7, 1, 1, 3)
        layout.addWidget(cbxTestability, 8, 1, 1, 3)
        layout.addWidget(cbxOrigin,      9, 1, 1, 3)
        layout.addWidget(lblRationale,   10, 0)
        layout.addWidget(tedRationale,   10, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 1)
        layout.setRowStretch(7, 5)
        layout.setRowStretch(10, 1)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(tedDescription, columns.index('description'))
        self.mapper.addMapping(cbxAssigned, columns.index('assigned'))

        self.mapper.addMapping(cbxOrigin, columns.index('origin'))
        self.mapper.addMapping(cbxPriority, columns.index('priority'))
        self.mapper.addMapping(cbxStatus, columns.index('status'))
        self.mapper.addMapping(cbxComplexity, columns.index('complexity'))
        self.mapper.addMapping(cbxEffort, columns.index('effort'))
        self.mapper.addMapping(cbxCategory, columns.index('category'))
        
        self.mapper.addMapping(cbxRisk, columns.index('risk'))
        self.mapper.addMapping(cbxBaseline, columns.index('baseline'))
        self.mapper.addMapping(cbxTestability, columns.index('testability'))
Пример #10
0
    def __init__(self, parent, isEditable=False):
        super(cImageView, self).__init__(parent)
        self.defaultTitle = self.tr("New Image")
        self.editTitle = self.tr("Edit image")
        self.detailsView = self
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setModel(cImageModel())
        self.mapper.setItemDelegate(cImageItemDelegate())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)
        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("format")), 4, 0)
        layout.addWidget(QtGui.QLabel(lbl("source")), 4, 2)
        layout.addWidget(QtGui.QLabel(lbl("image"), alignment=Qt.AlignTop), 5,
                         0)

        lblDescription = self.makeEditLinkLabel("description", not isEditable)
        lblDescription.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblDescription, 3, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True)  # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=not isEditable)
        cbxKeywords = QtGui.QComboBox(self, enabled=isEditable, editable=True)
        cbxKeywords.setModel(
            self.mapper.model().getHistoryModel('keywords_view'))
        tedDescription = _naf_textviewer.cTextEditor(self,
                                                     readOnly=not isEditable)
        cbxSource = QtGui.QComboBox(self, enabled=isEditable, editable=True)
        cbxSource.setModel(self.mapper.model().getHistoryModel('source_view'))
        ledFormat = QtGui.QLineEdit(self, readOnly=True)
        imgViewer = _naf_imageviewer.cImageViewer(self, isEditable=isEditable)
        imgViewer.imageLoadedSignal.connect(ledFormat.setText)

        tedDescription.setImageProvider(nafdb.getImageForId)

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId, 0, 1, 1, 3)
        layout.addWidget(ledTitle, 1, 1, 1, 3)
        layout.addWidget(cbxKeywords, 2, 1, 1, 3)
        layout.addWidget(tedDescription, 3, 1, 1, 3)
        layout.addWidget(ledFormat, 4, 1, 1, 1)
        layout.addWidget(cbxSource, 4, 3, 1, 1)
        layout.addWidget(imgViewer, 5, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 5)
        layout.setRowStretch(3, 1)
        layout.setRowStretch(5, 10)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(tedDescription, columns.index('description'))
        self.mapper.addMapping(cbxSource, columns.index('source'))
        self.mapper.addMapping(ledFormat, columns.index('format'))
        self.mapper.addMapping(imgViewer, columns.index('image'))
Пример #11
0
def getTextViewer(parent):
    tvObj = _naf_textviewer.cTextEditor(parent, readOnly=True)
    tvObj.setImageProvider(__imageProvider)
    return tvObj
Пример #12
0
    def __init__(self, parent, readOnly=True):
        super(cRequirementDetailsView, self).__init__(parent)
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cRequirementModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)

        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("priority")), 3, 0)
        layout.addWidget(QtGui.QLabel(lbl("status")), 3, 2)
        layout.addWidget(QtGui.QLabel(lbl("complexity")), 5, 0)
        layout.addWidget(QtGui.QLabel(lbl("assigned")), 5, 2)
        layout.addWidget(QtGui.QLabel(lbl("effort")), 6, 0)
        layout.addWidget(QtGui.QLabel(lbl("category")), 4, 2)
        layout.addWidget(QtGui.QLabel(lbl("origin")), 9, 0)
        layout.addWidget(QtGui.QLabel(lbl("risk")), 4, 0)
        layout.addWidget(QtGui.QLabel(lbl("baseline")), 6, 2)
        layout.addWidget(QtGui.QLabel(lbl("testability")), 8, 0)

        lblRationale = self.makeEditLinkLabel("rationale", readOnly)
        lblRationale.linkActivated.connect(self.sendEditSignal)

        lblDescription = self.makeEditLinkLabel("description", readOnly)
        lblDescription.linkActivated.connect(self.sendEditSignal)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True)  # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=readOnly)

        cbxKeywords = QtGui.QComboBox(self,
                                      enabled=not readOnly,
                                      editable=True)
        cbxKeywords.setModel(
            self.mapper.model().getHistoryModel('keywords_view'))

        tedDescription = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        cbxAssigned = QtGui.QComboBox(self,
                                      enabled=not readOnly,
                                      editable=True)
        cbxAssigned.setModel(
            self.mapper.model().getHistoryModel('assigned_view'))

        tedRationale = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedRationale.setImageProvider(nafdb.getImageForId)
        self.mapper.addMapping(tedRationale, columns.index('rationale'))

        cbxOrigin = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxOrigin.setModel(self.mapper.model().getHistoryModel('origin_view'))

        cbxPriority = QtGui.QComboBox(self, enabled=not readOnly)
        cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT'))

        cbxStatus = QtGui.QComboBox(self, enabled=not readOnly)
        cbxStatus.setModel(self.mapper.model().getLookupModel('statusLUT'))

        cbxComplexity = QtGui.QComboBox(self, enabled=not readOnly)
        cbxComplexity.setModel(
            self.mapper.model().getLookupModel('complexityLUT'))

        cbxEffort = QtGui.QComboBox(self, enabled=not readOnly)
        cbxEffort.setModel(self.mapper.model().getLookupModel('effortLUT'))

        cbxCategory = QtGui.QComboBox(self, enabled=not readOnly)
        cbxCategory.setModel(self.mapper.model().getLookupModel('categoryLUT'))

        tedDescription.setImageProvider(nafdb.getImageForId)

        cbxRisk = QtGui.QComboBox(self, enabled=not readOnly)
        cbxRisk.setModel(self.mapper.model().getLookupModel('riskLUT'))

        cbxBaseline = QtGui.QComboBox(self,
                                      enabled=not readOnly,
                                      editable=True)
        cbxBaseline.setModel(
            self.mapper.model().getHistoryModel('baseline_view'))

        cbxTestability = QtGui.QComboBox(self,
                                         enabled=not readOnly,
                                         editable=True)
        cbxTestability.setModel(
            self.mapper.model().getHistoryModel('testability_view'))

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId, 0, 1, 1, 3)
        layout.addWidget(ledTitle, 1, 1, 1, 3)
        layout.addWidget(cbxKeywords, 2, 1, 1, 3)
        layout.addWidget(cbxPriority, 3, 1, 1, 1)
        layout.addWidget(cbxRisk, 4, 1, 1, 1)
        layout.addWidget(cbxComplexity, 5, 1, 1, 1)
        layout.addWidget(cbxEffort, 6, 1, 1, 1)

        layout.addWidget(cbxStatus, 3, 3, 1, 1)
        layout.addWidget(cbxCategory, 4, 3, 1, 1)
        layout.addWidget(cbxAssigned, 5, 3, 1, 1)
        layout.addWidget(cbxBaseline, 6, 3, 1, 1)

        layout.addWidget(lblDescription, 7, 0)
        layout.addWidget(tedDescription, 7, 1, 1, 3)
        layout.addWidget(cbxTestability, 8, 1, 1, 3)
        layout.addWidget(cbxOrigin, 9, 1, 1, 3)
        layout.addWidget(lblRationale, 10, 0)
        layout.addWidget(tedRationale, 10, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 1)
        layout.setRowStretch(7, 5)
        layout.setRowStretch(10, 1)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(tedDescription, columns.index('description'))
        self.mapper.addMapping(cbxAssigned, columns.index('assigned'))

        self.mapper.addMapping(cbxOrigin, columns.index('origin'))
        self.mapper.addMapping(cbxPriority, columns.index('priority'))
        self.mapper.addMapping(cbxStatus, columns.index('status'))
        self.mapper.addMapping(cbxComplexity, columns.index('complexity'))
        self.mapper.addMapping(cbxEffort, columns.index('effort'))
        self.mapper.addMapping(cbxCategory, columns.index('category'))

        self.mapper.addMapping(cbxRisk, columns.index('risk'))
        self.mapper.addMapping(cbxBaseline, columns.index('baseline'))
        self.mapper.addMapping(cbxTestability, columns.index('testability'))
Пример #13
0
def getTextViewer(parent):
    tvObj = _naf_textviewer.cTextEditor(parent, readOnly=True)
    tvObj.setImageProvider(__imageProvider)
    return tvObj
Пример #14
0
    def __init__(self, parent, readOnly=True):
        super(cTestcaseDetailsView, self).__init__(parent)
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cTestcaseModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)

        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("priority")), 2, 2)

        lblPurpose = self.makeEditLinkLabel("purpose", readOnly)
        lblPurpose.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblPurpose, 3, 0)

        lblPrerequisite = self.makeEditLinkLabel("prerequisite", readOnly)
        lblPrerequisite.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblPrerequisite, 4, 0)

        lblTestdata = self.makeEditLinkLabel("testdata", readOnly)
        lblTestdata.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblTestdata, 5, 0)

        lblSteps = self.makeEditLinkLabel("steps", readOnly)
        lblSteps.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblSteps, 6, 0)

        lblNotes = self.makeEditLinkLabel("notes", readOnly)
        lblNotes.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblNotes, 7, 0)

        layout.addWidget(QtGui.QLabel(lbl("scripturl")), 8, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True) # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=readOnly)
        cbxKeywords = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxKeywords.setModel(self.mapper.model().getHistoryModel('keywords_view'))
        tedPurpose = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedPurpose.setImageProvider(nafdb.getImageForId)
        tedPrerequisite = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedPrerequisite.setImageProvider(nafdb.getImageForId)
        tedTestdata = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedTestdata.setImageProvider(nafdb.getImageForId)
        tedSteps = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedSteps.setImageProvider(nafdb.getImageForId)
        tedNotes = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedNotes.setImageProvider(nafdb.getImageForId)
        ledScripturl = QtGui.QLineEdit(self, readOnly=readOnly)
        cbxPriority = QtGui.QComboBox(self, enabled=not readOnly)
        cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT'))

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId,           0, 1, 1, 3)
        layout.addWidget(ledTitle,        1, 1, 1, 3)
        layout.addWidget(cbxPriority,     2, 3, 1, 1)
        layout.addWidget(cbxKeywords,     2, 1, 1, 1)
        layout.addWidget(tedPurpose,      3, 1, 1, 3)
        layout.addWidget(tedPrerequisite, 4, 1, 1, 3)
        layout.addWidget(tedTestdata,     5, 1, 1, 3)
        layout.addWidget(tedSteps,        6, 1, 1, 3)
        layout.addWidget(tedNotes,        7, 1, 1, 3)
        layout.addWidget(ledScripturl,    8, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setRowStretch(3, 2)
        layout.setRowStretch(4, 2)
        layout.setRowStretch(5, 2)
        layout.setRowStretch(6, 5)
        layout.setRowStretch(7, 2)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(tedPurpose, columns.index('purpose'))
        self.mapper.addMapping(tedPrerequisite, columns.index('prerequisite'))
        self.mapper.addMapping(tedTestdata, columns.index('testdata'))
        self.mapper.addMapping(tedSteps, columns.index('steps'))
        self.mapper.addMapping(tedNotes, columns.index('notes'))
        self.mapper.addMapping(ledScripturl, columns.index('scripturl'))
        self.mapper.addMapping(cbxPriority, columns.index('priority'))
Пример #15
0
    def __init__(self, parent, readOnly=True):
        super(cUsecaseDetailsView, self).__init__(parent)
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cUsecaseModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)

        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)

        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("priority")), 3, 0)
        layout.addWidget(QtGui.QLabel(lbl("usefrequency")), 3, 2)
        layout.addWidget(QtGui.QLabel(lbl("actors")), 4, 0)
        layout.addWidget(QtGui.QLabel(lbl("stakeholders")), 5, 0)

        lblPrerequisites = self.makeEditLinkLabel("prerequisites", readOnly)
        lblPrerequisites.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblPrerequisites, 6, 0)

        lblMainscenario = self.makeEditLinkLabel("mainscenario", readOnly)
        lblMainscenario.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblMainscenario, 7, 0)

        lblAltscenario = self.makeEditLinkLabel("altscenario", readOnly)
        lblAltscenario.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblAltscenario, 8, 0)

        lblNotes = self.makeEditLinkLabel("notes", readOnly)
        lblNotes.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblNotes, 9, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True) # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=readOnly)

        cbxKeywords = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxKeywords.setModel(self.mapper.model().getHistoryModel('keywords_view'))

        tedPrerequisites = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedMainscenario = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedAltscenario = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedNotes = _naf_textviewer.cTextEditor(self, readOnly=readOnly)

        #cbxPriority = QtGui.QLineEdit(self, readOnly=True)
        cbxPriority = QtGui.QComboBox(self, enabled=not readOnly)
        cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT'))

        #cbxUsefrequency = QtGui.QLineEdit(self, readOnly=True)
        cbxUsefrequency = QtGui.QComboBox(self, enabled=not readOnly)
        cbxUsefrequency.setModel(self.mapper.model().getLookupModel('usefrequencyLUT'))

        cbxActors = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxActors.setModel(self.mapper.model().getHistoryModel('actors_view'))
        cbxStakeholders = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxStakeholders.setModel(self.mapper.model().getHistoryModel('stakeholders_view'))

        tedPrerequisites.setImageProvider(nafdb.getImageForId)
        tedMainscenario.setImageProvider(nafdb.getImageForId)
        tedAltscenario.setImageProvider(nafdb.getImageForId)
        tedNotes.setImageProvider(nafdb.getImageForId)

        layout.addWidget(ledId,            0, 1, 1, 3)
        layout.addWidget(ledTitle,         1, 1, 1, 3)
        layout.addWidget(cbxKeywords,      2, 1, 1, 3)
        layout.addWidget(cbxPriority,      3, 1, 1, 1)
        layout.addWidget(cbxUsefrequency,  3, 3, 1, 1)
        layout.addWidget(cbxActors,        4, 1, 1, 3)
        layout.addWidget(cbxStakeholders,  5, 1, 1, 3)
        layout.addWidget(tedPrerequisites, 6, 1, 1, 3)
        layout.addWidget(tedMainscenario,  7, 1, 1, 3)
        layout.addWidget(tedAltscenario,   8, 1, 1, 3)
        layout.addWidget(tedNotes,         9, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 1)
        layout.setRowStretch(6, 1)
        layout.setRowStretch(7, 3)
        layout.setRowStretch(8, 2)
        layout.setRowStretch(9, 1)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(cbxPriority, columns.index('priority'))
        self.mapper.addMapping(cbxUsefrequency, columns.index('usefrequency'))
        self.mapper.addMapping(cbxActors, columns.index('actors'))
        self.mapper.addMapping(cbxStakeholders, columns.index('stakeholders'))
        self.mapper.addMapping(tedPrerequisites, columns.index('prerequisites'))
        self.mapper.addMapping(tedMainscenario, columns.index('mainscenario'))
        self.mapper.addMapping(tedAltscenario, columns.index('altscenario'))
        self.mapper.addMapping(tedNotes, columns.index('notes'))
Пример #16
0
    def __init__(self, parent, readOnly=True):
        super(cUsecaseDetailsView, self).__init__(parent)
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cUsecaseModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)

        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)

        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("priority")), 3, 0)
        layout.addWidget(QtGui.QLabel(lbl("usefrequency")), 3, 2)
        layout.addWidget(QtGui.QLabel(lbl("actors")), 4, 0)
        layout.addWidget(QtGui.QLabel(lbl("stakeholders")), 5, 0)

        lblPrerequisites = self.makeEditLinkLabel("prerequisites", readOnly)
        lblPrerequisites.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblPrerequisites, 6, 0)

        lblMainscenario = self.makeEditLinkLabel("mainscenario", readOnly)
        lblMainscenario.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblMainscenario, 7, 0)

        lblAltscenario = self.makeEditLinkLabel("altscenario", readOnly)
        lblAltscenario.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblAltscenario, 8, 0)

        lblNotes = self.makeEditLinkLabel("notes", readOnly)
        lblNotes.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblNotes, 9, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True)  # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=readOnly)

        cbxKeywords = QtGui.QComboBox(self,
                                      enabled=not readOnly,
                                      editable=True)
        cbxKeywords.setModel(
            self.mapper.model().getHistoryModel('keywords_view'))

        tedPrerequisites = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedMainscenario = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedAltscenario = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedNotes = _naf_textviewer.cTextEditor(self, readOnly=readOnly)

        #cbxPriority = QtGui.QLineEdit(self, readOnly=True)
        cbxPriority = QtGui.QComboBox(self, enabled=not readOnly)
        cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT'))

        #cbxUsefrequency = QtGui.QLineEdit(self, readOnly=True)
        cbxUsefrequency = QtGui.QComboBox(self, enabled=not readOnly)
        cbxUsefrequency.setModel(
            self.mapper.model().getLookupModel('usefrequencyLUT'))

        cbxActors = QtGui.QComboBox(self, enabled=not readOnly, editable=True)
        cbxActors.setModel(self.mapper.model().getHistoryModel('actors_view'))
        cbxStakeholders = QtGui.QComboBox(self,
                                          enabled=not readOnly,
                                          editable=True)
        cbxStakeholders.setModel(
            self.mapper.model().getHistoryModel('stakeholders_view'))

        tedPrerequisites.setImageProvider(nafdb.getImageForId)
        tedMainscenario.setImageProvider(nafdb.getImageForId)
        tedAltscenario.setImageProvider(nafdb.getImageForId)
        tedNotes.setImageProvider(nafdb.getImageForId)

        layout.addWidget(ledId, 0, 1, 1, 3)
        layout.addWidget(ledTitle, 1, 1, 1, 3)
        layout.addWidget(cbxKeywords, 2, 1, 1, 3)
        layout.addWidget(cbxPriority, 3, 1, 1, 1)
        layout.addWidget(cbxUsefrequency, 3, 3, 1, 1)
        layout.addWidget(cbxActors, 4, 1, 1, 3)
        layout.addWidget(cbxStakeholders, 5, 1, 1, 3)
        layout.addWidget(tedPrerequisites, 6, 1, 1, 3)
        layout.addWidget(tedMainscenario, 7, 1, 1, 3)
        layout.addWidget(tedAltscenario, 8, 1, 1, 3)
        layout.addWidget(tedNotes, 9, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setColumnStretch(3, 1)
        layout.setRowStretch(6, 1)
        layout.setRowStretch(7, 3)
        layout.setRowStretch(8, 2)
        layout.setRowStretch(9, 1)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(cbxPriority, columns.index('priority'))
        self.mapper.addMapping(cbxUsefrequency, columns.index('usefrequency'))
        self.mapper.addMapping(cbxActors, columns.index('actors'))
        self.mapper.addMapping(cbxStakeholders, columns.index('stakeholders'))
        self.mapper.addMapping(tedPrerequisites,
                               columns.index('prerequisites'))
        self.mapper.addMapping(tedMainscenario, columns.index('mainscenario'))
        self.mapper.addMapping(tedAltscenario, columns.index('altscenario'))
        self.mapper.addMapping(tedNotes, columns.index('notes'))
Пример #17
0
    def __init__(self, parent, readOnly=True):
        super(cTestcaseDetailsView, self).__init__(parent)
        self.mapper = QtGui.QDataWidgetMapper()
        self.mapper.setItemDelegate(_naf_itemmodel.cItemDelegate(self))
        self.mapper.setModel(cTestcaseModel())
        self.mapper.setSubmitPolicy(QtGui.QDataWidgetMapper.ManualSubmit)

        columns = self.mapper.model().getColumns()
        lbl = self.mapper.model().getLabel
        layout = QtGui.QGridLayout()
        self.setLayout(layout)
        layout.addWidget(QtGui.QLabel(lbl("id")), 0, 0)
        layout.addWidget(QtGui.QLabel(lbl("title")), 1, 0)
        layout.addWidget(QtGui.QLabel(lbl("keywords")), 2, 0)
        layout.addWidget(QtGui.QLabel(lbl("priority")), 2, 2)

        lblPurpose = self.makeEditLinkLabel("purpose", readOnly)
        lblPurpose.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblPurpose, 3, 0)

        lblPrerequisite = self.makeEditLinkLabel("prerequisite", readOnly)
        lblPrerequisite.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblPrerequisite, 4, 0)

        lblTestdata = self.makeEditLinkLabel("testdata", readOnly)
        lblTestdata.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblTestdata, 5, 0)

        lblSteps = self.makeEditLinkLabel("steps", readOnly)
        lblSteps.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblSteps, 6, 0)

        lblNotes = self.makeEditLinkLabel("notes", readOnly)
        lblNotes.linkActivated.connect(self.sendEditSignal)
        layout.addWidget(lblNotes, 7, 0)

        layout.addWidget(QtGui.QLabel(lbl("scripturl")), 8, 0)

        ledId = QtGui.QSpinBox(self, maximum=sys.maxint)
        ledId.setReadOnly(True)  # id is always read only
        ledTitle = QtGui.QLineEdit(self, readOnly=readOnly)
        cbxKeywords = QtGui.QComboBox(self,
                                      enabled=not readOnly,
                                      editable=True)
        cbxKeywords.setModel(
            self.mapper.model().getHistoryModel('keywords_view'))
        tedPurpose = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedPurpose.setImageProvider(nafdb.getImageForId)
        tedPrerequisite = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedPrerequisite.setImageProvider(nafdb.getImageForId)
        tedTestdata = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedTestdata.setImageProvider(nafdb.getImageForId)
        tedSteps = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedSteps.setImageProvider(nafdb.getImageForId)
        tedNotes = _naf_textviewer.cTextEditor(self, readOnly=readOnly)
        tedNotes.setImageProvider(nafdb.getImageForId)
        ledScripturl = QtGui.QLineEdit(self, readOnly=readOnly)
        cbxPriority = QtGui.QComboBox(self, enabled=not readOnly)
        cbxPriority.setModel(self.mapper.model().getLookupModel('priorityLUT'))

        # addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan, alignment)
        layout.addWidget(ledId, 0, 1, 1, 3)
        layout.addWidget(ledTitle, 1, 1, 1, 3)
        layout.addWidget(cbxPriority, 2, 3, 1, 1)
        layout.addWidget(cbxKeywords, 2, 1, 1, 1)
        layout.addWidget(tedPurpose, 3, 1, 1, 3)
        layout.addWidget(tedPrerequisite, 4, 1, 1, 3)
        layout.addWidget(tedTestdata, 5, 1, 1, 3)
        layout.addWidget(tedSteps, 6, 1, 1, 3)
        layout.addWidget(tedNotes, 7, 1, 1, 3)
        layout.addWidget(ledScripturl, 8, 1, 1, 3)

        layout.setColumnStretch(1, 1)
        layout.setRowStretch(3, 2)
        layout.setRowStretch(4, 2)
        layout.setRowStretch(5, 2)
        layout.setRowStretch(6, 5)
        layout.setRowStretch(7, 2)

        self.mapper.addMapping(ledId, columns.index('id'))
        self.mapper.addMapping(ledTitle, columns.index('title'))
        self.mapper.addMapping(cbxKeywords, columns.index('keywords'))
        self.mapper.addMapping(tedPurpose, columns.index('purpose'))
        self.mapper.addMapping(tedPrerequisite, columns.index('prerequisite'))
        self.mapper.addMapping(tedTestdata, columns.index('testdata'))
        self.mapper.addMapping(tedSteps, columns.index('steps'))
        self.mapper.addMapping(tedNotes, columns.index('notes'))
        self.mapper.addMapping(ledScripturl, columns.index('scripturl'))
        self.mapper.addMapping(cbxPriority, columns.index('priority'))