示例#1
0
 def set_color_for(self, prop):
     if self.obj.properties[prop] is not None:
         qcolor = QColorDialog.getColor(QColor(*self.obj.properties[prop]))
     else:
         qcolor = QColorDialog.getColor()
     self.obj.set_property(
         prop, [qcolor.red(), qcolor.green(),
                qcolor.blue()])
     self.parent.affichage.update_screen()
示例#2
0
 def set_color(self):
     """
     This function changes color of drcoved bbs and reflects
     the change to gui.
     """
     self.config['color'] = QColorDialog.getColor().rgb()
     self.paint()
示例#3
0
    def showDialog(self):
      
        col = QColorDialog.getColor()

        if col.isValid():
            self.frm.setStyleSheet("QWidget { background-color: %s }"
                % col.name())
示例#4
0
 def select_node_color_clicked(self):
     self.node_color = QColorDialog.getColor(
         self.node_color,
         title='Select node color. Don\'t use too dark '
         'colors.')
     ss = 'background-color: ' + self.node_color.name()
     self.ui.color_sample_pushButton.setStyleSheet(ss)
示例#5
0
 def chooseFontBackgroundColor(self):
     """
     Selecione a cor de fundo do texto
     """
     cor = QColorDialog.getColor()
     if cor.isValid():
         self.tedit.setTextBackgroundColor(cor)
示例#6
0
 def change_colour(self):
     if self.colour_set:
         dialog = QColorDialog()
         colour = dialog.getColor(Qt.white, self, )
         if colour.isValid():
             self.set_colour(colour)
             self._layer._colour = colour.name()
 def onClicked(self):
     self.currentColor = QColorDialog.getColor(
         self.currentColor, self, 'Select color',
         QColorDialog.ColorDialogOption.DontUseNativeDialog)
     contrastValue = self.contrastCalc(self.currentColor)
     self.updateColorLabel(self.currentColor)
     self.updateInfoLabel(contrastValue)
    def do_mouseDoubleClick(self, point):  ##鼠标双击
        pt = self.__view.mapToScene(point)  # 转换到Scene坐标,QPointF
        item = self.__scene.itemAt(pt, self.__view.transform())  # 获取光标下的绘图项
        if item is None:
            return

        className = str(type(item))  # 将类名称转换为字符串

        if className.find("QGraphicsRectItem") >= 0:  # 矩形框
            self.__setBrushColor(item)
        elif className.find(
                "QGraphicsEllipseItem") >= 0:  # 椭圆和圆都是 QGraphicsEllipseItem
            self.__setBrushColor(item)
        elif className.find("QGraphicsPolygonItem") >= 0:  # 梯形和三角形
            self.__setBrushColor(item)
        elif className.find("QGraphicsLineItem") >= 0:  # 直线,设置线条颜色
            pen = item.pen()
            color = item.pen().__color()
            color = QColorDialog.getColor(color, self, "选择线条颜色")
            if color.isValid():
                pen.setColor(color)
                item.setPen(pen)
        elif className.find("QGraphicsTextItem") >= 0:  # 文字,设置字体
            font = item.font()
            font, OK = QFontDialog.getFont(font)
            if OK:
                item.setFont(font)
示例#9
0
 def bg_color_dialog(self):
     """
     Pop up a color dialog for the background color.
     """
     color = QColorDialog.getColor(QColor(self.settings.background_color),
                                   parent=self)
     if color.isValid():
         self.ui.bgcolor_edit.setText(color.name())
示例#10
0
 def font_color_dialog(self):
     """
     Pop up a color dialog for the text color.
     """
     color = QColorDialog.getColor(QColor(self.settings.font_color),
                                   parent=self)
     if color.isValid():
         self.ui.textcolor_edit.setText(color.name())
示例#11
0
def set_font_color(text_item):
    font_color_dialog = QColorDialog()
    font_color = font_color_dialog.getColor(
        initial=text_item.defaultTextColor(

        ))
    if font_color.isValid():
        text_item.setDefaultTextColor(font_color)
示例#12
0
 def getShadowColor(self):
     color = QColorDialog.getColor()
     if color.isValid():
         self.shadowColor = color.name()
         self.shadowColorSelect.setText(self.shadowColor)
         self.shadowColorSelect.setStyleSheet(
             'background-color:%s;color:%s' %
             (self.shadowColor, self.colorReverse(self.shadowColor)))
