def _create_metallic_roughness_map(self, metal_map, rough_map): metal = QImage(metal_map) rough = QImage(rough_map) metal_pixel = QColor() metal = metal.convertToFormat(QImage.Format_RGB32); rough = rough.convertToFormat(QImage.Format_RGB32); metal_uchar_ptr = metal.bits() rough_uchar_ptr = rough.bits() if (not metal.width() == rough.width() or not metal.height() == rough.height()): raise RuntimeError("Error processing material: {}. Metallic map and roughness map must have same dimensions.".format(self.maya_node)) width = metal.width(); height = metal.height(); i = 0 for y in range(height): for x in range(width): metal_color = struct.unpack('I', metal_uchar_ptr[i:i+4])[0] rough_color = struct.unpack('I', rough_uchar_ptr[i:i+4])[0] metal_pixel.setRgb(0, qGreen(rough_color), qBlue(metal_color)) metal_uchar_ptr[i:i+4] = struct.pack('I', metal_pixel.rgb()) i+=4 output = ExportSettings.out_dir + "/"+self.name+"_metalRough.jpg" return output, metal
def loadContour(self, contourData): logging.debug("In CPRAction::loadContour()") scenes = self._ilsa.scenes() contour = CPRContour(scenes, self._ilsa, self.cprClosed) for scene in scenes: if contourData["sceneId"] == scene.id: contour.scene = scene elif contourData["panoramicSceneId"] == scene.id: contour.setPanoramicPlane(scene.parent) elif contourData["transversalSceneId"] == scene.id: contour.setTransversalPlane(scene.parent) self.propertiesAction.addContour(contour) contour.loadPoints(contourData["points"]) lc = contourData["lineColor"] alc = contourData["actualLineColor"] ts = contourData["transversalSize"] lineColor = QColor.fromRgbF(lc[0], lc[1], lc[2]) actualLineColor = QColor.fromRgbF(alc[0], alc[1], alc[2]) self.propertiesAction.changeLineColor(lineColor) self.propertiesAction.changeActualLineColor(actualLineColor) contour.setTransversalSize(ts) self.propertiesAction.slotActionVisible(contourData["visible"]) self.propertiesAction.slotActionLock(contourData["locked"]) self.propertiesAction.lock.setChecked(contourData["locked"])
def paintEvent(self, ev): if self.isEnabled(): color = self.color colorBorder = [0.4, 0.4, 0.4] else: color = [0.8, 0.8, 0.8] colorBorder = [0.7, 0.7, 0.7] painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing) painter.setRenderHint(QPainter.HighQualityAntialiasing) if self.isChecked(): pen = QPen(QColor.fromRgbF(0.2, 0.2, 0.2)) pen.setWidth(2.0) else: pen = QPen(QColor.fromRgbF(colorBorder[0], colorBorder[1], colorBorder[2])) pen.setWidth(1.0) size = self.size() sizeCircle = 12.0 x = size.width() / 2.0 - (sizeCircle / 2.0) y = size.height() / 2.0 - (sizeCircle / 2.0) rect = QRectF(x, y, sizeCircle, sizeCircle) painter.setPen(pen) painter.setBrush(QColor.fromRgbF(color[0], color[1], color[2])) painter.drawEllipse(rect)
def __init__(self, size, dynamic, controller): layer.__init__(self,size,dynamic) self.controller = controller self.ready = False dotColor = QColor() dotColor.setNamedColor(self.controller.svgLayer.svg.dotPrototype.getAttribute('fill')) dotColor.setAlphaF(float(self.controller.svgLayer.svg.dotPrototype.getAttribute('fill-opacity'))) self.dotColors = [] i = 0 while i <= 1.0: self.dotColors.append(QColor.fromRgbF(dotColor.redF(),dotColor.greenF(),dotColor.blueF(),i)) i += dotColor.alphaF() self.dotWidth = self.controller.svgLayer.svg.dotPrototype.width() self.dotHeight = self.controller.svgLayer.svg.dotPrototype.height() self.halfDotWidth = self.dotWidth/2 self.halfDotHeight = self.dotHeight/2 self.xoffset = self.controller.scatterBounds[0]-self.halfDotWidth self.yoffset = self.controller.scatterBounds[3]-self.halfDotHeight self.xNonNumeric = (self.controller.svgLayer.svg.xNonNumericIcon.left() + self.controller.svgLayer.svg.xNonNumericIcon.right())/2 - self.halfDotWidth self.yNonNumeric = (self.controller.svgLayer.svg.yNonNumericIcon.top() + self.controller.svgLayer.svg.yNonNumericIcon.bottom())/2 - self.halfDotHeight
def fromStr(name, a=255): if name in _Colorizer.__colorTable: c = QColor(_Colorizer.__colorTable[name]) else: c = QColor(Qt.transparent) c.setAlpha(a) return c
def _set_pixmap_from_roi(self, roi): if roi.visible: color = _display_color(roi.color, self.selected) else: color = QColor(Qt.transparent) self.pixmap = _ndarray_to_arraypixmap(roi.mask[self.slicer.slc.view_slice], color.toTuple()) self.pixmapitem.setPixmap(self.pixmap) self.pixmapitem.setZValue(_foreground_roi_z if self.selected else _background_roi_z)
def setBaseColor(newcolor): StyleHelper.requestedBaseColor = newcolor color = QColor() color.setHsv(newcolor.hue(), newcolor.saturation() * 0.7, 64 + newcolor.value() / 3) if color.isValid() and color != StyleHelper.baseColor: StyleHelper.baseColor = color for w in QApplication.topLevelWidgets(): w.update()
def _fade(self, lineno): cursor = self._get_line_cursor(lineno) fmt = cursor.charFormat() color=QColor('black') color.setAlphaF(0.5) fmt.setForeground(color) cursor.beginEditBlock() cursor.mergeCharFormat(fmt) cursor.endEditBlock()
def _init_ui(self, txt): self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) pal = QPalette() color = QColor() color.setNamedColor(self._window_bgcolor) color.setAlpha(255 * self._opacity) pal.setColor(QPalette.Background, color) self.setAutoFillBackground(True) self.setPalette(pal) wm, hm = 5, 5 spacing = 8 layout = QVBoxLayout() layout.setSpacing(spacing) layout.setContentsMargins(wm, hm, wm, hm) nlines, ts = self._generate_text(txt) qlabel = QLabel('\n'.join(ts)) ss = 'QLabel {{color: {}; font-family:{}, sans-serif; font-size: {}px}}'.format(self._color, self._font, self._fontsize) qlabel.setStyleSheet(ss) layout.addWidget(qlabel) hlabel = QLabel('double click to dismiss') hlabel.setStyleSheet('QLabel {font-size: 10px}') hlayout = QHBoxLayout() hlayout.addStretch() hlayout.addWidget(hlabel) hlayout.addStretch() layout.addLayout(hlayout) self.setLayout(layout) font = QFont(self._font, self._fontsize) fm = QFontMetrics(font) pw = max([fm.width(ti) for ti in ts]) ph = (fm.height() + 2) * nlines w = pw + wm * 2 h = ph + (hm + spacing + 1) * 2 self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setFixedWidth(w) self.setFixedHeight(h) self.setMask(mask(self.rect(), 10))
def drawPolygon(self): path = [mark.coordinate() for mark in self.markerObjects] pen = QPen(Qt.white) pen.setWidth(2) pen.setCosmetic(True) polygon = QGeoMapPolygonObject() polygon.setPen(pen) fill = QColor(Qt.black) fill.setAlpha(65) polygon.setBrush(QBrush(fill)) polygon.setPath(path) self.mapWidget.addMapObject(polygon)
def routeFinished(self): if not self.routeReply.routes(): return route = QGeoMapRouteObject(self.routeReply.routes()[0]) routeColor = QColor(Qt.blue) routeColor.setAlpha(127) pen = QPen(routeColor) pen.setWidth(7) pen.setCosmetic(True) pen.setCapStyle(Qt.RoundCap) route.setPen(pen) self.mapWidget.addMapObject(route)
def syntax_format(color, style=''): """Return a QTextCharFormat with the given attributes. """ _color = QColor() _color.setNamedColor(color) _format = QTextCharFormat() _format.setForeground(_color) if 'bold' in style: _format.setFontWeight(QFont.Bold) if 'italic' in style: _format.setFontItalic(True) return _format
def startNewLineCollection(self): self.lineCollections.append(LineCollection()) self.openCollectionIdx += 1 newColor = QColor() # http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ ''' rand = random.random() rand += 0.618033988749895 rand %= 1 ''' phi = 0.618033988749895 hue = self.openCollectionIdx * phi - floor(self.openCollectionIdx * phi) newColor.setHsv(int(hue*256), 120 + int(random.random()*(240-120+1)), 242) self.colors.append(newColor)
def drawRect(self): if len(self.markerObjects) < 2: return p1, p2 = self.markerObjects[:2] pen = QPen(Qt.white) pen.setWidth(2) pen.setCosmetic(True) fill = QColor(Qt.black) fill.setAlpha(65) rectangle = QGeoMapRectangleObject(p1.coordinate(), p2.coordinate()) rectangle.setPen(pen) rectangle.setBrush(QBrush(fill)) self.mapWidget.addMapObject(rectangle)
def __init__(self, size, dynamic, controller, prototypeLine, opaqueBack = False): layer.__init__(self,size,dynamic) self.controller = controller self.points = set() if opaqueBack: self.backgroundColor = Qt.white else: self.backgroundColor = Qt.transparent lineColor = QColor() lineColor.setNamedColor(prototypeLine.getAttribute('stroke')) lineColor.setAlphaF(float(prototypeLine.getAttribute('stroke-opacity'))) self.pen = QPen(lineColor) self.pen.setWidthF(prototypeLine.getAttribute('stroke-width'))
def __init__(self, parent, level_selection): """ Initialize the Level Selection View """ QFrame.__init__(self)#, parent) self.resize(640, 480) self.level_selection = level_selection self.setFocusPolicy(Qt.StrongFocus) self.color = QColor(200, 200, 200) self.setStyleSheet("QFrame { background-color: %s }" % self.color.name()) self.levelDetailsView = LevelDetailsView(self.level_selection, parent=self) width = self.ENTRIES_PER_ROW*LevelOverviewView.WIDTH+32 self.levelDetailsView.move(width, 0) self.levelDetailsView.resize(640-width, 480) self.levelOverviews = [] for level in level_selection.levels: overview = LevelOverviewView(self, level, level_selection) self.levelOverviews.append(overview) for i in range(len(self.levelOverviews)): overview = self.levelOverviews[i] overview.move(16+(i%self.ENTRIES_PER_ROW)*LevelOverviewView.WIDTH, 32+i/self.ENTRIES_PER_ROW*LevelOverviewView.HEIGHT)
def getOrdinalColor(self, value, alternate=1): if self.binColors: lowerIndex = int(math.floor(1.0*value)) higherIndex = int(math.ceil(1.0*value)) closerIndex = lowerIndex if value-math.floor(value) < math.ceil(value)-value else higherIndex if alternate == 2: return AppState.ORDINAL_COLORS_2[closerIndex] elif alternate == 3: return AppState.ORDINAL_COLORS_3[closerIndex] elif alternate == 4: return AppState.ORDINAL_COLORS_4[closerIndex] elif alternate == 5: return AppState.ORDINAL_COLORS_5[closerIndex] else: return AppState.ORDINAL_COLORS_1[closerIndex] else: if alternate == 2: hue = AppState.ORDINAL_COLORS_2[0] elif alternate == 3: hue = AppState.ORDINAL_COLORS_3[0] elif alternate == 4: hue = AppState.ORDINAL_COLORS_4[0] elif alternate == 5: hue = AppState.ORDINAL_COLORS_5[0] else: hue = AppState.ORDINAL_COLORS_1[0] return QColor.fromHsvF(hue.hueF(),0.9-0.6*value,0.6+0.4*value)
def paint(self, painter, options, widget): angleSpan = 0 angle = 0 index = 0 sumValues = self.parentItem().sumValues if sumValues == 0: return for item in self.parentItem().children(): angleSpan = (360.0 * item.value) / sumValues if item == self: break else: angle += angleSpan index += 1 color = QColor.fromHslF(0.1 * index, 1.0, 0.5, 1.0) pen = QPen(color) brush = QBrush(color) painter.setPen(pen) painter.setBrush(brush) painter.setRenderHints(QPainter.Antialiasing, True) painter.drawPie(self.boundingRect(), angle * 16, angleSpan * 16);
def loadContour(self, contourData): logging.debug("In MarkAction::loadContour()") scenes = self._ilsa.scenes() replyList = [] for scene in scenes: if isinstance(scene, VtkMultiSliceImagePlane): contour = MultiSliceContour(scene) else: contour = Contour(scene) replyList.append(contour) self.propertiesAction.addContour(replyList[0]) for i, scene in enumerate(scenes): a = replyList[:] b = a.pop(i) b.replyList = a contour.loadPoints(contourData["points"]) lc = contourData["lineColor"] lineColor = QColor.fromRgbF(lc[0], lc[1], lc[2]) self.propertiesAction.changeLineColor(lineColor) self.propertiesAction.slotActionVisible(contourData["visible"]) self.propertiesAction.slotActionLock(contourData["locked"]) self.propertiesAction.lock.setChecked(contourData["locked"]) self.propertiesAction.slotThicknessChanged(contourData["radius"])
def test_filter_list_item_has_icon(self): file_names = [os.path.abspath('hi.txt')] color = QColor.fromRgbF(.5, .6, .4, .34) item = FilterListItem(file_names, color=color) icon = item.icon() self.assertIsNotNone(icon) self.assertFalse(icon.isNull())
def updateLines(self): pen = QPen(QColor.fromHsl(0, 100, 100)) sortedNodes = sorted(self.nodes, key=lambda x: x.pos().x()) for index in range(len(self.nodes)-1): node = sortedNodes[index] nextNode = sortedNodes[index+1] if index < len(self.lines): # Just update the line segment lineItem = self.lines[index] else: # Create a new line segment lineItem = QGraphicsLineItem() lineItem.setZValue(250) lineItem.setPen(pen) self.histogramWidget.scene().addItem(lineItem) self.lines.append(lineItem) line = QLineF(node.pos(), nextNode.pos()) lineItem.setLine(line) # Clean up redundent lines if len(self.lines) >= len(self.nodes): # Remove the redundant line segments from the scene for index in range(len(self.nodes)-1, len(self.lines)): lineItem = self.lines[index] self.histogramWidget.scene().removeItem(lineItem) # Delete the line segments from the list del self.lines[len(self.nodes)-1:] assert len(self.lines) == len(self.nodes) - 1 self.histogramWidget._scene.update()
class LightWidget(QtGui.QWidget): def __init__(self): super(LightWidget, self).__init__() self.color = QColor() self.last_is_red = True self.set_red() def set_red(self): self.color.setRgb(255, 0, 0) if not self.last_is_red: try: self.update() except Exception: pass self.last_is_red = True def set_green(self): self.color.setRgb(0, 255, 0) if self.last_is_red: try: self.update() except Exception: pass self.last_is_red = False def paintEvent(self, e): qp = QtGui.QPainter() qp.begin(self) self.drawWidget(qp) qp.end() def drawWidget(self, qp): size = self.size() radx = size.width() rady = size.height() dot = min(radx, rady) / 2 pen = QPen() pen.setWidth(dot) # pen.setStyle(Qt.SolidLine) pen.setBrush(self.color) # pen.setCapStyle(Qt.RoundCap) # pen.setJoinStyle(Qt.RoundJoin) qp.setPen(pen) qp.drawLine(dot, dot, dot, dot)
def paint(self, canvas, is_secondary_color=False, additional_flag=False): if is_secondary_color: switch_color = self.data_singleton.secondary_color else: switch_color = self.data_singleton.primary_color # TODO: не заливает, если кликать на transparent фон x, y = self._start_point.x(), self._start_point.y() pixel = canvas.image.pixel(x, y) old_color = QColor(pixel) if switch_color != old_color: self.fill_recurs(x, y, switch_color.rgb(), old_color.rgb(), canvas.image) canvas.edited = True canvas.update()
class QColorGetTest(unittest.TestCase): def setUp(self): self.color = QColor(20, 40, 60, 80) def testGetRgb(self): self.assertEqual(self.color.getRgb(), (20, 40, 60, 80)) def testGetHslF(self): hls = colorsys.rgb_to_hls(20.0/255, 40.0/255, 60.0/255) hsla = hls[0], hls[2], hls[1], self.color.alphaF() for x, y in zip(self.color.getHslF(), hsla): # Due to rounding problems self.assert_(x - y < 1/100000.0) def testGetHsv(self): hsv = colorsys.rgb_to_hsv(20.0/255, 40.0/255, 60.0/255) hsva = int(hsv[0]*360.0), int(hsv[1]*255), int(hsv[2]*256), self.color.alpha() self.assertEqual(self.color.getHsv(), hsva) def testGetCmyk(self): # not supported by colorsys self.assertEqual(self.color.getCmyk(), (170, 85, 0, 195, 80)) def testGetCmykF(self): # not supported by colorsys for x, y in zip(self.color.getCmykF(), (170/255.0, 85/255.0, 0, 195/255.0, 80/255.0)): self.assert_(x - y < 1/10000.0)
class WeekCalendar(QCalendarWidget): def __init__(self, *args): QCalendarWidget.__init__(self, *args) self.color = QColor(self.palette().color(QPalette.Highlight)) self.color.setAlpha(64) self.selectionChanged.connect(self.updateCells) def paintCell(self, painter, rect, date): QCalendarWidget.paintCell(self, painter, rect, date) filelist = glob.glob('journal_[0-9]*') datelist = [] for i in filelist: l = tuple(i[i.index('_') + 1:].split('_')) datelist.append(QDate(int(l[2]), int(l[1]), int(l[0]))) if date in datelist: painter.fillRect(rect, self.color)
def __init__(self, level, width, height, parent=None): """ Initialize the Level Completion View """ QFrame.__init__(self, parent) self.level = level self.setup() self.updateView() self.color = QColor(200, 200, 200) self.setStyleSheet("QFrame { background-color: %s }" % self.color.name()) self.resize(width, height)
def __init__(self, text, color, size=QSize(80, 30), parent=None): super(RaisedButton, self).__init__(parent) self.resize(size) if color == None: color = QColor(66, 165, 245) else: color = QColor(color) self.isFlat = True self.color = color self.setText(text) self.effect = QGraphicsDropShadowEffect(self.parent()) self.effect.setOffset(3) self.effect.setColor(QColor(0, 0, 0, 40)) self.setGraphicsEffect(self.effect) self.press = False with open("QPushButton-Raised.qss") as f: dat = f.read() color1 = color.name() color2 = color.lighter().name() dat = dat % (str(color1), str(color2)) self.setStyleSheet(dat)
def createPixmapIcon(self): self.markerIcon = QPixmap(MARKER_WIDTH, MARKER_HEIGHT) self.markerIcon.fill(Qt.transparent) painter = QPainter(self.markerIcon) p1 = QPoint(MARKER_WIDTH / 2, MARKER_HEIGHT - 1) p2 = QPoint(MARKER_WIDTH / 2, MARKER_HEIGHT - 1 - MARKER_PIN_LEN) pen = QPen(Qt.black) pen.setWidth(2) pen.setCosmetic(True) painter.setPen(pen) painter.drawLine(p1, p2) ellipse = QRect(0, 0, MARKER_WIDTH - 1, MARKER_HEIGHT - 1) pen.setWidth(1) painter.setPen(pen) color = QColor(Qt.green) color.setAlpha(127) brush = QBrush(color) painter.setBrush(brush) painter.drawEllipse(ellipse)
def convert_to_color ( object, name, value ): """ Converts a number into a QColor object. """ # Handle the case of a number of the form: 0xAARRGGBB, where the alpha AA # value is inverted (i.e. 00 = opaque, FF = transparent): if isinstance( value, IntTypes ): return QColor( int( (value >> 16) & 0xFF ), int( (value >> 8) & 0xFF ), int( value & 0xFF ), int( 255 - ((value >> 24) & 0xFF) ) ) # Try the toolkit agnostic format. try: tup = eval( value ) except: tup = value if isinstance( tup, tuple ): if 3 <= len( tup ) <= 4: try: color = QColor( *tup ) except TypeError: raise FacetError else: raise FacetError else: if isinstance( value, basestring ): # Allow for spaces in the string value. value = value.replace( ' ', '' ) # Let the standard ctors handle the value. try: color = QColor( value ) except TypeError: raise FacetError if not color.isValid(): raise FacetError return color
def drawCircle(self): if not len(self.markerObjects): return p1 = self.markerObjects[0] center = p1.coordinate() radius = 3000 # Meters if len(self.markerObjects) >= 2: radius = center.distanceTo(self.markerObjects[1].coordinate()) pen = QPen(Qt.white) pen.setWidth(2) pen.setCosmetic(True) circle = QGeoMapCircleObject(center, radius) circle.setPen(pen) fill = QColor(Qt.black) fill.setAlpha(65) circle.setBrush(QBrush(fill)) self.mapWidget.addMapObject(circle)
def testReduceHsv(self): self.reduceColor(QColor.fromHsvF(0.1, 0.2, 0.3, 0.4))
def testReduceString(self): self.reduceColor(QColor('gray'))
def __init__(self): super(QDiffConnector, self).__init__() self.color = QColor(0, 100, 0, 100) self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Ignored)) self.setFixedWidth(30)
def OnDay(self): """""" self.setTextBackgroundColor(QColor('#FFFFFF')) self.setTextColor(QColor('#000000')) print('OnDay')
def inverse_colors(c): if QColor(c).lightness() <= 150: return Qt.GlobalColor.white else: return Qt.GlobalColor.black
class CustomCheck(qg.QCheckBox): _glowBrushes = {} for index in range(1, 11): _glowBrushes[index] = [ QBrush(QColor(0, 255, 0, 1 * index)), QBrush(QColor(0, 255, 0, 3 * index)), QBrush(QColor(0, 255, 0, 15 * index)), QBrush(QColor(50, 200, 50, 25.5 * index)) ] _glowOffBrushes = {} for index in range(1, 11): _glowOffBrushes[index] = [ QBrush(QColor(0, 150, 0, 1 * index)), QBrush(QColor(0, 150, 0, 6 * index)), QBrush(QColor(0, 150, 0, 9 * index)), QBrush(QColor(50, 200, 50, 12 * index)) ] _disableGlowBrushes = {} for index in range(1, 11): _disableGlowBrushes[index] = [ QBrush(QColor(80, 80, 80, 1 * index)), QBrush(QColor(80, 80, 80, 5 * index)), QBrush(QColor(80, 80, 80, 15 * index)), QBrush(QColor(80, 80, 80, 25.5 * index)) ] _pen_text = QPen(QColor(200, 200, 200), 1, qc.Qt.SolidLine) _pen_Shadow = QPen(QColor(9, 10, 12), 1, qc.Qt.SolidLine) _pen_border = QPen(QColor(9, 10, 12), 2, qc.Qt.SolidLine) _pen_clear = QPen(QColor(0, 0, 0, 0), 1, qc.Qt.SolidLine) _penText_disable = QPen(QColor(102, 107, 110), 1, qc.Qt.SolidLine) _penShadow_disable = QPen(QColor(0, 0, 0), 1, qc.Qt.SolidLine) _brushClear = QBrush(QColor(0, 0, 0, 0)) _brushBorder = QBrush(QColor(9, 10, 12)) def __init__(self, *args, **kwargs): qg.QCheckBox.__init__(self, *args, **kwargs) font = qg.QFont() font.setPointSize(10) font.setFamily('Calibri') self.setFont(font) self.hover = False self._glow_index = 0 self._anim_timer = qc.QTimer() self._anim_timer.timeout.connect(self._animateGlow) self.setFixedHeight(27) self.fontMetrics = qg.QFontMetrics(font) self.radius = 5 def _animateGlow(self): if self.hover: if self._glow_index >= 10: self._glow_index = 10 while self._glow_index > 8: self._glow_index -= 0.25 #print self._glow_index if self._glow_index == 8: self._anim_timer.stop() else: self._glow_index += 1 else: if self._glow_index <= 0: self._glow_index = 0 self._anim_timer.stop() else: self._glow_index -= 1 #print self._glow_index utils.executeDeferred(self.update) #-----------------------------------------------------------------------------------------------# def enterEvent(self, event): if not self.isEnabled(): return self.hover = True self.startAnim() def leaveEvent(self, event): if not self.isEnabled(): return self.hover = False self.startAnim() def startAnim(self): if self._anim_timer.isActive(): return self._anim_timer.start(20) #-----------------------------------------------------------------------------------------------------# def paintEvent(self, event): painter = qg.QPainter(self) option = qg.QStyleOption() option.initFrom(self) x = option.rect.x() y = option.rect.y() height = option.rect.height() - 1 width = option.rect.width() - 1 painter.setRenderHint(qg.QPainter.Antialiasing) painter.setRenderHint(qg.QPainter.TextAntialiasing) alignment = (qc.Qt.AlignHCenter | qc.Qt.AlignVCenter) glowIndex = self._glow_index text = self.text() painter.setPen(self._pen_border) painter.setBrush(self._brushBorder) rounded = painter.drawRoundedRect(qc.QRect(x + 5, y + 8, 12, 12), 5, 5) if self.isEnabled(): painter.setPen(self._pen_Shadow) painter.drawText(11, y + 2, width + 1, height + 1, alignment, text) painter.setPen(self._pen_text) painter.drawText(10, y + 1, width, height, alignment, text) else: painter.setPen(self._penShadow_disable) painter.drawText(11, y + 2, width, height, alignment, text) painter.setPen(self._penText_disable) painter.drawText(10, y + 1, width, height, alignment, text) painter.setPen(self._pen_clear) if self.isEnabled(): glowBrushes = self._glowBrushes glowOffBrush = self._glowOffBrushes else: glowBrushes = self._disableGlowBrushes if self.checkState(): for index, pos, size, corner in zip(range(4), (6, 7, 8, 9), (12, 10, 10, 8), (10, 10, 10, 10)): painter.setBrush(glowBrushes[10][index]) painter.drawRoundedRect( qc.QRect((x * pos) + 6, pos + 1, size, size), corner, corner) glowIndex = self._glow_index if glowIndex > 0: for index, pos, size, corner in zip(range(4), (6, 7, 8, 9), (10, 9, 10, 9), (6, 6, 6, 6)): painter.setBrush(glowOffBrush[glowIndex][index]) painter.drawRoundedRect( qc.QRect((x * pos) + 6, pos + 1, size, size), corner, corner)
def createRoundRect(self, scene): item = RoundRectItem(10, 10, 100, 100) item.setBrush(QBrush(QColor(255, 0, 0))) scene.addItem(item) return item
def _get_color(self, state): if isinstance(state, str): c = QColor(state) else: c = QT_COLORS[state] return c
# See the License for the specific language governing permissions and # limitations under the License. # =============================================================================== # ============= enthought library imports ======================= from traits.api import HasTraits, Property, Int, Callable, Any from traitsui.qt4.editor import Editor from traitsui.basic_editor_factory import BasicEditorFactory # ============= standard library imports ======================== from PySide.QtGui import QColor # ============= local library imports ========================== # ============= views =================================== COLORS = ['red', 'yellow', 'green', 'black'] QT_COLORS = [QColor(ci) for ci in COLORS] # QT_COLORS = [ # QColor(220, 10, 10), # QColor(250, 200, 0), # QColor(10, 220, 10), # QColor(0, 0, 0), # ] class LED(HasTraits): shape = 'circle' state = Property(depends_on='_state') _state = Int def _set_state(self, v):
class Fourier(QWidget): """ Actual fourier display and drawing widget """ fourier_updated = Signal(np.ndarray) image = None pressed = False scale_factor = None color = QColor(0, 0, 0) raw_fourier = None x_sym = False y_sym = False opp_sym = False # signal fourier updated def __init__(self, parent=None): super().__init__(parent) self.update_cursor('square', 20) self.overlay = Overlay(self) def update_image(self, fft_array, factor=None): scaled_values, sf = rescale_array(np.real(np.log2(fft_array)), self.scale_factor) self.scale_factor = sf self.image = array_to_image(scaled_values) self.setMinimumSize(self.image.size()) self.overlay.resize(self.image.size()) self.update() self.updateGeometry() # I have to deliver, and it's broken on windows. self.setMinimumSize(self.image.size()) self.overlay.resize(self.image.size()) self.update() self.updateGeometry() def update_fourier(self, image_array, flush=False): f = array_to_fft(image_array) if self.raw_fourier is None or flush: self.original = f.copy() self.raw_fourier = f.copy() self.update_image(self.raw_fourier) def update_cursor(self, shape, size): self.cursor_size = size self.shape = shape cursor_pix = QPixmap(size, size) cursor_pix.fill(Qt.transparent) painter = QPainter(cursor_pix) painter.setPen(QColor(255, 0, 0)) if shape == 'circle': painter.drawEllipse(0, 0, size - 1, size - 1) elif shape == 'square': painter.drawRect(0, 0, size - 1, size - 1) elif shape == "magic wand": magic_wand.render(painter, QRect(0, 0, 20, 20)) cursor = QCursor(cursor_pix, 0, 0) self.setCursor(cursor) del painter def on_size_change(self, size): """ Brush size changed """ self.cursor_size = size self.update_cursor(self.shape, self.cursor_size) Slot(str) def on_shape_change(self, shape): """ Brush shape changed """ self.shape = shape self.update_cursor(self.shape, self.cursor_size) def on_color_change(self, color): self.color = QColor(color, color, color) def emit_fourier(self): array = fft_to_array(self.raw_fourier) self.fourier_updated.emit(array) def on_restore(self): self.raw_fourier = self.original.copy() self.update_image(self.raw_fourier, self.scale_factor) #self.fourier_updated.emit(self.raw_fourier.copy()) self.emit_fourier() def on_resize(self, factor): if factor == 1.0: return #even = lambda x: x if (x % 2 == 0) else x + 1 array = self.raw_fourier reshape = lambda x_y: [int(factor * x_y[0]), int(factor * x_y[1])] diff = lambda x_y: [x_y[0] - array.shape[0], x_y[1] - array.shape[1]] nexteven = lambda x: x if (x % 2 == 0) else x + 1 delta = map(nexteven, diff(reshape(array.shape))) newsize = tuple(x[0] + x[1] for x in zip(array.shape, delta)) self.raw_fourier = zeropad(array, newsize) self.update_image(self.raw_fourier, self.scale_factor) #self.fourier_updated.emit(self.raw_fourier.copy()) self.emit_fourier() def draw_mask_on_fourier(self, mask, value=0x00): self.raw_fourier[mask] = 2**value self.update_image(self.raw_fourier, self.scale_factor) self.emit_fourier() def regen_image(self): self.update_image(self.raw_fourier, self.scale_factor) def paintEvent(self, event): """ Paint widget as self.image content """ if self.image is None: super().paintEvent(event) return painter = QPainter(self) rect = event.rect() painter.drawImage(rect.topLeft(), self.image, rect) def mousePressEvent(self, event): self.pressed = True self.draw_buffer = QPixmap(self.image.size()) color = self.color.red() ^ 0xAA self.draw_buffer.fill(QColor(color, color, color)) self.draw(event) def mouseReleaseEvent(self, event): self.pressed = False self.draw(event) self.fourier_draw() def mouseMoveEvent(self, event): if self.pressed: self.draw(event) def fourier_draw(self): arr = image_to_array(self.draw_buffer.toImage()) values = arr[arr == self.color.red()] * (self.scale_factor / 255) self.raw_fourier[arr == self.color.red()] = np.abs(2**values) self.emit_fourier() def _paint(self, painter, x, y): size = self.cursor_size shape = self.shape painter.setBrush(self.color) painter.setPen(Qt.NoPen) if shape == 'circle': painter.drawEllipse(x, y, size - 1, size - 1) elif shape == 'square': painter.drawRect(x, y, size - 1, size - 1) elif shape == "magic wand": magic_wand.render(painter, QRect(0, 0, 20, 20)) def draw(self, event): x, y = event.x(), event.y() max_y, max_x = self.raw_fourier.shape for painter in map(QPainter, [self.image, self.draw_buffer]): self._paint(painter, x, y) if self.x_sym: self._paint(painter, abs(max_x - x - self.cursor_size), y) if self.y_sym: self._paint(painter, x, abs(max_y - y - self.cursor_size)) if (self.x_sym and self.y_sym) or self.opp_sym: self._paint(painter, abs(max_x - x - self.cursor_size), abs(max_y - y - self.cursor_size)) del painter self.update() def sizeHint(self): if not self.image: return super().minimumSizeHint() return self.image.size() def on_y_toggle(self, y_state): self.y_sym = y_state def on_x_toggle(self, x_state): self.x_sym = x_state def on_opp_toggle(self, opp_state): self.opp_sym = opp_state
class CustomCBLabel(CustomLabel): _pen_text = QPen(QColor(240, 240, 240, 250), 1, qc.Qt.SolidLine) _fontMargin = 2 def __init__(self, *args, **kwargs): super(CustomCBLabel, self).__init__(*args, **kwargs)
class DT_Checkbox(QtGui.QCheckBox): _glow_pens = {} for index in range(1, 11): _glow_pens[index] = [ QPen(QColor(0, 255, 0, 12 * index), 1, QtCore.Qt.SolidLine), QPen(QColor(0, 255, 0, 5 * index), 3, QtCore.Qt.SolidLine), QPen(QColor(0, 255, 0, 2 * index), 5, QtCore.Qt.SolidLine), QPen(QColor(0, 255, 0, 25.5 * index), 1, QtCore.Qt.SolidLine) ] _pens_text = QPen(QColor(207, 207, 210), 1, QtCore.Qt.SolidLine) _pens_shadow = QPen(QColor(9, 10, 12), 1, QtCore.Qt.SolidLine) _pens_border = QPen(QColor(9, 10, 12), 2, QtCore.Qt.SolidLine) _pens_clear = QPen(QColor(0, 0, 0, 0), 1, QtCore.Qt.SolidLine) _pens_text_disabled = QPen(QColor(102, 107, 110), 1, QtCore.Qt.SolidLine) _pens_shadow_disabled = QPen(QColor(0, 0, 0), 1, QtCore.Qt.SolidLine) _brush_clear = QBrush(QColor(0, 0, 0, 0)) _brush_border = QBrush(QColor(9, 10, 12)) _glow_brushes = {} for index in range(1, 11): _glow_brushes[index] = [ QBrush(QColor(0, 255, 0, 1 * index)), QBrush(QColor(0, 255, 0, 3 * index)), QBrush(QColor(0, 255, 0, 15 * index)), QBrush(QColor(0, 255, 0, 25.5 * index)) ] _disabled_glow_brushes = {} for index in range(1, 11): _disabled_glow_brushes[index] = [ QBrush(QColor(125, 125, 125, 1 * index)), QBrush(QColor(125, 125, 125, 3 * index)), QBrush(QColor(125, 125, 125, 15 * index)), QBrush(QColor(125, 125, 125, 25.5 * index)) ] def __init__(self, *args, **kwargs): QtGui.QCheckBox.__init__(self, *args, **kwargs) font = QtGui.QFont() font.setPointSize(8) font.setFamily('Calibri') self.setFont(font) self._hover = False self._glow_index = 0 self._anim_timer = QtCore.QTimer() self._anim_timer.timeout.connect(self._animateGlow) def paintEvent(self, event): painter = QtGui.QStylePainter(self) option = QtGui.QStyleOption() option.initFrom(self) x = option.rect.x() y = option.rect.y() height = option.rect.height() - 1 width = option.rect.width() - 1 painter.setRenderHint(QtGui.QPainter.Antialiasing) painter.setRenderHint(QtGui.QPainter.TextAntialiasing) font = self.font() text = self.text() alignment = (QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) painter.setPen(self._pens_border) painter.setBrush(self._brush_border) painter.drawRoundedRect(QtCore.QRect(x + 2, y + 2, 13, 13), 3, 3) if self.isEnabled(): painter.setPen(self._pens_shadow) painter.drawText(21, y + 2, width, height, alignment, text) painter.setPen(self._pens_text) painter.drawText(20, y + 1, width, height, alignment, text) else: painter.setPen(self._pens_shadow_disabled) painter.drawText(21, y + 2, width, height, alignment, text) painter.setPen(self._pens_text_disabled) painter.drawText(20, y + 1, width, height, alignment, text) painter.setPen(self._pens_clear) if self.isEnabled(): glow_brushes = self._glow_brushes else: glow_brushes = self._disabled_glow_brushes if self.checkState(): for index, pos, size, corner in zip(range(4), (2, 3, 4, 5), (13, 11, 9, 7), (4, 3, 3, 2)): painter.setBrush(glow_brushes[10][index]) painter.drawRoundedRect( QtCore.QRect(x + pos, y + pos, size, size), corner, corner) glow_index = self._glow_index if glow_index > 0: for index, pos, size, corner in zip(range(4), (3, 4, 5, 6), (11, 9, 7, 5), (3, 3, 2, 2)): painter.setBrush(glow_brushes[glow_index][index]) painter.drawRoundedRect( QtCore.QRect(x + pos, y + pos, size, size), corner, corner) def enterEvent(self, event): if not self.isEnabled(): return self._hover = True self._startAnim() def leaveEvent(self, event): if not self.isEnabled(): return self._hover = False self._startAnim() def _animateGlow(self): if self._hover: if self._glow_index >= 10: self._glow_index = 10 self._anim_timer.stop() else: self._glow_index += 1 else: if self._glow_index <= 0: self._glow_index = 0 self._anim_timer.stop() else: self._glow_index -= 1 utils.executeDeferred(self.update) def _startAnim(self): if self._anim_timer.isActive(): return self._anim_timer.start(20)
def testReduceEmpty(self): self.reduceColor(QColor())
def setUp(self): self.original = QColor.fromHsvF(0.2, 0.3, 0.4, 0.5)
def setUp(self): self.original = QColor.fromCmykF(0.2, 0.3, 0.4, 0.5, 0.6)
def change_intensity(color, fac): rgb = [color.red(), color.green(), color.blue()] for i, intensity in enumerate(rgb): rgb[i] = min(int(round(intensity * fac, 0)), 255) return QColor(*rgb)
from PySide.QtGui import QColor CONDITIONAL_TRANSITION_COLOR = QColor(90, 50, 50) NON_CONDITIONAL_TRANSITION_COLOR = QColor(50, 90, 50)
# coding: utf8 # lang.py # 11/10/2012 jichi from PySide.QtCore import Qt, QRegExp from PySide.QtGui import QColor, QFont, QTextCharFormat from Qt5.QtWidgets import QSyntaxHighlighter HLS_COMMENT_COLOR = Qt.darkGreen HLS_PRAGMA_COLOR = QColor('purple') HLS_LITERAL_COLOR = Qt.red HLS_KEYWORD_COLOR = Qt.darkBlue HLS_FUNCTION_COLOR = Qt.blue HLS_CLASS_COLOR = Qt.darkMagenta HLS_TYPE_COLOR = Qt.darkYellow HLS_TODO_COLOR = Qt.yellow HLS_DOXY_PATTERNS = ( r"@param\b", r"@return\b", ) HLS_TODO_PATTERNS = ( r"\bXXX\b", r"\bTODO\b", r"\bFIXME\b", ) # See: http://qt.gitorious.org/pyside/pyside-examples class CppHighlighter(QSyntaxHighlighter):
def category_colors(i: int): c = QColor(zone_colors[i % len(zone_colors)]) return c
# Open the text finder if event.key() == Qt.Key_F and event.modifiers() == Qt.ControlModifier: customKey = True print("Opening finder...") if not customKey: QPlainTextEdit.keyPressEvent(self, event) def initUI(self): pass # Create the font styles that will highlight the code keywordFormat = QTextCharFormat() keywordFormat.setForeground(QColor('blue')) operatorFormat = QTextCharFormat() operatorFormat.setForeground(QColor('red')) braceFormat = QTextCharFormat() braceFormat.setForeground(QColor('darkGray')) defClassFormat = QTextCharFormat() defClassFormat.setForeground(QColor('black')) stringFormat = QTextCharFormat() stringFormat.setForeground(QColor('magenta')) string2Format = QTextCharFormat() string2Format.setForeground(QColor('darkMagenta')) commentFormat = QTextCharFormat() commentFormat.setForeground(QColor('darkGreen')) commentFormat.setFontItalic(True) selfFormat = QTextCharFormat() selfFormat.setForeground(QColor('purple'))
def __init__(self, parent=None, filePath=''): """ Default class constructor. :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_ :param `filePath`: Filepath to open in the text editor. :type `filePath`: str """ super(MDISubWindow_TextEdit, self).__init__(parent) qDebug(filePath) self.filePath = filePath self.fileName = os.path.basename(os.path.abspath(filePath)) self.fileExt = os.path.splitext(self.fileName)[1] if not filePath: self.setWindowTitle('Untitled[*]') parent.setWindowIcon(QIcon(gIconDir + os.sep + 'new.png')) else: f = open(filePath, 'r') txt = f.read() f.close() self.setText(txt) self.setWindowTitle('%s[*]' % self.fileName) # TODO: This is changing all the subwindows icons. We want individual icons based on filetype...? if self.fileExt in ('.py', '.pyw'): parent.setWindowIcon(QIcon(gIconDir + os.sep + 'pyscript.png')) else: parent.setWindowIcon(QIcon(gIconDir + os.sep + 'new.png')) monoFont = QFont('Courier New') monoFont.setFixedPitch(True) self.setFont(monoFont) self.setWordWrapMode(QTextOption.NoWrap) ## self.setTextBackgroundColor(QColor('#000000')) ## self.setTextColor(QColor('#FFFFFF')) self.setCursorWidth(2) self.CreateActions() self.zoomLevel = 0 gMainWin.action_Edit_Cut.setEnabled(False) gMainWin.action_Edit_Copy.setEnabled(False) self.copyAvailable.connect(gMainWin.action_Edit_Cut.setEnabled) self.copyAvailable.connect(gMainWin.action_Edit_Copy.setEnabled) # Handle the Context Menu Entries Also. self.action_Edit_Undo.setEnabled(False) self.action_Edit_Redo.setEnabled(False) self.action_Edit_Cut.setEnabled(False) self.action_Edit_Copy.setEnabled(False) self.undoAvailable.connect(self.action_Edit_Undo.setEnabled) self.redoAvailable.connect(self.action_Edit_Redo.setEnabled) self.copyAvailable.connect(self.action_Edit_Cut.setEnabled) self.copyAvailable.connect(self.action_Edit_Copy.setEnabled) self.document().contentsChanged.connect(self.TheDocumentWasModified) # self.show() # self.showMaximized() # self.setFocusPolicy(Qt.WheelFocus) ##### self.setFocus() # This makes the MDIArea go into SubWindowView...? self.gCornerWidget = QToolButton(self) # self.gCornerWidgetToolTip = QToolTip() QToolTip.setFont(QFont('SansSerif', 10)) br = QBrush(QPixmap(gImgDir + os.sep + 'texture-spirals.png')) pal = QPalette() # pal.setBrush(QPalette.Active, QPalette.Base, br) # pal.setColor(QPalette.Background, QColor('#FF8000')) pal.setColor(QPalette.ColorGroup.Inactive, QPalette.ColorRole.ToolTipBase, QColor(EMBROIDERBLUE2)) QToolTip.setPalette(QPalette(pal)) self.action_Edit_SelectAll.setToolTip( 'This is a <b>QWidget</b> widget') self.gCornerWidget.setDefaultAction(self.action_Edit_SelectAll) self.setCornerWidget(self.gCornerWidget) # We want to show the corner widget no matter what so... self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
def DWM_colorization_color(): """ Returns the current colorization color for the window. """ color = _DwmGetColorizationColor() return QColor(color)
def _add_table(self, tab, cursor): tab_fmt = QTextTableFormat() tab_fmt.setCellSpacing(0) tab_fmt.setCellPadding(3) border = tab.border if border: tab_fmt.setBorderStyle(QTextFrameFormat.BorderStyle_Solid) else: tab_fmt.setBorderStyle(QTextFrameFormat.BorderStyle_None) cursor.insertTable(tab.rows(), tab.cols(), tab_fmt) table = cursor.currentTable() with edit_block(cursor): bc = QColor( self.factory.bg_color) if self.factory.bg_color else None ec, oc, hc = bc, bc, bc if self.factory.even_color: ec = QColor(self.factory.even_color) if self.factory.odd_color: oc = QColor(self.factory.odd_color) if self.factory.header_color: hc = QColor(self.factory.header_color) cell_fmt = QTextTableCellFormat() cell_fmt.setFontPointSize(10) css = '''font-size:{}px;'''.format(10) self.control.setStyleSheet(css) max_cols = max([len(row.cells) for row in tab.items]) for ri, row in enumerate(tab.items): c = bc if row.color: c = QColor(row.color) elif ri == 0: c = hc else: if (ri - 1) % 2 == 0: c = ec else: c = oc if c: cell_fmt.setBackground(c) span_offset = 0 for ci, cell in enumerate(row.cells): if cell.bg_color: cell_fmt.setBackground(QColor(cell.bg_color)) if cell.bold: cell_fmt.setFontWeight(QFont.Bold) else: cell_fmt.setFontWeight(QFont.Normal) cs = cell.col_span if cs: if cs == -1: cs = max_cols table.mergeCells(ri, ci, 1, cs) tcell = table.cellAt(ri, ci + span_offset) cur = tcell.firstCursorPosition() if hasattr(cell, 'html'): cur.insertHtml('{}'.format(cell.html)) else: tcell.setFormat(cell_fmt) cur.insertText(cell.text) if cs: span_offset = cs
def update(self): """" Mise a jour de l'image. """ if self.__first: self.__first = False self.__map_data = self.__gui_handler.get_map_data() self.__next_data = self.__gui_handler.get_entities() labels = [] # Découverte du terrain for terrain in SimUtils.get_terrains(): self.__terrain.append(terrain.color) labels.append(StatItem(terrain.name, "", terrain.color)) # Tri lexicographique des labels. labels.sort(key=lambda stat: stat._name) # Ajout des labels de terrain for label in labels: self.__gui_handler.add_stat(label) # Remplissage de la carte avec les terrains. for i in range(0, self.__width): for j in range(0, self.__height): # Affichage du point. color = QColor(self.__terrain[self.__map_data.get_terrain_type(i,j)]) self.__image.setPixel(i,j,color.rgb()) # Permet de faire le tri entre les entités déjà rencontrées et les # autres. entity_types = {} # Liste des futurs labels labels = [] # Découverte des entités - affectation des couleurs for entity in self.__next_data: # Ajout des labels de couleur pour les entités if not entity_types.has_key(entity.__name__): entity_types[entity.__name__] = True for label, color in entity._labels.iteritems(): labels.append(StatItem(label, "", color)) # Affichage de l'entité. self.__image.setPixel(entity._x, entity._y, QColor(entity._color).rgb()) self.positions[id(entity)] = [entity._x, entity._y] # Tri lexicographique des labels. labels.sort(key=lambda stat: stat._name) for label in labels: self.__gui_handler.add_stat(label) else: # Mise à jour du rendu for entity in self.__next_data: # Cas d'une entité désactivée (morte) remove_entity = not entity._is_active() if id(entity) not in self.positions: # Ajout de l'entité en cours de simulation self.__image.setPixel(entity._x, entity._y, QColor(entity._color).rgb()) self.positions[id(entity)] = [entity._x,entity._y] # Le simulateur demande de repeindre l'entité old_points = self.positions[id(entity)] if not remove_entity: self.positions[id(entity)] = [entity._x, entity._y] # On remet la couleur du terrain. color = QColor(self.__terrain[self.__map_data.get_terrain_type(old_points[0], old_points[1])]) self.__image.setPixel(old_points[0], old_points[1], color.rgb()) if not remove_entity: # Ajout des paramètres de setPixel dans une liste pour être ploté après. self.__image.setPixel(entity._x, entity._y, QColor(entity._color).rgb())
def mousePressEvent(self, event): self.pressed = True self.draw_buffer = QPixmap(self.image.size()) color = self.color.red() ^ 0xAA self.draw_buffer.fill(QColor(color, color, color)) self.draw(event)
def testReduceRGB(self): self.reduceColor(QColor.fromRgbF(0.1, 0.2, 0.3, 0.4))
def on_color_change(self, color): self.color = QColor(color, color, color)
def setUp(self): self.original = QColor("red")
from datamanagement.dataset import DataSet from services.dataservice import DataService from simulationworkbench.widgets.sortedtablewidgetitem import SortedTableWidgetItem from simulationworkbench.widgets.Ui_tablewidget_v1 import Ui_TableWidget from simulationworkbench.widgets.abstractviewcontroller import AbstractViewController ORIENTATION_HORIZONTAL = "orientation_horizontal" ORIENTATION_VERTICAL = "orienation_vertical" DEFAULT_SHOW_UNITS = True MODE_DEFAULT = "mode_default" MODE_SUBCONDITIONS = "mode_subconditions" MODE_JACOBIAN = "mode_jacobian" COLOR_HIGH = QColor(50, 200, 50, 200) # medium green COLOR_MEDIUM = QColor(50, 200, 50, 50) # light green COLOR_LOW = QColor(200, 50, 50, 100) # light red class TableWidgetController(AbstractViewController, Ui_TableWidget): """ The controller part for a data table widget. The UI part is declared in tablewidget_v1.ui and then converted to ui_tablewidget.py. This widget can be fed tabular data and has several options for showing it. @since: 2010-11-10 """ __author__ = "Moritz Wade" __contact__ = "*****@*****.**"
def testReduceCMYK(self): self.reduceColor(QColor.fromCmykF(0.1, 0.2, 0.3, 0.4, 0.5))