Python PySide.QtGui 模块,QPen() 实例源码

我们从Python开源项目中,提取了以下27个代码示例,用于说明如何使用PySide.QtGui.QPen()

项目:rfcat-firsttry    作者:atlas0fd00m    | 项目源码 | 文件源码
def paintEvent(self, event):
        self._draw_graph()
        self._draw_reticle()

        painter = QtGui.QPainter(self)
        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            painter.setPen(QtGui.QPen())
            painter.setBrush(QtGui.QBrush())

            if self._graph:
                painter.drawPixmap(0, 0, self._graph)

            if self._path_max:
                painter.setPen(Qt.green)
                painter.drawPath(self._path_max)

            painter.setOpacity(0.5)
            if self._reticle:
                painter.drawPixmap(0, 0, self._reticle)
        finally:
            painter.end()
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, widget):
        if not self.source() or not self.dest():
            return

        # Draw the line itself.
        line = QtCore.QLineF(self.sourcePoint, self.destPoint)

        if not(self.ColorEdgesFlag):
            return
        if line.length() == 0.0:
            return


        painter.setPen(QtGui.QPen(QtCore.Qt.black, 1, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
        painter.drawLine(line)

        painter.setBrush(QtCore.Qt.black)
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, index):
            painter.fillRect(option.rect, index.data(QtCore.Qt.BackgroundRole))
            super(NewWindowCorrelationTableDisplay.BackgroundDelegate, self).paint(painter, option, index)

            if option.state & QtGui.QStyle.State_Selected:
                painter.save()
                # Changed to Green
                pen = QtGui.QPen(QtCore.Qt.darkGreen, 2, QtCore.Qt.SolidLine, QtCore.Qt.SquareCap, QtCore.Qt.MiterJoin)
                myrect = option.rect.adjusted(0, 1, 0, 0)
                painter.setPen(pen)
                painter.setPen(pen)
                painter.drawLine(myrect.topLeft(), myrect.topRight())
                painter.drawLine(option.rect.bottomRight() , option.rect.bottomLeft())
                painter.drawLine(myrect.topLeft(), myrect.bottomLeft())
                painter.drawLine(option.rect.topRight() + QtCore.QPoint(0, 2), option.rect.bottomRight()+ QtCore.QPoint(0, -2))
                painter.restore()
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, index):
            painter.fillRect(option.rect, index.data(QtCore.Qt.BackgroundRole))
            super(CorrelationTableDisplay.BackgroundDelegate, self).paint(painter, option, index)
            if option.state & QtGui.QStyle.State_Selected:
                painter.save()
                # Pointer to green
                pen = QtGui.QPen(QtCore.Qt.darkGreen, 2, QtCore.Qt.SolidLine, QtCore.Qt.SquareCap, QtCore.Qt.MiterJoin)
                myrect = option.rect.adjusted(0, 1, 0, 0)
                painter.setPen(pen)
                painter.drawLine(myrect.topLeft(), myrect.topRight())
                painter.drawLine(myrect.bottomLeft(), myrect.bottomRight())
                if index.column() == 0:
                    painter.drawLine(myrect.topLeft(), myrect.bottomLeft())
                if index.column() == index.model().columnCount()-1:
                    painter.drawLine(option.rect.topRight() + QtCore.QPoint(0, -1), option.rect.bottomRight()+ QtCore.QPoint(0, -1))
                painter.restore()
项目:smhr    作者:andycasey    | 项目源码 | 文件源码
def paint(self, painter, option, index):
        painter.save()

        painter.setPen(QtGui.QPen(QtCore.Qt.NoPen))
        if option.state & QtGui.QStyle.State_Selected:
            painter.setBrush(QtGui.QBrush(
                self.parent().palette().highlight().color()))
        else:
            painter.setBrush(QtGui.QBrush(QtCore.Qt.white))

        painter.drawRect(option.rect)

        painter.setPen(QtGui.QPen(QtCore.Qt.black))
        painter.drawText(option.rect, QtCore.Qt.AlignLeft|QtCore.Qt.AlignCenter,
            index.data())
        painter.restore()
