Beispiel #1
0
    def populateCurveTable(self):
        logger.debug(">>populateCurveTable()")
        try:
            self.curveTableWidget.itemChanged.disconnect(self.styleChanged)
        except TypeError as ex:
            logger.debug(str(ex))

        headers = LogPlotConstants.LOG_PLOT_CURVE_STYLE_HEADERS
        numberOfColumns = len(headers)
        self.curveTableWidget.clear()
        self.curveTableWidget.setSortingEnabled(False)
        logCount = 0
        countIds = []
        for plot in self._wellPlotData.getLogTrackDatas():
            for log in plot.getLogs():
                #only want unique curve attributes
                if log.id not in countIds:
                    logCount += 1
                    countIds.append(log.id)
        self.curveTableWidget.setRowCount(logCount)
        self.curveTableWidget.setColumnCount(numberOfColumns)
        self.curveTableWidget.setHorizontalHeaderLabels(headers)
        #only want unique curve attributes
        ids = []
        for i, plot in enumerate(self._wellPlotData.getLogTrackDatas()):
            j = 0
            for log in plot.getLogs():
                if log.id not in ids:
                    #add one so starts at 1 not zero?
                    nameLineEdit = QtGui.QLineEdit(log.name)
                    typeLineEdit = QtGui.QLineEdit(log.log_type_name)
                    logType = LogType.getLogType(log.log_type_name)
                    unit = logType.getUnit()
                    unitsLineEdit = QtGui.QLineEdit(unit.getName())
                    trackLineEdit = QtGui.QLineEdit(str(plot.plot_index))
                    leftScaleLineEdit = QtGui.QLineEdit(str(log.log_plot_left))
                    rightScaleLineEdit = QtGui.QLineEdit(
                        str(log.log_plot_right))

                    logarithmicCheckBox = QtGui.QTableWidgetItem()
                    logarithmicCheckBox.setFlags(QtCore.Qt.ItemIsUserCheckable
                                                 | QtCore.Qt.ItemIsEnabled)
                    logarithmicCheckBox.setCheckState(log.is_logarithmic)
                    logarithmicCheckBox.setData(Qt.UserRole, str(log.id))

                    buttonQColor = ImageUtils.rbgToQColor(log.rgb)
                    #logger.debug("--populateCurveTable() "+log.rgb+" converted rgb: "+str(buttonQColor.getRgb()))
                    qColorButton = QColorButton()
                    qColorButton.setColor(buttonQColor)
                    qColorButton.setData(Qt.UserRole, str(log.id))

                    opacityLineEdit = QtGui.QLineEdit(log.alpha)
                    widthLineEdit = QtGui.QLineEdit(str(log.line_width))
                    styleLineEdit = QtGui.QLineEdit(log.line_style)
                    pointSizeLineEdit = QtGui.QLineEdit(str(log.point_size))
                    pointStyleLineEdit = QtGui.QLineEdit(log.point_style)
                    pointsOn = QtGui.QTableWidgetItem()
                    pointsOn.setFlags(QtCore.Qt.ItemIsUserCheckable
                                      | QtCore.Qt.ItemIsEnabled)
                    pointsOn.setCheckState(log.log_plot_points_on)
                    pointsOn.setData(Qt.UserRole, str(log.id))

                    twItem0 = QtGui.QTableWidgetItem(nameLineEdit.text())
                    twItem0.setData(Qt.UserRole, str(log.id))
                    twItem1 = QtGui.QTableWidgetItem(typeLineEdit.text())
                    twItem1.setData(Qt.UserRole, str(log.id))
                    twItem2 = QtGui.QTableWidgetItem(unitsLineEdit.text())
                    twItem2.setData(Qt.UserRole, str(log.id))
                    twItem3 = QtGui.QTableWidgetItem(trackLineEdit.text())
                    twItem3.setData(Qt.UserRole, str(log.id))
                    twItem4 = QtGui.QTableWidgetItem(leftScaleLineEdit.text())
                    twItem4.setData(Qt.UserRole, str(log.id))
                    twItem5 = QtGui.QTableWidgetItem(rightScaleLineEdit.text())
                    twItem5.setData(Qt.UserRole, str(log.id))

                    twItem8 = QtGui.QTableWidgetItem(opacityLineEdit.text())
                    twItem8.setData(Qt.UserRole, str(log.id))
                    twItem9 = QtGui.QTableWidgetItem(widthLineEdit.text())
                    twItem9.setData(Qt.UserRole, str(log.id))
                    twItem10 = QtGui.QTableWidgetItem(styleLineEdit.text())
                    twItem10.setData(Qt.UserRole, str(log.id))
                    twItem11 = QtGui.QTableWidgetItem(pointSizeLineEdit.text())
                    twItem11.setData(Qt.UserRole, str(log.id))
                    twItem12 = QtGui.QTableWidgetItem(
                        pointStyleLineEdit.text())
                    twItem12.setData(Qt.UserRole, str(log.id))

                    #row, column
                    self.curveTableWidget.setItem(j + i, 0, twItem0)
                    self.curveTableWidget.setItem(j + i, 1, twItem1)
                    self.curveTableWidget.setItem(j + i, 2, twItem2)
                    self.curveTableWidget.setItem(j + i, 3, twItem3)
                    self.curveTableWidget.setItem(j + i, 4, twItem4)
                    self.curveTableWidget.setItem(j + i, 5, twItem5)
                    self.curveTableWidget.setItem(j + i, 6,
                                                  logarithmicCheckBox)
                    self.curveTableWidget.setCellWidget(j + i, 7, qColorButton)
                    self.curveTableWidget.setItem(j + i, 8, twItem8)
                    self.curveTableWidget.setItem(j + i, 9, twItem9)
                    self.curveTableWidget.setItem(j + i, 10, twItem10)
                    self.curveTableWidget.setItem(j + i, 11, twItem11)
                    self.curveTableWidget.setItem(j + i, 12, twItem12)
                    self.curveTableWidget.setItem(j + i, 13, pointsOn)

                    #logger.debug("--populateCurveTable() j: "+str(j)+" i: "+str(i))
                    ids.append(log.id)
                    j += 1
        self.curveTableWidget.itemChanged.connect(self.curveStyleChanged)
