Python PyQt4.QtGui.QColor() Examples
The following are 30
code examples of PyQt4.QtGui.QColor().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt4.QtGui
, or try the search function
.
Example #1
Source File: test_version_creator.py From anima with MIT License | 6 votes |
def test_takes_with_representations_shows_in_blue(self): """testing if takes with representations will be displayed in blue """ # select project 1 -> task1 item_model = self.dialog.tasks_treeView.model() selection_model = self.dialog.tasks_treeView.selectionModel() index = item_model.index(0, 0) project1_item = item_model.itemFromIndex(index) self.dialog.tasks_treeView.expand(index) task1_item = project1_item.child(0, 0) selection_model.select( task1_item.index(), QtGui.QItemSelectionModel.Select ) # expect only one "Main" take listed in take_listWidget main_item = self.dialog.takes_listWidget.item(0) item_foreground = main_item.foreground() color = item_foreground.color() self.assertEqual( color, QtGui.QColor(0, 0, 255) )
Example #2
Source File: cityscapesLabelTool.py From TFSegmentation with Apache License 2.0 | 6 votes |
def drawPoint(self, qp, pt, isFirst, increaseRadius): # The first in green if isFirst: qp.setBrush(QtGui.QBrush(QtGui.QColor(0,255,0),QtCore.Qt.SolidPattern)) # Other in red else: qp.setBrush(QtGui.QBrush(QtGui.QColor(255,0,0),QtCore.Qt.SolidPattern)) # Standard radius r = 3.0 # Increase maybe if increaseRadius: r *= 2.5 # Draw qp.drawEllipse( pt, r, r ) # Determine if the given candidate for a label path makes sense
Example #3
Source File: networkoverview.py From procexp with GNU General Public License v3.0 | 6 votes |
def __init__(self, plot, depth, reader, card, scale): self.__curveNetInHist__ = plotobjects.niceCurve("Network In History", 1 ,QtGui.QColor(241,254,1), QtGui.QColor(181,190,1), plot) self.__curveNetOutHist__ = plotobjects.niceCurve("Network Out History", 1, QtGui.QColor(28,255,255),QtGui.QColor(0,168,168), plot) self.__depth__ = depth self.__reader__ = reader self.__first__ = False self.__plot__ = plot self.__card__ = card #adapt the network plot self.__adaptednetworkplot = plotobjects.procExpPlot(self.__plot__, scale) self.__networkInUsageHistory__ = [0] * int(self.__depth__) self.__networkOutUsageHistory__ = [0] * int(self.__depth__)
Example #4
Source File: exploitsview.py From rexploit with GNU General Public License v3.0 | 6 votes |
def pushButtonAutoCheckClicked(self): root = self.treeWidget.invisibleRootItem() success = 0 fail = 0 for i in range(root.childCount()): item = root.child(i) exploit = self.__exploits[str(item.text(0))] if exploit.check(): exploit.vulnerable = True w = self.__stackedWidgetController.getWidgetWithExploit(exploit) w.setCheckBoxVulnerableChecked(True) self.addExploitSuccess(exploit) success += 1 item.setForeground(0, QBrush(QColor(Qt.green))) else: fail += 1 item.setForeground(0, QBrush(QColor(Qt.red))) self.labelCheck.setText("Result: {0} OK - {1} Fail".format(success, fail))
Example #5
Source File: __init__.py From procexp with GNU General Public License v3.0 | 6 votes |
def __init__(self, qwtPlot, scale=None, hasGrid=True): self.__plot__ = qwtPlot if hasGrid: self.__curveCpuPlotGrid= Qwt.QwtPlotGrid() self.__curveCpuPlotGrid.setMajPen(QtGui.QPen(QtGui.QColor(0,100,0), 0, QtCore.Qt.SolidLine)) self.__curveCpuPlotGrid.setMinPen(QtGui.QPen(QtGui.QColor(0,100,0), 0, QtCore.Qt.SolidLine)) self.__curveCpuPlotGrid.enableXMin(True) self.__curveCpuPlotGrid.attach(self.__plot__) self.__plot__.setCanvasBackground(QtGui.QColor(0,0,0)) self.__plot__.enableAxis(0, False ) self.__plot__.enableAxis(2, False ) if scale is None: #self.__plot__.setAxisScale(0,0,100,20) pass else: self.__plot__.setAxisScale(0, scale.min, scale.max, (scale.max - scale.min) / 10.0)
Example #6
Source File: gnuradio_protocol.py From OpenNFB with GNU General Public License v3.0 | 6 votes |
def init(self, history=512, autoscale=True): self.widget = pg.PlotWidget() self.widget.block = self self.gr_block.set_history(history) self.plot = self.widget.plot() self.plot.setPen(QtGui.QColor(self.input.color)) #self.widget.setYRange(*self.yrange) self.widget.enableAutoRange('y', 0.95 if autoscale else False) self.buffer = [] self.timer = QtCore.QTimer() self.timer.timeout.connect(self.updateGUI) self.timer.start(100)
Example #7
Source File: ui.py From kano-burners with GNU General Public License v2.0 | 6 votes |
def setTheme(self): # the application window only has a vertical container which contains # exactly 3 items: a header image, a spacer for the active screen, and a footer self.container = VerticalContainer(self) self.container.setGeometry(0, 0, APP_WIDTH, APP_HEIGHT) # changing the background color of the main window palette = self.palette() palette.setColor(self.backgroundRole(), QtGui.QColor(255, 132, 42)) # FF842A self.setPalette(palette) # adding the 3 items to the application container self.container.addImage(os.path.join(images_path, 'header.png')) self.container.addSpacer(CONTAINER_HEIGHT) footer = self.container.addLabel("Questions? Visit help.kano.me", objectName=LABEL_CSS_FOOTER) load_css_for_widget(footer, os.path.join(css_path, 'label.css'))
Example #8
Source File: gps_tool_data_view_utils.py From stdm with GNU General Public License v2.0 | 6 votes |
def set_feature_vertex_marker(map_canvas, lon, lat, color=VERTEX_COLOR): """ Sets single feature vertex :param map_canvas: Map canvas object :param lat: Vertex latitude value :param lon: Vertex longitude value :param color: Vertex color :return marker: Vertex object :rtype marker: Object """ marker = q_gui.QgsVertexMarker(map_canvas) marker.setCenter(q_core.QgsPoint(lon, lat)) marker.setColor(qg.QColor(color)) marker.setIconType(q_gui.QgsVertexMarker.ICON_CIRCLE) marker.setPenWidth(4) return marker
Example #9
Source File: ai.py From crazyflieROS with GNU General Public License v2.0 | 6 votes |
def drawHZ(self,qp): qp.resetTransform() w = self.width() h = self.height() defaultCol = QColor(0,255,0, 200) top = 50 bottom = h-50 width, height = w*0.2, 22 dist = 10 space = height+dist pos = width/4 for i,k in enumerate(self.hzDisplay.hz.keys()): t = self.hzDisplay.hz[k][1] v = self.hzDisplay.hz[k][0] if t<0: self.drawBar(qp, QRectF(pos, top+space*(6+i), width,height), QColor(128,128,128,200), k+' OFF', 0, 0, 1) else: self.drawBar(qp, QRectF(pos, top+space*(6+i), width,height), defaultCol, k+': %5.1fhz'%v, v, 0, t)
Example #10
Source File: cityscapesLabelTool.py From Detectron-PYTORCH with Apache License 2.0 | 6 votes |
def drawPoint(self, qp, pt, isFirst, increaseRadius): # The first in green if isFirst: qp.setBrush(QtGui.QBrush(QtGui.QColor(0,255,0),QtCore.Qt.SolidPattern)) # Other in red else: qp.setBrush(QtGui.QBrush(QtGui.QColor(255,0,0),QtCore.Qt.SolidPattern)) # Standard radius r = 3.0 # Increase maybe if increaseRadius: r *= 2.5 # Draw qp.drawEllipse( pt, r, r ) # Determine if the given candidate for a label path makes sense
Example #11
Source File: PageMarker.py From pihud with GNU Lesser General Public License v2.1 | 6 votes |
def __init__(self, parent): super(PageMarker, self).__init__(parent) self.height = 10 self.bg_color = QtGui.QColor(255, 255, 255, 50) self.fg_color = QtGui.QColor(255, 255, 255, 70) self.screenRect = QtGui.QApplication.desktop().screen().rect() self.setAutoFillBackground(True) p = self.palette() p.setColor(self.backgroundRole(), self.bg_color) self.setPalette(p) # make full width, and move to bottom of screen self.setFixedWidth(self.screenRect.width()) self.setFixedHeight(self.height) self.move(0, self.screenRect.height() - self.height) self.set(1, 0)
Example #12
Source File: cityscapesLabelTool.py From fcn8s_tensorflow with GNU General Public License v3.0 | 6 votes |
def drawPoint(self, qp, pt, isFirst, increaseRadius): # The first in green if isFirst: qp.setBrush(QtGui.QBrush(QtGui.QColor(0,255,0),QtCore.Qt.SolidPattern)) # Other in red else: qp.setBrush(QtGui.QBrush(QtGui.QColor(255,0,0),QtCore.Qt.SolidPattern)) # Standard radius r = 3.0 # Increase maybe if increaseRadius: r *= 2.5 # Draw qp.drawEllipse( pt, r, r ) # Determine if the given candidate for a label path makes sense
Example #13
Source File: Widget.py From pihud with GNU Lesser General Public License v2.1 | 6 votes |
def mouseMoveEvent(self, e): if e.buttons() == QtCore.Qt.LeftButton: mimeData = QtCore.QMimeData() mimeData.setText('%d,%d' % (e.x(), e.y())) # show the ghost image while dragging pixmap = QtGui.QPixmap.grabWidget(self) painter = QtGui.QPainter(pixmap) painter.fillRect(pixmap.rect(), QtGui.QColor(0, 0, 0, 127)) painter.end() drag = QtGui.QDrag(self) drag.setMimeData(mimeData) drag.setPixmap(pixmap) drag.setHotSpot(e.pos()) drag.exec_(QtCore.Qt.MoveAction)
Example #14
Source File: cityscapesLabelTool.py From LightNet with MIT License | 6 votes |
def drawPoint(self, qp, pt, isFirst, increaseRadius): # The first in green if isFirst: qp.setBrush(QtGui.QBrush(QtGui.QColor(0,255,0),QtCore.Qt.SolidPattern)) # Other in red else: qp.setBrush(QtGui.QBrush(QtGui.QColor(255,0,0),QtCore.Qt.SolidPattern)) # Standard radius r = 3.0 # Increase maybe if increaseRadius: r *= 2.5 # Draw qp.drawEllipse( pt, r, r ) # Determine if the given candidate for a label path makes sense
Example #15
Source File: cityscapesLabelTool.py From Detectron-PYTORCH with Apache License 2.0 | 5 votes |
def get_colour(self): if self.type == CorrectionBox.types.TO_CORRECT: return QtGui.QColor(255,0,0) elif self.type == CorrectionBox.types.TO_REVIEW: return QtGui.QColor(255,255,0) elif self.type == CorrectionBox.types.RESOLVED: return QtGui.QColor(0,255,0) elif self.type == CorrectionBox.types.QUESTION: return QtGui.QColor(0,0,255)
Example #16
Source File: show_submission.py From TPN with MIT License | 5 votes |
def draw_predictions(file_path, predictions, class_index, score_low, score_high): img = QtGui.QImage(file_path) painter = QtGui.QPainter(img) for i, pred in enumerate(predictions): if class_index > 0 and pred.class_index != class_index: continue if pred.score < score_low or pred.score > score_high: continue class_name = CLASS_NAMES[pred.class_index] x1, y1, x2, y2 = map(int, pred.bbox) # bbox painter.setPen(QtGui.QPen(PRESET_COLORS[pred.class_index], 10.0)) # painter.setPen(QtGui.QPen(QtGui.QColor(0, 116, 217), 10.0)) painter.setBrush(QtGui.QBrush()) painter.drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1) # label background rect painter.setPen(QtGui.QPen(PRESET_COLORS[pred.class_index], 2.0)) painter.setBrush(QtGui.QBrush(PRESET_COLORS[pred.class_index])) # painter.setPen(QtGui.QPen(QtGui.QColor(0, 116, 217), 2.0)) # painter.setBrush(QtGui.QBrush(QtGui.QColor(0, 116, 217))) if class_index > 0: painter.drawRect(x1, y1, min(x2 - x1 + 1, 100), 30) else: painter.drawRect(x1, y1, min(x2 - x1 + 1, 200), 30) # label text painter.setPen(QtGui.QPen(QtGui.QColor(255, 255, 255))) painter.setBrush(QtGui.QBrush()) painter.setFont(QtGui.QFont('Arial', 20, QtGui.QFont.Bold)) if class_index > 0: painter.drawText(x1 + 4, y1 + 24, '{:.2f}'.format(pred.score)) else: painter.drawText(x1 + 4, y1 + 24, '{} {:.2f}'.format(class_name, pred.score)) return img
Example #17
Source File: uiBasicWidget.py From chanlun with MIT License | 5 votes |
def __init__(self, text=None, mainEngine=None): """Constructor""" super(BidCell, self).__init__() self.data = None self.setForeground(QtGui.QColor('black')) self.setBackground(QtGui.QColor(255,174,201)) if text: self.setContent(text) #----------------------------------------------------------------------
Example #18
Source File: uiBasicWidget.py From InplusTrader_Linux with MIT License | 5 votes |
def setContent(self, text): """设置内容""" if text == DIRECTION_LONG or text == DIRECTION_NET: self.setForeground(QtGui.QColor('red')) elif text == DIRECTION_SHORT: self.setForeground(QtGui.QColor('green')) self.setText(text) ########################################################################
Example #19
Source File: System.py From launcher with GNU General Public License v2.0 | 5 votes |
def paintEvent(self, e): qp=QtGui.QPainter() qp.begin(self) qp.setFont(QtGui.QFont(Config.get()["font"],12)) qp.setRenderHint(QtGui.QPainter.Antialiasing) qp.setPen(QtGui.QColor(250,250,250,0)) qp.setBrush(QtGui.QColor(self.r,self.g,self.b)) qp.drawRoundedRect(QtCore.QRectF(0,0,self.w,self.h),2,2) #title if self.drawButtonRect==True and self.buttonRect!=None: qp.setPen(QtGui.QColor(0,0,0,0)) qp.setBrush(QtGui.QColor(254,254,255,50)) qp.drawRect(self.buttonRect) textRect=QtCore.QRectF(0,0,self.w,40) qp.setPen(QtGui.QColor(250,250,250)) if self.state=="logout": if "XFCE" or "Duck" in os.environ.get("XDG_CURRENT_DESKTOP"): qp.drawText(textRect,QtCore.Qt.AlignCenter,"Log out from your computer?") else: qp.drawText(textRect,QtCore.Qt.AlignCenter,"Sorry, logout is not supported yet..") i = QtGui.QIcon("/usr/share/duck-launcher/default-theme/logout.svg") i.paint(qp, self.w/2-40,self.h/2-60,80,80) if self.state=="restart": qp.drawText(textRect,QtCore.Qt.AlignCenter,"Restart your computer?") i = QtGui.QIcon("/usr/share/duck-launcher/default-theme/restart.svg") i.paint(qp, self.w/2-40,self.h/2-60,80,80) if self.state=="shutdown": qp.drawText(textRect,QtCore.Qt.AlignCenter,"Shut down your computer?") i = QtGui.QIcon("/usr/share/duck-launcher/default-theme/shutdown.svg") i.paint(qp, self.w/2-40,self.h/2-60,80,80) ##Yes No qp.drawLine(20,self.h-50, self.w-20,self.h-50) qp.drawLine(self.w/2, self.h-40, self.w/2,self.h-10) qp.drawText(QtCore.QRectF(0,self.h-50,self.w/2-6,50),QtCore.Qt.AlignCenter, "No") qp.drawText(QtCore.QRectF(self.w/2+2,self.h-50,self.w/2,50),QtCore.Qt.AlignCenter, "Yes")
Example #20
Source File: System.py From launcher with GNU General Public License v2.0 | 5 votes |
def paintEvent(self,e): qp=QtGui.QPainter() qp.begin(self) qp.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.SmoothPixmapTransform) qp.setPen(QtGui.QColor(int(self.r),int(self.g),int(self.b))) qp.setBrush(QtGui.QColor(int(self.r),int(self.g),int(self.b))) qp.drawRoundedRect(QtCore.QRectF(10,0,self.size*self.win_len*1.3+10,self.size*1.5),2,2) qp.setPen(QtGui.QColor(250,250,250)) qp.setBrush(QtGui.QColor(250,250,250)) qp.drawRect(9,0,5,self.size*1.8) half_height=self.size*1.1 icon=QtGui.QIcon("/usr/share/duck-launcher/default-theme/win.svg") icon.paint(qp, -10,half_height-10, 20,20) if self.drawButtonRect==True and self.buttonRect!=None: qp.setPen(QtGui.QColor(0,0,0,0)) qp.setBrush(QtGui.QColor(254,254,255,50)) qp.drawRect(self.buttonRect) #Sleep sl=QtGui.QIcon("/usr/share/duck-launcher/default-theme/sleep.svg") sl.paint(qp, 20,10,self.size,self.size) #Log out lo=QtGui.QIcon("/usr/share/duck-launcher/default-theme/logout.svg") lo.paint(qp, self.size*1.3+20,10,self.size,self.size) #Restart re=QtGui.QIcon("/usr/share/duck-launcher/default-theme/restart.svg") re.paint(qp, self.size*2*1.3+20,10,self.size,self.size) #Shutdown sd=QtGui.QIcon("/usr/share/duck-launcher/default-theme/shutdown.svg") sd.paint(qp, self.size*3*1.3+20,10,self.size,self.size)
Example #21
Source File: test_active_contour.py From CrisisMappingToolkit with Apache License 2.0 | 5 votes |
def paintEvent(self, event): imageqt = ImageQt.ImageQt(self.display_image) p = QtGui.QPainter() p.begin(self) p.setRenderHint(QtGui.QPainter.Antialiasing, True); scale = self.height() / float(imageqt.height() + 10) p.scale(scale, scale) p.translate((self.width() / 2 / scale - imageqt.width() / 2), (self.height() / 2 / scale - imageqt.height() / 2)) p.fillRect(0, 0, imageqt.width(), imageqt.height(), QtGui.QColor(0, 0, 0)) p.drawImage(0, 0, imageqt) NODE_RADIUS = 4 # draw nodes for loop in self.snake.loops: for i in range(len(loop.nodes)): p.setPen(QtGui.QColor(255, 0, 0)) p.setBrush(QtGui.QBrush(QtGui.QColor(255, 0, 0))) p.drawEllipse(loop.nodes[i][1] - NODE_RADIUS / 2.0, loop.nodes[i][0] - NODE_RADIUS / 2.0, NODE_RADIUS, NODE_RADIUS) # draw lines between nodes for loop in self.snake.loops: for i in range(len(loop.nodes)): if len(loop.nodes) > 1: n = i+1 if n == len(loop.nodes): n = 0 p.setPen(QtGui.QColor(0, 255, 0)) p.drawLine(loop.nodes[i][1], loop.nodes[i][0], loop.nodes[n][1], loop.nodes[n][0]) p.end()
Example #22
Source File: Widget.py From pihud with GNU Lesser General Public License v2.1 | 5 votes |
def __init__(self, parent, config): super(Widget, self).__init__(parent) self.config = config # temporary coloring until display widgets get implemented # self.setAutoFillBackground(True) # palette = self.palette() # palette.setColor(self.backgroundRole(), QtGui.QColor(255, 255, 255, 50)) # self.setPalette(palette) # make the context menu self.menu = QtGui.QMenu() self.menu.addAction(self.config["sensor"]).setDisabled(True) subMenu = self.menu.addMenu("Widget Type") for w in widgets: a = subMenu.addAction(w) a.setData(widgets[w]) self.menu.addAction("Delete Widget", self.delete) # instantiate the requested graphics object self.graphics = widgets[config["type"]](self, config) self.move(self.position()) self.show()
Example #23
Source File: uiBasicWidget修改.py From chanlun with MIT License | 5 votes |
def __init__(self, text=None, mainEngine=None): """Constructor""" super(BidCell, self).__init__() self.data = None self.setForeground(QtGui.QColor('black')) self.setBackground(QtGui.QColor(255,174,201)) if text: self.setContent(text) #----------------------------------------------------------------------
Example #24
Source File: cityscapesLabelTool.py From LightNet with MIT License | 5 votes |
def get_colour(self): if self.type == CorrectionBox.types.TO_CORRECT: return QtGui.QColor(255,0,0) elif self.type == CorrectionBox.types.TO_REVIEW: return QtGui.QColor(255,255,0) elif self.type == CorrectionBox.types.RESOLVED: return QtGui.QColor(0,255,0) elif self.type == CorrectionBox.types.QUESTION: return QtGui.QColor(0,0,255)
Example #25
Source File: uiBasicWidget.py From InplusTrader_Linux with MIT License | 5 votes |
def __init__(self, text=None, mainEngine=None): """Constructor""" super(AskCell, self).__init__() self.data = None self.setForeground(QtGui.QColor('black')) self.setBackground(QtGui.QColor(160,255,160)) if text: self.setContent(text) #----------------------------------------------------------------------
Example #26
Source File: cityscapesLabelTool.py From TFSegmentation with Apache License 2.0 | 5 votes |
def get_colour(self): if self.type == CorrectionBox.types.TO_CORRECT: return QtGui.QColor(255,0,0) elif self.type == CorrectionBox.types.TO_REVIEW: return QtGui.QColor(255,255,0) elif self.type == CorrectionBox.types.RESOLVED: return QtGui.QColor(0,255,0) elif self.type == CorrectionBox.types.QUESTION: return QtGui.QColor(0,0,255)
Example #27
Source File: abstractsceneobject.py From cross3d with MIT License | 5 votes |
def setWireColor(self, color): """Sets the wirecolor for the object to the inputed QColor :param color: :class:`PyQt4.QtGui.QColor` """ return self._setNativeWireColor(self._scene._toNativeValue(QColor(color)))
Example #28
Source File: systemoverview.py From procexp with GNU General Public License v3.0 | 5 votes |
def __init__(self, plot, depth, reader, cpu): self.__curveCpuHist__ = plotobjects.niceCurve("CPU History", 1 , QtGui.QColor(0,255,0),QtGui.QColor(0,170,0), plot) self.__curveCpuSystemHist__ = plotobjects.niceCurve("CPU Kernel History", 1, QtGui.QColor(255,0,0),QtGui.QColor(170,0,0), plot) self.__curveIoWaitHist__ = plotobjects.niceCurve("CPU IO wait history", 1, QtGui.QColor(0,0,255),QtGui.QColor(0,0,127), plot) self.__curveIrqHist__ = plotobjects.niceCurve("CPU irq history", 1, QtGui.QColor(0,255,255),QtGui.QColor(0,127,127), plot) scale = plotobjects.scaleObject() scale.min = 0 scale.max = 100 self.__adaptedplot__ = plotobjects.procExpPlot(plot, scale) self.__plot__ = plot self.__depth__ = depth self.__reader__ = reader self.__cpu__ = cpu self.__cpuUsageHistory__ = [0] * int(self.__depth__) self.__cpuUsageSystemHistory__ = [0] * int(self.__depth__) self.__cpuUsageIoWaitHistory__ = [0] * int(self.__depth__) self.__cpuUsageIrqHistory__ = [0] * int(self.__depth__)
Example #29
Source File: systemoverview.py From procexp with GNU General Public License v3.0 | 5 votes |
def __init__(self, plot, depth, reader): self.__curveMemHist__ = plotobjects.niceCurve("Memory History", 1 ,QtGui.QColor(217,137,123), QtGui.QColor(180,70,50), plot) self.__depth__ = depth self.__reader__ = reader self.__first__ = False self.__plot__ = plot #adapt the memory plot self.__memoryUsageHistory__ = [0] * int(self.__depth__)
Example #30
Source File: cityscapesLabelTool.py From fcn8s_tensorflow with GNU General Public License v3.0 | 5 votes |
def get_colour(self): if self.type == CorrectionBox.types.TO_CORRECT: return QtGui.QColor(255,0,0) elif self.type == CorrectionBox.types.TO_REVIEW: return QtGui.QColor(255,255,0) elif self.type == CorrectionBox.types.RESOLVED: return QtGui.QColor(0,255,0) elif self.type == CorrectionBox.types.QUESTION: return QtGui.QColor(0,0,255)