项目:HearthPacks    作者:Arzaroth    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QPainter()
        painter.begin(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.fillRect(event.rect(), QBrush(QColor(127, 127, 127, 127)))
        painter.setPen(QPen(Qt.NoPen))

        for i in range(6):
            if int(self.counter / 10) % 6 == i:
                factor = self.counter % 10
                if factor >= 5:
                    factor = 5 - (self.counter % 5)
                painter.setBrush(QBrush(QColor(95 + factor * 32, 127, 127)))
            else:
                painter.setBrush(QBrush(QColor(127, 127, 127)))
            painter.drawEllipse(
                self.width() / 2 + 30 * math.cos(2 * math.pi * i / 6.0) - 10,
                self.height() / 2 + 30 * math.sin(2 * math.pi * i / 6.0) - 10,
                20, 20)

        painter.end()
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, widget):
        painter.setPen(QtCore.Qt.NoPen)

        if self.graphWidget.VisualizationTheme == "ObjectFlow": 
            self.drawSubClusters(painter, self.radius)
            painter.setBrush(self.CommunityColor)
            painter.setPen(QtGui.QPen(QtCore.Qt.black, 0))
            if (option.state & QtGui.QStyle.State_Selected):
                circle_path = QtGui.QPainterPath()
                painter.setPen(QtGui.QPen(QtCore.Qt.blue, 3))        
                circle_path.addEllipse(QtCore.QPointF(0,0),self.radius+2,self.radius+2);
                painter.drawPath(circle_path)
            else:
                painter.drawEllipse(-4, -4, self.radius, self.radius)

        elif self.graphWidget.VisualizationTheme == "ThemeRiver":
            self.drawSubClustersTheme(painter,option, self.radius)

        # Drawing the CirclePath Should denote a value
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def drawSubClusters(self, painter, radius):

        # Extrapolate the graph metrics and rank
        Clusters = len(self.correspondingNodes) 
        step = float(math.pi/Clusters) 
        Radius = self.radius
        angle = 0.0 
        c = 0

        for i in self.correspondingNodes:
            painter.setBrush(QtCore.Qt.blue)
            painter.setPen(QtGui.QPen(QtCore.Qt.black, 0))  

            x = Radius * math.sin((2*c*math.pi)/Clusters)
            y = Radius * math.cos((2*c*math.pi)/Clusters)

            c = c + 1
            # radius = float(self.graphWidget.widget.Centrality[i]*100)
            radius = 10 
            # print radiuss
            painter.drawEllipse(x,y,radius, radius)
            angle = angle + step
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, widget):
        painter.setPen(QtCore.Qt.NoPen)

        if self.graphWidget.VisualizationTheme == "ObjectFlow": 
            self.drawSubClusters(painter, self.radius)
            painter.setBrush(self.CommunityColor)
            painter.setPen(QtGui.QPen(QtCore.Qt.black, 0))
            if (option.state & QtGui.QStyle.State_Selected):
                circle_path = QtGui.QPainterPath()
                painter.setPen(QtGui.QPen(QtCore.Qt.blue, 3))        
                circle_path.addEllipse(QtCore.QPointF(0,0),self.radius+2,self.radius+2);
                painter.drawPath(circle_path)
            else:
                painter.drawEllipse(-4, -4, self.radius, self.radius)

        elif self.graphWidget.VisualizationTheme == "ThemeRiver":
            self.drawSubClustersTheme(painter,option, self.radius)

        # Drawing the CirclePath Should denote a value
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, index):
            painter.fillRect(option.rect, index.data(QtCore.Qt.BackgroundRole))
            super(NewWindowCorrelationTableDisplay.BackgroundDelegate, self).paint(painter, option, index)

            if option.state & QtGui.QStyle.State_Selected:
                painter.save()
                # Changed to Green
                pen = QtGui.QPen(QtCore.Qt.darkGreen, 2, QtCore.Qt.SolidLine, QtCore.Qt.SquareCap, QtCore.Qt.MiterJoin)
                myrect = option.rect.adjusted(0, 1, 0, 0)
                painter.setPen(pen)
                painter.setPen(pen)
                painter.drawLine(myrect.topLeft(), myrect.topRight())
                painter.drawLine(option.rect.bottomRight() , option.rect.bottomLeft())
                painter.drawLine(myrect.topLeft(), myrect.bottomLeft())
                painter.drawLine(option.rect.topRight() + QtCore.QPoint(0, 2), option.rect.bottomRight()+ QtCore.QPoint(0, -2))
                painter.restore()
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, index):
            painter.fillRect(option.rect, index.data(QtCore.Qt.BackgroundRole))
            super(CorrelationTableDisplay.BackgroundDelegate, self).paint(painter, option, index)
            if option.state & QtGui.QStyle.State_Selected:
                painter.save()
                # Pointer to green
                pen = QtGui.QPen(QtCore.Qt.darkGreen, 2, QtCore.Qt.SolidLine, QtCore.Qt.SquareCap, QtCore.Qt.MiterJoin)
                myrect = option.rect.adjusted(0, 1, 0, 0)
                painter.setPen(pen)
                painter.drawLine(myrect.topLeft(), myrect.topRight())
                painter.drawLine(myrect.bottomLeft(), myrect.bottomRight())
                if index.column() == 0:
                    painter.drawLine(myrect.topLeft(), myrect.bottomLeft())
                if index.column() == index.model().columnCount()-1:
                    painter.drawLine(option.rect.topRight() + QtCore.QPoint(0, -1), option.rect.bottomRight()+ QtCore.QPoint(0, -1))
                painter.restore()
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, index):
            painter.fillRect(option.rect, index.data(QtCore.Qt.BackgroundRole))
            super(CommunityCorrelationTableDisplay.BackgroundDelegate, self).paint(painter, option, index)
            if option.state & QtGui.QStyle.State_Selected:
                painter.save()
                # pointer to gree
                pen = QtGui.QPen(QtCore.Qt.darkGreen, 2, QtCore.Qt.SolidLine, QtCore.Qt.SquareCap, QtCore.Qt.MiterJoin)
                myrect = option.rect.adjusted(0, 1, 0, 0)
                painter.setPen(pen)
                painter.drawLine(myrect.topLeft(), myrect.topRight())
                painter.drawLine(myrect.bottomLeft(), myrect.bottomRight())
                if index.column() == 0:
                    painter.drawLine(myrect.topLeft(), myrect.bottomLeft())
                if index.column() == index.model().columnCount()-1:
                    painter.drawLine(option.rect.topRight() + QtCore.QPoint(0, -1), option.rect.bottomRight()+ QtCore.QPoint(0, -1))
                painter.restore()
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def drawBarChart(self, painter, Highlight): 
        radiusOld = 10

        width = float(radiusOld*2/self.slices)
        assert self.slices == len(self.ColorQ)
        setWidth = 0 
        j = -1 
        for i in range(self.slices): 
            if not(self.Highlight):
                painter.setPen(QtGui.QPen(QtCore.Qt.black, 0.1)) 
            else: 
                painter.setPen(QtGui.QPen(QtCore.Qt.blue, 1))  

            painter.setBrush(self.ColorQ[j])
            radius = (float(self.AlphaValue[j]/255)*20)
            rectangle = QtCore.QRectF(10-setWidth, 10, width, -radius);
            painter.drawRect(rectangle)
            setWidth += width 
            j = j-1