示例#13
0
    def on_btn_select_brush_color(self):
        self.brush_color = QColorDialog.getColor()
        self.label_img.update_brush_color(self.brush_color)

        pe = QPalette()
        pe.setColor(QPalette.Window, self.brush_color)
        self.label_brush_color.setPalette(pe)
        self.label_brush_color.setAutoFillBackground(True)
示例#14
0
 def set_colour(event):
     dialog = QColorDialog()
     colour = dialog.getColor(
         Qt.white,
         self,
     )
     if colour.isValid():
         colour_field.setText(colour.name())
示例#15
0
def color_button_clicked():
    old = QtGui.QColor(dial_map[0].value(), dial_map[1].value(),
                       dial_map[2].value())
    c = QColorDialog.getColor(initial=old)

    if (c != old):
        dial_map[0].setValue(c.red())
        dial_map[1].setValue(c.green())
        dial_map[2].setValue(c.blue())
示例#16
0
 def changeFontColor(self):
     color_dialog = QColorDialog()
     color = color_dialog.getColor()
     hex_color = None
     if color.isValid():
         hex_color = color.name()
         self.font_color_button.setColor(hex_color)
         q_color = QColor(hex_color)
         self._parent.activeNotepad().setTextColor(q_color)
示例#17
0
 def changeHighlighterColor(self):
     color_dialog = QColorDialog()
     color = color_dialog.getColor()
     hex_color = None
     if color.isValid():
         hex_color = color.name()
         self.highlighter_button.setColor(hex_color)
         q_color = QColor(hex_color)
         self._parent.activeNotepad().setTextBackgroundColor(q_color)
示例#18
0
 def set_color(self):
     color_map = self.edit_controller._motion.label_color_map
     if color_map is not None:
         label = str(self.labelComboBox.currentText())
         if label in list(color_map.keys()):
             color = QColorDialog.getColor()
             color_map[label] = [color.redF(), color.greenF(), color.blueF()]
     self.edit_controller._motion.label_color_map = color_map
     self.init_label_time_line()
        def showColorPicker():
            logger.debug(qtbutton)
            c = QColorDialog.getColor()

            logger.debug(c.name())
            qtbutton.setStyleSheet("background-color:{};".format(c.name()))

            logger.debug(name)
            self.colors[str(name)] = c.name()
示例#20
0
class AliasLayout(QGridLayout):
    new_color = Signal(str)

    def __init__(self):
        super().__init__()

        self.alias_editor = QLineEdit()
        self.alias_editor.setMaxLength(32)
        # noinspection PyUnresolvedReferences
        self.alias_editor.returnPressed.connect(self.alias_editor.clearFocus)
        self.addWidget(QLabel('LN Node Alias'), column=1, column_span=1)
        self.addWidget(self.alias_editor,
                       column=2,
                       column_span=2,
                       same_row=True)

        self.addWidget(QLabel('LN Node Color'), column=1, column_span=1)
        self.color_label = QLabel()
        self.color_label.setAutoFillBackground(True)
        self.color_label.setFixedSize(10, 10)
        self.addWidget(self.color_label,
                       column_span=1,
                       column=2,
                       same_row=True)

        self.select_color_button = QPushButton('Select color')
        # noinspection PyUnresolvedReferences
        self.select_color_button.clicked.connect(self.select_color)
        self.addWidget(self.select_color_button,
                       column=3,
                       column_span=1,
                       same_row=True)

        self.color_dialog = QColorDialog(self.parentWidget())

    def select_color(self):
        color = self.color_dialog.getColor()
        if color.isValid():
            self.set_palette(color)
            self.color_dialog.setCurrentColor(color)
            # noinspection PyUnresolvedReferences
            self.new_color.emit(color.name())

    def set_alias(self, text: str):
        self.alias_editor.setText(text)

    def set_color(self, color_hex: str):
        color = QColor(color_hex)
        if color.isValid():
            self.set_palette(color)
            self.color_dialog.setCurrentColor(color)

    def set_palette(self, color: QColor):
        palette = self.color_label.palette()
        palette.setColor(QPalette.Background, color)
        self.color_label.setPalette(palette)
示例#21
0
 def colorSlot(self, value):
     if self.scene.getNumSelectedObjects() != 1:
         return
     
     for light in self.scene.getSelectedObjectIterator():
         colorDialog = QColorDialog(parent = self)
         color = colorDialog.getColor(options = QColorDialog.ShowAlphaChannel)
         if color.isValid():
             light.setColor(QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF()))
         return