Beispiel #2
0
    def populatePlotTab(self):
        logger.debug(">>populatePlotTab()")

        titleOnCheckState = WidgetUtils.getQtCheckObject(
            self._wellPlotData.title_on)
        self.plotTitleOnCheckBox.setCheckState(titleOnCheckState)
        self.plotTitleOnCheckBox.stateChanged.connect(self.styleChanged)
        self.plotTitleLineEdit.setText(self._wellPlotData.title)
        self.plotTitleLineEdit.textChanged.connect(self.styleChanged)
        self.plotPrintDPILineEdit.setText(str(self._wellPlotData.dpi))
        self.plotPrintDPILineEdit.textChanged.connect(self.styleChanged)
        intValidator = QtGui.QIntValidator()
        self.plotPrintDPILineEdit.setValidator(intValidator)
        #not enabled for this version
        self.plotTitleOnCheckBox.setEnabled(False)
        self.plotTitleLineEdit.setEnabled(False)
        self.plotPrintDPILineEdit.setEnabled(False)

        trackBackButtonQColor = ImageUtils.rbgToQColor(
            self._wellPlotData.plot_background_rgb)
        trackBackColorButton = QColorButton()
        trackBackColorButton.setColor(trackBackColorButton)
        self.trackBackgroundColorPushButton = trackBackColorButton
        self.trackBackgroundColorPushButton.clicked.connect(self.styleChanged)
        plotBackgroundAlpha = NumberUtils.stringToInt(
            self._wellPlotData.plot_background_alpha)
        self.trackBackgroundOpacitySpinBox.setValue(plotBackgroundAlpha)
        self.trackBackgroundOpacitySpinBox.valueChanged.connect(
            self.styleChanged)

        gridOnCheckState = WidgetUtils.getQtCheckObject(
            self._wellPlotData.grid_on)
        self.gridOnCheckBox.setCheckState(gridOnCheckState)
        self.gridOnCheckBox.stateChanged.connect(self.styleChanged)

        buttonQColor = ImageUtils.rbgToQColor(self._wellPlotData.grid_rgb)
        qColorButton = QColorButton()
        qColorButton.setColor(buttonQColor)
        self.gridColorPushButton = qColorButton
        self.gridColorPushButton.clicked.connect(self.styleChanged)

        gridAlpha = NumberUtils.stringToInt(self._wellPlotData.grid_alpha)
        self.gridOpacitySpinBox.setValue(gridAlpha)
        self.gridOpacitySpinBox.valueChanged.connect(self.styleChanged)

        index = self.gridStyleComboBox.findText(
            self._wellPlotData.grid_line_style, QtCore.Qt.MatchFixedString)
        if index >= 0:
            self.gridStyleComboBox.setCurrentIndex(index)
        self.gridStyleComboBox.currentIndexChanged.connect(self.styleChanged)

        self.gridVerticalDivSpinBox.setValue(
            self._wellPlotData.grid_vertical_divisions)
        self.gridVerticalDivSpinBox.valueChanged.connect(self.styleChanged)

        expandedCheckState = WidgetUtils.getQtCheckObject(
            self._wellPlotData.single_row_header_labels)
        self.labelsExpandedCheckBox.setCheckState(expandedCheckState)
        self.labelsExpandedCheckBox.stateChanged.connect(self.styleChanged)

        labelBackButtonQColor = ImageUtils.rbgToQColor(
            self._wellPlotData.label_background_rgb)
        labelBackColorButton = QColorButton()
        labelBackColorButton.setColor(labelBackButtonQColor)
        self.labelBackgroundColorPushButton = labelBackColorButton
        self.labelBackgroundColorPushButton.clicked.connect(self.styleChanged)

        labelBackgroundAlpha = NumberUtils.stringToInt(
            self._wellPlotData.label_background_alpha)
        self.labelBackgroundOpacitySpinBox.setValue(labelBackgroundAlpha)
        self.labelBackgroundOpacitySpinBox.valueChanged.connect(
            self.styleChanged)

        labelForegroundRGB = NumberUtils.stringToInt(
            self._wellPlotData.label_foreground_rgb)
        labelForeButtonQColor = ImageUtils.rbgToQColor(labelForegroundRGB)
        labelForeColorButton = QColorButton()
        labelForeColorButton.setColor(labelForeButtonQColor)
        self.labelForegroundColorPushButton = labelForeColorButton
        self.labelForegroundColorPushButton.clicked.connect(self.styleChanged)

        labelForegroundAlpha = NumberUtils.stringToInt(
            self._wellPlotData.label_foreground_alpha)
        self.labelForegroundOpacitySpinBox.setValue(labelForegroundAlpha)
        self.labelForegroundOpacitySpinBox.valueChanged.connect(
            self.styleChanged)