项目:rfcat    作者:EnhancedRadioDevices    | 项目源码 | 文件源码
def paintEvent(self, event):
        self._draw_graph()
        self._draw_reticle()

        painter = QtGui.QPainter(self)
        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            painter.setPen(QtGui.QPen())
            painter.setBrush(QtGui.QBrush())

            if self._graph:
                painter.drawPixmap(0, 0, self._graph)

            if self._path_max:
                painter.setPen(Qt.green)
                painter.drawPath(self._path_max)

            painter.setOpacity(0.5)
            if self._reticle:
                painter.drawPixmap(0, 0, self._reticle)
        finally:
            painter.end()
项目:rfcat    作者:atlas0fd00m    | 项目源码 | 文件源码
def paintEvent(self, event):
        self._draw_graph()
        self._draw_reticle()

        painter = QtGui.QPainter(self)
        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            painter.setPen(QtGui.QPen())
            painter.setBrush(QtGui.QBrush())

            if self._graph:
                painter.drawPixmap(0, 0, self._graph)

            if self._path_max:
                painter.setPen(Qt.green)
                painter.drawPath(self._path_max)

            painter.setOpacity(0.5)
            if self._reticle:
                painter.drawPixmap(0, 0, self._reticle)
        finally:
            painter.end()
项目:PandwaRF    作者:ComThings    | 项目源码 | 文件源码
def paintEvent(self, event):
        self._draw_graph()
        self._draw_reticle()

        painter = QtGui.QPainter(self)
        try:
            painter.setRenderHint(QtGui.QPainter.Antialiasing)
            painter.setPen(QtGui.QPen())
            painter.setBrush(QtGui.QBrush())

            if self._graph:
                painter.drawPixmap(0, 0, self._graph)

            if self._path_max:
                painter.setPen(Qt.green)
                painter.drawPath(self._path_max)

            painter.setOpacity(0.5)
            if self._reticle:
                painter.drawPixmap(0, 0, self._reticle)
        finally:
            painter.end()
