python类QColor()的实例源码

timeline_widget.py 文件源码 项目:OpenTimelineIO 作者: PixarAnimationStudios 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, track, *args, **kwargs):
        super(TrackWidget, self).__init__(*args, **kwargs)
        self.track = track

        self.setBrush(QtGui.QBrush(QtGui.QColor(43, 52, 59, 255)))
        self._populate()
timeline_widget.py 文件源码 项目:OpenTimelineIO 作者: PixarAnimationStudios 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, marker, *args, **kwargs):
        self.item = marker

        poly = QtGui.QPolygonF()
        poly.append(QtCore.QPointF(0.5 * MARKER_SIZE, -0.5 * MARKER_SIZE))
        poly.append(QtCore.QPointF(0.5 * MARKER_SIZE, 0.5 * MARKER_SIZE))
        poly.append(QtCore.QPointF(0, MARKER_SIZE))
        poly.append(QtCore.QPointF(-0.5 * MARKER_SIZE, 0.5 * MARKER_SIZE))
        poly.append(QtCore.QPointF(-0.5 * MARKER_SIZE, -0.5 * MARKER_SIZE))
        super(Marker, self).__init__(poly, *args, **kwargs)

        self.setFlags(QtGui.QGraphicsItem.ItemIsSelectable)
        self.setBrush(QtGui.QBrush(QtGui.QColor(121, 212, 177, 255)))
timeline_widget.py 文件源码 项目:OpenTimelineIO 作者: PixarAnimationStudios 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def itemChange(self, change, value):
        if change == QtGui.QGraphicsItem.ItemSelectedHasChanged:
            self.setPen(
                QtGui.QColor(0, 255, 0, 255) if self.isSelected()
                else QtGui.QColor(0, 0, 0, 255)
            )
        return super(Marker, self).itemChange(change, value)
timeline_widget.py 文件源码 项目:OpenTimelineIO 作者: PixarAnimationStudios 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super(TimeSlider, self).__init__(*args, **kwargs)
        self.setBrush(QtGui.QBrush(QtGui.QColor(64, 78, 87, 255)))
timeline_widget.py 文件源码 项目:OpenTimelineIO 作者: PixarAnimationStudios 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, composition, *args, **kwargs):
        super(CompositionWidget, self).__init__(*args, **kwargs)
        self.composition = composition

        self.setBackgroundBrush(QtGui.QBrush(QtGui.QColor(64, 78, 87, 255)))

        self._adjust_scene_size()
        self._add_time_slider()
        self._add_tracks()
        self._add_markers()
Edge.py 文件源码 项目:BrainModulyzer 作者: sugeerth 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, graphWidget, sourceNode, destNode, counter, sourceId, destId, MaxValue,weight=100,ForCommunities=False,):
        QtGui.QGraphicsItem.__init__(self)
        self.setAcceptHoverEvents(True)

        self.EdgeThreshold = MaxValue - 0.01
        self.ColorEdgesFlag = False
        self.index = counter
        self.Alpha = 0.2
        self.sourceId = sourceId 
        self.destId = destId
        self.ColorMap = True
        self.ForCommunities= ForCommunities
        self.HighlightedColorMap = False
        self.communityWeight = weight
        self.edgeThickness = 1
        self.thickHighlightedEdges = 3 
        self.ColorOnlySelectedNodesFlag =False
        if math.isnan(weight):
            weight = 1
        self.weight = weight
        if ForCommunities:
            self.communtiyColor = ColorToInt((0,0,0,255))
            self.communtiyColor1 = QtGui.QColor(self.communtiyColor)
            self.setToolTip(str("InterModular Correlation Strength:  "+str(weight)+"\n"+"Source Community:  "+str(sourceId)+"\nDestination Community:  "+str(destId)))
        self.sourcePoint = QtCore.QPointF()
        self.destPoint = QtCore.QPointF()
        self.graph = weakref.ref(graphWidget)
        self.source = weakref.ref(sourceNode)
        self.dest = weakref.ref(destNode)
        self.EdgeColor = QtGui.QColor(self.graph().EdgeColor[self.index])
        self.source().addEdge(self)
Node.py 文件源码 项目:BrainModulyzer 作者: sugeerth 项目源码 文件源码 阅读 47 收藏 0 点赞 0 评论 0
def PutColor(self,colorvalue):
        self.colorvalue = colorvalue
        self.CommunityColor = QtGui.QColor(colorvalue)
        self.NodeCommunityColor = True
Node.py 文件源码 项目:BrainModulyzer 作者: sugeerth 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setOpaqueNodes(self): 
        self.colorTransparency = False
        self.nodeColor = QtGui.QColor(self.graph().DataColor[self.counter])
        if self.NodeCommunityColor:
            self.CommunityColor.setAlpha(255)
        else: 
            self.nodeColor.setAlpha(255)
        self.update()