示例#22
0
文件: color.py 项目: IvanKosik/vision
    def mouseDoubleClickEvent(self, event: QGraphicsSceneMouseEvent):
        super().mouseDoubleClickEvent(event)

        selected_color = QColorDialog.getColor(
            self.point.color,
            title='Select Point Color',
            options=QColorDialog.ColorDialogOptions()
            | QColorDialog.ShowAlphaChannel)
        if selected_color.isValid():
            self.point.color = selected_color
示例#23
0
 def set_color(self):
     """
     This function changes color of drcoved bbs and reflects
     the change to gui.
     """
     new_color = QColorDialog.getColor(QColor(self.config['color']))
     if not new_color.isValid():
         return
     self.config['color'] = new_color.rgb()
     self.paint()
示例#24
0
 def changeSkeletonColor(self, item):
     color = QColorDialog.getColor()
     print("set color")
     item.setBackground(color)
     sceneId = self.sceneObjectTableWidget.getSceneIdFromRow(item.row())
     sceneObject = self.app_manager.scene.getObject(sceneId)
     try:
         sceneObject.setColor([color.redF(), color.greenF(), color.blueF()])
     except:
         print("could not set color")
示例#25
0
 def pickColor(self):
     color = QColor()
     color.setRgbF(*self.parseColorHex(self.colorEditor.text()))
     color = QColorDialog.getColor(color,
                                   parent=self,
                                   title="Background Color",
                                   options=QColorDialog.ShowAlphaChannel)
     if not color.isValid():
         return
     self.updateColor(
         (color.redF(), color.greenF(), color.blueF(), color.alphaF()))
示例#26
0
    def choose_color(self):
        try:
            color = QColorDialog.getColor()
        except:
            print("No color selected!")

        if color.isValid() and self.current_category_index != -1:
            self.category_color_dic[self.current_category_id] = color
            item = self.ui.tableWidget_categories.item(
                self.current_category_index, 0)
            item.setBackground(
                QBrush(self.category_color_dic[self.current_category_id]))
示例#27
0
文件: doc.py 项目: yimuchens/doc
 def setBackgroundColor(self):
     color = QColorDialog.getColor(GlobalVars.CurrentBackgroundColor,
                                   self,
                                   title="选择背景颜色")
     GlobalVars.CurrentBackgroundColor = color
     if GlobalVars.CurrentDocument.SelBlocks:  # 处于选中状态
         for block in GlobalVars.CurrentDocument.SelBlocks:
             if hasattr(block, "setBackgroundColor"):
                 block.setBackgroundColor(color)
     else:
         if hasattr(GlobalVars.CurrentBlock, "setBackgroundColor"):
             GlobalVars.CurrentBlock.setBackgroundColor(color)
示例#28
0
文件: doc.py 项目: yimuchens/doc
 def setTextColor(self):
     color = QColorDialog.getColor(GlobalVars.CurrentTextColor,
                                   self,
                                   title="选择文字颜色")
     GlobalVars.CurrentTextColor = color
     if GlobalVars.CurrentDocument.SelBlocks:  # 处于选中状态 待优化,多个段落反复更新坐标降低性能
         for block in GlobalVars.CurrentDocument.SelBlocks:
             if hasattr(block, "setTextColor"):
                 block.setTextColor(color)
     else:
         if hasattr(GlobalVars.CurrentBlock, "setTextColor"):
             GlobalVars.CurrentBlock.setTextColor(color)
示例#29
0
    def show_color_dialog(self, checked=False):
        """Let user pick the bg color.

        Args:
            checked (boolean): Value emitted with clicked signal
        """
        # noinspection PyArgumentList
        color = QColorDialog.getColor(initial=self.bg_color)
        if not color.isValid():
            return  # Canceled
        self.bg_color = color
        self.update_bg_color()
示例#30
0
 def mousePressEvent(self, event):
     pos = event.pos()
     # check is we click to the color area
     x = pos.x()
     y = pos.y()
     if self._color_rect_min_y is not None and self._color_width is not None:
         if x > self._color_rect_min_x and x < self._color_rect_min_x + self._color_width and y > self._color_rect_min_y and y < self._color_rect_min_y + self._color_height:
             color = QColorDialog.getColor(initial=self.value)
             if color.isValid():
                 self.value = QColor(color.red(), color.green(),
                                     color.blue())
                 self.value_change()
                 self.repaint()