项目:KicadSolderTool    作者:pioupus    | 项目源码 | 文件源码
def set_marker(self,point, bot):
        scene_point = point
        if self.marker_set:
            self.scene.removeItem(self.marker_ellipse)
            self.scene.removeItem(self.marker_line_h)
            self.scene.removeItem(self.marker_line_v)

        color = QtGui.QColor()
        if bot:
            color = QtGui.QColor(QtCore.Qt.red)
        else:
            color = QtGui.QColor(QtCore.Qt.darkGreen)
        color.setAlpha(100)
        pen = QtGui.QPen()
        pen.setWidth(2)
        pen.setColor(color)
        self.marker_ellipse = self.scene.addEllipse(scene_point.x()-10,scene_point.y()-10,20,20,pen);
        self.marker_line_h = self.scene.addLine(scene_point.x()-10,scene_point.y(),scene_point.x()+10,scene_point.y(),pen);
        self.marker_line_v = self.scene.addLine(scene_point.x(),scene_point.y()-10,scene_point.x(),scene_point.y()+10,pen);
        self.marker_set = True
        if bot:
            self.svg_item_bot.setVisible(True)
            self.svg_item_top.setVisible(False)
            if not self.is_flipped:
                self.scale(-1,1)
                self.is_flipped = True
        else:
            self.svg_item_bot.setVisible(False)
            self.svg_item_top.setVisible(True)
            if self.is_flipped:
                self.scale(-1,1)   
                self.is_flipped = False
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, widget):
        painter.setPen(QtCore.Qt.NoPen)
        painter.setBrush(self.CommunityColor)
        painter.setPen(QtGui.QPen(QtCore.Qt.black, 0))
        painter.drawEllipse(-4, -4, 10, 10)