Node.py 文件源码 项目:BrainModulyzer 作者: sugeerth 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def unsetOpaqueNodes(self): 
        self.colorTransparency = True
        self.nodeColor = QtGui.QColor(self.graph().DataColor[self.counter])
        if not(self.setTransp):
            return

        if self.NodeCommunityColor:
            self.CommunityColor.setAlpha(25)
        else:

            self.nodeColor.setAlpha(25)
        self.update()
dendogram.py 文件源码 项目:BrainModulyzer 作者: sugeerth 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def PutColor(self,colorvalue,alphaValue = -1):
        self.colorvalue = colorvalue
        self.CommunityColor = QtGui.QColor(colorvalue)
        self.NodeCommunityColor = True
        self.update()
correlation_table.py 文件源码 项目:BrainModulyzer 作者: sugeerth 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def ChangeColors(self):
        """
        Clustered Order is the sorted order of different brain regions based on the communities detected   

        """

        """Calling the Parent Method for Sorting the cells"""
        self.sortDataStructure(self.Order,self.Brain_Regions)

        """Sorting the header labels vertical and horizontalHeader"""
        self.setVerticalHeaderLabels(self.ClusteredOrder)
        self.setHorizontalHeaderLabels(['\n'.join(name) for name in self.ClusteredOrder])

        for i in range(len(self.correlationTable.header)):
            for j in range(len(self.correlationTable.header)):

                table_item = self.item(i,j)

                if (self.GraphDataStructure().ThresholdData[self.sortedOrder[i]][self.sortedOrder[j]] != 0) and self.sortedValues[i] == self.sortedValues[j]:
                    table_item.setBackground(QtGui.QColor(*self.colors[self.sortedOrder[i]]))
                else:
                    table_item.setBackground(QtGui.QColor(QtCore.Qt.white))
                table_item.setToolTip("%s,%s,%g" % (self.Brain_Regions[self.sortedOrder[i]] ,self.Brain_Regions[self.sortedOrder[j]],self.correlationTable.data[self.sortedOrder[i], self.sortedOrder[j]]))

        self.verticalHeader()
        self.horizontalHeader()
CommunitiesNode.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def PutColor(self,colorvalue):
        # print "Value", self.Nodeidss
        self.colorvalue = colorvalue
        self.CommunityColor = QtGui.QColor(colorvalue)
        self.update()
CommunitiesNode.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def PutColor(self,colorvalue):
        # print "Value", self.Nodeidss
        self.colorvalue = colorvalue
        self.CommunityColor = QtGui.QColor(colorvalue)
        self.update()
CommunitiesAcrossTimeStep.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def UpdateColorsInElectrodeView(self, nodelist, Offset = 0):
        ElectrodeViewObjectDummy = self.electrode.SmallMultipleElectrode[1]

        for i in nodelist:
            try: 
                ElectrodeViewNumberToUpdate = self.AggregateHashmap[i['timestep']]
            except KeyError: 
                continue

            # getting the electrode view number 
            ElectrodeViewObject = self.electrode.SmallMultipleElectrode[ElectrodeViewNumberToUpdate]
            assert ElectrodeViewObject.ChunkNo == ElectrodeViewNumberToUpdate

            # get the elements in the community defined by that 
            CommunityNumber = i['OriginalAssignmentValue']
            Elements = i['Elements']

            Color = i['color'].replace("rgb(", "").replace(")", "").replace(" ", "").split(',')
            Color = map(int, Color)

            for element in Elements: 
                ActualElectrodeNumber = self.electrode.ElectrodeIds[element]
                norm = ElectrodeViewObject.ElectrodeOpacity[element].normalize(i['timestep'], ActualElectrodeNumber)
                ElectrodeViewObject.NodeIds[element].PutFinalColors(norm[0],norm[1], QtGui.QColor(Color[0],Color[1],Color[2]),i['timestep'],CommunityNumber,ElectrodeViewObjectDummy.slices)
                assert ElectrodeViewObject.NodeIds[element].counter == element
                ElectrodeViewObject.NodeIds[element].update()
