예제 #1
0
    def createPlotHeader(self, track, wellPlotData):
        logger.debug(">>createPlotHeader() ")
        assert track != None
        assert wellPlotData != None

        logTrackData = track.data(Qt.UserRole)
        titleFrame = QFrame()
        vLayout = QVBoxLayout()
        vbox = QWidget()

        label_bg_rgb = self.wellPlotData.label_background_rgb
        label_bg_alpha = self.wellPlotData.label_background_alpha
        label_fg_rgb = self.wellPlotData.label_foreground_rgb
        label_fg_alpha = self.wellPlotData.label_foreground_alpha
        (fr, fg, fb,
         falpha) = ImageUtils.rbgaTointValues(label_fg_rgb, label_fg_alpha)
        (br, bg, bb,
         balpha) = ImageUtils.rbgaTointValues(label_bg_rgb, label_bg_alpha)

        #in case logs=0, as we reference .geometry()
        headerWidget = QWidget()
        if len(logTrackData.getLogs()) > 0:
            layout = QVBoxLayout()
            for log in logTrackData.getLogs():
                headerWidget = LogHeaderLabel(log, track, wellPlotData)
                layout.addWidget(headerWidget)
            topSpacer = QtGui.QWidget()
            topSpacer.setSizePolicy(QtGui.QSizePolicy.Minimum,
                                    QtGui.QSizePolicy.Expanding)
            layout.addWidget(topSpacer)
            vbox.setLayout(layout)

        vLayout.addWidget(vbox)
        titleFrame.setLayout(vLayout)
        titleFrame.setFrameStyle(QtGui.QFrame.StyledPanel
                                 | QtGui.QFrame.Raised)
        trackGeom = track.geometry()
        titleFrame.setMinimumWidth(trackGeom.width())
        titleFrame.setGeometry(trackGeom.x(), trackGeom.y(), trackGeom.width(),
                               headerWidget.geometry().height())
        logger.debug(
            "--createPlotHeader() trackGeom.width(): {0} headerWidget.geometry().height(): {1}"
            .format(trackGeom.width(),
                    headerWidget.geometry().height()))
        logger.debug(
            "--createPlotHeader() titleFrame.width(): {0} titleFrame.geometry().height(): {1}"
            .format(titleFrame.width(),
                    titleFrame.geometry().height()))
        return titleFrame
예제 #2
0
    def paintEvent(self, event):
        MARGIN_PIXELS = 4

        painter = QPainter()
        (r, g, b, alpha) = ImageUtils.rbgaTointValues(self.log.rgb,
                                                      self.log.alpha)

        lineColour = QColor(r, g, b, alpha)

        assert lineColour != None
        assert self.log.line_style != None

        lineStyle = WidgetUtils.getQtPenStyle(self.log.line_style)

        assert lineStyle != None
        assert self.log.line_width != None

        lineWidth = NumberUtils.floatToIntDefault(self.log.line_width, 1)
        pen = QPen(lineColour, lineWidth, lineStyle)

        painter.begin(self)
        painter.setPen(pen)
        labelMargin = self.logName_label.margin()
        yLevel = self.logName_label.rect().bottomLeft().y()
        xStart = labelMargin
        xStop = self.track.geometry().width() - labelMargin
        #line is relative to widget not screen
        painter.drawLine(xStart, yLevel, xStop, yLevel)

        painter.end()
예제 #3
0
    def paintEvent( self, event ) :
        MARGIN_PIXELS = 4
        
        painter = QPainter()
        (r, g, b, alpha) = ImageUtils.rbgaTointValues(self.log.rgb, self.log.alpha)
        
        lineColour = QColor(r, g, b, alpha)
        
        assert lineColour != None 
        assert self.log.line_style != None
        
        lineStyle = WidgetUtils.getQtPenStyle(self.log.line_style)
        
        assert lineStyle != None 
        assert self.log.line_width != None
        
        lineWidth = NumberUtils.floatToIntDefault(self.log.line_width, 1)
        pen = QPen(lineColour, lineWidth, lineStyle)
        
        painter.begin(self)
        painter.setPen(pen)

        yLevel = self.logName_label.rect().bottomLeft().y()
        xStart = self.xpix[0]
        xStop = self.xpix[1]
        
        #horizontal line
        #logger.debug("--paintEvent() r: {0},  g: {1},  b: {2},  a: {3}, name{4}".format(r, g, b, alpha, self.log.name))
        #logger.debug("--paintEvent() xStart: {0},  yLevel: {1},  xStop: {2},  yLevel: {3}".format(xStart, yLevel, xStop, yLevel))
        painter.drawLine( xStart, yLevel, xStop, yLevel )
        
        painter.end()
예제 #4
0
    def createPlotHeader(self, subPlotData, xpix, logPlotData):
        logger.debug(">>createPlotHeader() ")
        vbox = QWidget()
        #logPlotPreferencesLogic = WellPlotPreferencesLogic()
        #logPlotDefaults = logPlotPreferencesLogic.getLogPlotPreferences()
        
        label_bg_rgb = self.logPlotData.label_background_rgb
        label_bg_alpha = self.logPlotData.label_background_alpha
        label_fg_rgb = self.logPlotData.label_foreground_rgb
        label_fg_alpha = self.logPlotData.label_foreground_alpha
        (fr, fg, fb, falpha) = ImageUtils.rbgaTointValues(label_fg_rgb, label_fg_alpha)
        (br, bg, bb, balpha) = ImageUtils.rbgaTointValues(label_bg_rgb, label_bg_alpha)
        '''
        labelProps.label_fg_color = QColor(fr, fg, fb, falpha)
        labelProps.label_bg_color = QColor(br, bg, bb, balpha)
        labelProps.subPlotData = subPlotData
        labelProps.xpix = xpix
        labelProps.expandedLabel = logPlotDefaults.expanded_header_labels
        '''
        if subPlotData != None and len(subPlotData.getLogs())>0:
            layout = QVBoxLayout()
            topSpacer = QtGui.QWidget()
            topSpacer.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
            layout.addWidget(topSpacer)
            for log in subPlotData.getLogs():

                canvasFig = self.mainPlot.figure
                #labelProps.canvas_width, labelProps.canvas_height = canvasFig.canvas.get_width_height()

                headerWidget = LogHeaderLabel(subPlotData, log, xpix, logPlotData)
                layout.addWidget(headerWidget)
        
            vbox.setLayout(layout)
        plot_width = xpix[1] - xpix[0]
        logger.debug("--createPlotHeader() xpix 1: "+str(xpix[1])+" xpix 0: "+str(xpix[0])+" plot_width "+str(plot_width))
        vbox.setFixedWidth(plot_width)
        return vbox