项目:smhr    作者:andycasey    | 项目源码 | 文件源码
def paint(self, painter, option, index):
        if index.column() > 2:
            super(SpectralModelsTableDelegate, self).paint(painter, option, index)
            return None

        painter.save()

        # set background color
        painter.setPen(QtGui.QPen(QtCore.Qt.NoPen))
        if option.state & QtGui.QStyle.State_Selected:
            painter.setBrush(QtGui.QBrush(
                self.parent().palette().highlight().color()))
        else:

            # Does this row have a conflict?
            conflicts = self.session._spectral_model_conflicts
            conflict_indices = np.hstack([sum([], conflicts)])

            row = index.row()
            if row in conflict_indices:
                for i, conflict in enumerate(conflicts):
                    if row in conflict:
                        color = _COLORS[i % len(_COLORS)]
                        break

                painter.setBrush(QtGui.QBrush(QtGui.QColor(color)))
            else:
                painter.setBrush(QtGui.QBrush(QtCore.Qt.white))

        painter.drawRect(option.rect)

        # set text color
        painter.setPen(QtGui.QPen(QtCore.Qt.black))
        painter.drawText(option.rect, QtCore.Qt.AlignLeft|QtCore.Qt.AlignCenter, index.data())
        painter.restore()
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def drawSubClustersTheme(self, painter,option, Radius):
        Clusters = len(self.correspondingNodes) 
        step = float(math.pi/Clusters) 
        Radius = self.radius
        angle = 0.0 
        c = 0

        for i in self.correspondingNodes:
            painter.setBrush(self.CommunityColor)
            painter.setPen(QtGui.QPen(QtCore.Qt.black, 0))  

            # radius = float(self.graphWidget.widget.communityDetectionEngine.Centrality[i]*100)
            radius = self.X_Size*10
            Thickness = float(radius) * 2

            if (option.state & QtGui.QStyle.State_Selected):
                painter.drawRect(-12, -12, 25, Thickness)
            else: 
                painter.drawRect(-12, -12, 20, Thickness)

            # x = Radius * math.sin((2*c*math.pi)/Clusters)
            # y = Radius * math.cos((2*c*math.pi)/Clusters)
            # c = c + 1
            # # print radiuss
            # painter.drawEllipse(x,y,radius, radius)
            # angle = angle + step
        # Drawing the CirclePath Should denote a value
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def drawSubClustersTheme(self, painter,option, Radius):
        Clusters = len(self.correspondingNodes) 
        step = float(math.pi/Clusters) 
        Radius = self.radius
        angle = 0.0 
        c = 0

        for i in self.correspondingNodes:
            painter.setBrush(self.CommunityColor)
            painter.setPen(QtGui.QPen(QtCore.Qt.black, 0))  

            # radius = float(self.graphWidget.widget.Centrality[i]*100)
            radius = 10
            Thickness = float(radius) * 2

            if (option.state & QtGui.QStyle.State_Selected):
                painter.drawRect(-12, -12, 25, Thickness)
            else: 
                painter.drawRect(-12, -12, 20, Thickness)

            # x = Radius * math.sin((2*c*math.pi)/Clusters)
            # y = Radius * math.cos((2*c*math.pi)/Clusters)
            # c = c + 1
            # # print radiuss
            # painter.drawEllipse(x,y,radius, radius)
            # angle = angle + step
        # Drawing the CirclePath Should denote a value
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def drawOnePie(self,painter, Opacity=255, radius = 11):
        radius = int(radius)
        self.CommunityColor.setAlpha(Opacity)
        painter.setPen(QtGui.QPen(self.CommunityColor, 0.1))

        painter.setBrush(self.CommunityColor)
        painter.drawEllipse(QtCore.QPointF(0,0),radius, radius)
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def paint(self,painter,option, widget):
        pen = QtGui.QPen()
        pen.setWidth(1)
        brush = QtGui.QBrush()
        brush.setStyle(QtCore.Qt.SolidPattern)
        brush.setColor(QtGui.QColor("white"))

        painter.setBrush(brush)
        painter.drawRect(self.rect)
项目:GeneticAlgorithmLibraryPython    作者:ibarbech    | 项目源码 | 文件源码
def Paint_road(self,Road1,color,size=1):
        pen=QtGui.QPen()
        pen.setColor(color);
        pen.setWidth(size);
        self.__draw_road(Road1,pen)