Edge.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, graphWidget, sourceNode, destNode, counter, sourceId, destId, MaxValue,weight=1,ForCommunities=False,):
        QtGui.QGraphicsItem.__init__(self)
        self.setAcceptHoverEvents(False)
        self.EdgeThreshold = MaxValue - 0.01
        self.ColorEdgesFlag = False
        self.index = counter
        self.Alpha = 0.2
        self.sourceId = sourceId 
        self.destId = destId
        self.ColorMap = True
        self.ForCommunities= ForCommunities
        self.HighlightedColorMap = False
        self.communityWeight = weight
        self.edgeThickness = 1
        self.thickHighlightedEdges = 3 
        self.ColorOnlySelectedNodesFlag =False

        if math.isnan(weight):
            weight = 0

        self.weight = weight

        if ForCommunities:
            self.communtiyColor = ColorToInt((0,0,0,255))
            self.communtiyColor1 = QtGui.QColor(self.communtiyColor)
            self.setToolTip(str("InterModular Strength:  "+"{0:.2f}".format(weight)))
        self.sourcePoint = QtCore.QPointF()
        self.destPoint = QtCore.QPointF()
        self.graph = weakref.ref(graphWidget)
        self.source = weakref.ref(sourceNode)
        self.dest = weakref.ref(destNode)
        self.EdgeColor = QtGui.QColor(self.graph().EdgeColor[self.index])
        self.source().addEdge(self)
Node.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def PutTextColor(self,colorvalue):
        self.TextColor = colorvalue
        self.CommunityTextColor = QtGui.QColor(colorvalue)
        self.update()
Node.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def PutColor(self,colorvalue):
        self.colorvalue = colorvalue
        self.CommunityColor = QtGui.QColor(colorvalue)
        self.NodeCommunityColor = True
        self.update()
ElectrodeNode.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def PutFinalColors(self,opacity,actualValue, colorvalue,timesterange,\
        communityMemebership,slices= 4, alphaValue=255,\
         AllFourColors = None, AlphaDraw = False):
        self.slices = slices
        self.numberCalled += 1
        self.CommunityColor = QtGui.QColor(colorvalue)

        if opacity == None:
            opacity = 0

        self.colorvalue = colorvalue
        if self.Glyph:
            self.communityMemebership.append(communityMemebership)
            self.TimeStepRange.append(timesterange) 
            self.ColorQ.append(self.CommunityColor)
            self.actualValue.append(actualValue)
            self.opacity = opacity
            self.AlphaValue.append(opacity)
            counter= 0 
            new = []
            for value in self.TimeStepRange:
                new.append(value)

            self.setToolTip(str(self.AlphaValue)+"\n"+str(self.actualValue) + str(new)+ "\n"+communityMemebership)

            if len(self.ColorQ) > self.slices:
                self.AlphaValue = self.AlphaValue[-self.slices:]  
                self.ColorQ = self.ColorQ[-self.slices:]
                self.actualValue = self.actualValue[-self.slices:] 
                self.TimeStepRange = self.TimeStepRange[-self.slices:]
                self.communityMemebership = self.communityMemebership[-self.slices:]
                self.setToolTip(str(self.AlphaValue)+"\n:" + str(self.TimeStepRange)+ "\n")

        self.NodeCommunityColor = True
        self.update()
ElectrodeView.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def paint(self, painter, option, widget):
        """
        This method does the drawing.
        """
        painter.setPen(QtCore.Qt.darkGray)
        painter.setBrush(QtGui.QColor(250, 245, 209))

        adjustedRect = self.boundingRect() # the rectangle around the text

        if self.orientation == 'above':
            # should draw the label balloon above the point
            adjustedRect.adjust(0, 0, 0, -12)
            vertices = [QtCore.QPointF(adjustedRect.width()/2 - 6,
                                       adjustedRect.height() - 1),
                        QtCore.QPointF(adjustedRect.width()/2,
                                       adjustedRect.height() + 12),
                        QtCore.QPointF(adjustedRect.width()/2 + 6,
                                       adjustedRect.height() - 1)]
        else:
            # should draw the label balloon below the point
            adjustedRect.adjust(0, 12, 0, 0)
            vertices = [QtCore.QPointF(adjustedRect.width()/2 - 6, 1),
                        QtCore.QPointF(adjustedRect.width()/2, -12),
                        QtCore.QPointF(adjustedRect.width()/2 + 6, 1)]

        # paint the balloon rectangle
        painter.drawRoundedRect(adjustedRect, 8, 8)

        # paint the balloon arrow triangle fill
        painter.setPen(QtCore.Qt.NoPen)
        painter.drawPolygon(vertices)

        # paint the balloon arrow triangle stroke
        painter.setPen(QtCore.Qt.darkGray)

        painter.drawLine(vertices[0], vertices[1])
        painter.drawLine(vertices[2], vertices[1])

        # Finally call the parent paint method to draw the actual text
        super(GraphicsBalloonTextItem, self).paint(painter, option, widget)
main.py 文件源码 项目:Electrify 作者: jyapayne 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setColor(self, color, emit=True):
        if isinstance(color, (str, bytes)):
            self.color = QtGui.QColor(color)
        else:
            self.color = color

        self.update()

        if emit:
            self.colorChanged.emit(self.color)


问题


面经


文章

微信
公众号

扫码关注公众号