项目:ebbbe    作者:EarToEarOak    | 项目源码 | 文件源码
def paintEvent(self, event):
        painter = QPainter()
        painter.begin(self)

        colour = self._colour
        if not self._lit:
            colour = self._colour.darker(300)
        painter.setPen(QPen(Qt.black, 1))
        painter.setBrush(QBrush(colour))

        rect = event.rect()
        radius = min(rect.width(), rect.height()) / 3
        painter.drawEllipse(rect.center(), radius, radius)

        painter.end()
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def paint(self, painter, option, widget):
        if not self.source() or not self.dest():
            return

        # Draw the line itself.
        if self.ColorOnlySelectedNodesFlag: 
            if not(self.ColorEdgesFlag):
                return

        line = QtCore.QLineF(self.sourcePoint, self.destPoint)
        # Should FIX the thickness values!!! fix me
        painter.save()
        """
        Painting the edge colors based on various factors
        Not painting the edges if they are below certain threshold 
        Painting the edges to be black or just based on their colors 
        Painting highlighted colormaps 
        edge Thickness is a function of  the weight of the edges 
        drawing z values so that they do not overalpp with others
        """


        if self.ForCommunities:
                painter.setPen(QtGui.QPen(self.communtiyColor1 ,self.communityWeight , QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
                painter.drawLine(line)
        else:
            if self.ColorMap:
                if self.EdgeThreshold < self.weight:
                    if not(self.ColorEdgesFlag):
                        self.setZValue(1)
                        self.EdgeColor.setAlpha(70)
                        painter.setPen(QtGui.QPen(self.EdgeColor ,self.edgeThickness , QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
                        painter.drawLine(line)
                    else: 
                        self.setZValue(2)
                        if not(self.HighlightedColorMap):
                            # pointer to green
                            painter.setPen(QtGui.QPen(QtCore.Qt.darkGreen, self.edgeThickness , QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
                        else:
                            self.EdgeColor.setAlpha(255)
                            painter.setPen(QtGui.QPen(self.EdgeColor, self.thickHighlightedEdges , QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
                        painter.drawLine(line)
            else: 
                if self.EdgeThreshold < self.weight:
                    if not(self.ColorEdgesFlag):
                        self.setZValue(1)
                        painter.setPen(QtGui.QPen(self.EdgeColor ,self.edgeThickness , QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
                        painter.drawLine(line)
                    else: 
                        self.setZValue(2)
                        if not(self.HighlightedColorMap):
                            painter.setPen(QtGui.QPen(QtCore.Qt.darkGreen, self.edgeThickness , QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
                        else:
                            painter.setPen(QtGui.QPen(self.EdgeColor, self.thickHighlightedEdges , QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
                        painter.drawLine(line)
        painter.restore()
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def paint(self,painter,option, widget):   
        blackPen = QtGui.QPen()
        whitePen = QtGui.QPen()
        blackPen.setWidth(1)
        whitePen.setWidth(1)
        blackPen.setColor(QtGui.QColor("black"))
        whitePen.setColor(QtGui.QColor("white"))

        if self.isSelected():
            gradient = QtGui.QLinearGradient(QtCore.QPointF(0, 0), QtCore.QPointF(0, 20))
            gradient.setColorAt(0, QtGui.QColor(220,170,50))
            gradient.setColorAt(0.3, QtGui.QColor(220,170,50))
            gradient.setColorAt(1, QtGui.QColor(170,150,40))
            #brush = QtGui.QBrush(gradient)
            #brush.setStyle(QtCore.Qt.LinearGradientPattern)
            brush = QtGui.QBrush(QtGui.QColor(220,160,50))


        else:
            gradient = QtGui.QLinearGradient(QtCore.QPointF(0, 0), QtCore.QPointF(0, 20))
            gradient.setColorAt(0, QtGui.QColor(55,55,55))
            gradient.setColorAt(0.3, QtGui.QColor(60,60,60))
            gradient.setColorAt(1, QtGui.QColor(50,50,50))
            #brush = QtGui.QBrush(gradient)
            #brush.setStyle(QtCore.Qt.LinearGradientPattern)
            #brush = QtGui.QBrush(QtGui.QColor(50,50,50))
            brush = QtGui.QBrush(QtGui.QColor(32,61,74))



        font = QtGui.QFont()
        font.setFamily("Helvetica")
        font.setStyleStrategy(QtGui.QFont.PreferAntialias)
        font.setPointSize(14)


        painter.setBrush(brush)
        painter.setPen(blackPen)
        painter.setFont(font)

        painter.drawRoundedRect(self.rect,5,5)

        #pen.setColor(QtGui.QColor("white"))
        if self.scale > 0.75:
            painter.setPen(whitePen)
            painter.drawText(self.rect, QtCore.Qt.AlignCenter,self.name())