Пример #1
0
    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())
Пример #2
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()
Пример #3
0
 def set_colour(event):
     dialog = QColorDialog()
     colour = dialog.getColor(
         Qt.white,
         self,
     )
     if colour.isValid():
         colour_field.setText(colour.name())
Пример #4
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)
Пример #5
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()
Пример #6
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)
Пример #7
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)
Пример #8
0
 def __change_color(self) -> None:
     """
     Displays the color chooser dialog to select a new color, then updates this widget
     """
     dlg = QColorDialog(self.color)
     if dlg.exec_():
         self.color = self.closest_color(dlg.currentColor().name())
         self.btn.setText(self.color.upper())
         self.update_bg()
Пример #9
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)
Пример #10
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
Пример #11
0
    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
Пример #12
0
 def open_dialog(self):
     color = QColorDialog().getColor(
         parent=self.ui,
         title='Selecione uma cor',
         initial=self.last_color,
     )
     if color.isValid():
         self.last_color = color
         palette = self.label.palette()
         palette.setColor(QPalette.Background, color)
         self.label.setPalette(palette)
Пример #13
0
    def initColorPicker(self):
        self.lColorPicker = QVBoxLayout()
        self.cdColorPicker = QColorDialog()
        self.cdColorPicker.setOption(self.cdColorPicker.NoButtons, True)
        self.colorSelected = self.cdColorPicker.currentColor()

        self.lColorPicker.addWidget(self.cdColorPicker)
        self.cdColorPicker.setVisible(False)
        self.cdColorPicker.currentColorChanged.connect(self.colorChanged)

        self.windowLayout.addLayout(self.lColorPicker)
Пример #14
0
    def pick_line_color(self):
        sender = self.sender()
        color = sender.text()

        dialog = QColorDialog(QColor(color), self.ui)
        if dialog.exec_():
            sender.setText(dialog.selectedColor().name())
            lc = self.ui.line_color
            lc.setStyleSheet('QPushButton {background-color: %s}' % lc.text())
            self.outline_color = dialog.selectedColor().name()
            self.update_template_style()
Пример #15
0
    def pick_color(self):
        # This should only be called by signals/slots
        # It uses the sender() to get the button that called it
        sender = self.sender()
        color = sender.text()

        dialog = QColorDialog(QColor(color), self.ui)
        if dialog.exec_():
            sender.setText(dialog.selectedColor().name())
            self.update_button_colors()
            self.update_config()
Пример #16
0
    def colorSlot2(self, value):
        if self.scene.getNumSelectedMaterials() != 1:
            return

        for mat in self.scene.getSelectedMaterialIterator():
            colorDialog = QColorDialog(parent=self)
            color = colorDialog.getColor(options=QColorDialog.ShowAlphaChannel)
            if color.isValid() and type(mat) == SpecularMaterial:
                mat.setTransmissionColor(
                    QVector4D(color.redF(), color.greenF(), color.blueF(),
                              color.alphaF()))
                self.setupSpecularMaterial(mat)
            return
Пример #17
0
    def _set_accent_color(self):
        color_btn_hex = webcolors.hex_to_rgb(self.accent_color_le.text())
        accent_color = QColor(color_btn_hex.red, color_btn_hex.green,
                              color_btn_hex.blue)

        dialog = QColorDialog()
        dialog.setCurrentColor(accent_color)
        color = dialog.getColor(accent_color, self, "Select Accent Color")
        if color.isValid():
            hex_color = webcolors.rgb_to_hex(
                (color.red(), color.green(), color.blue())).upper()
            self.accent_color_le.setText(hex_color)
            self.accent_color_btn.setIcon(
                qta.icon('fa5s.brush', color=hex_color))
 def changeTabColor():
     layer_name = self._layers[layer_key_name][LayerKeys.NAME]
     color_dialog = QColorDialog()
     color = color_dialog.getColor()
     if color.isValid():
         hex_color = color.name()
         self._layers[layer_key_name][LayerKeys.TAB_COLOR] = hex_color
         index = self.getLayerIndex(layer_name)
         self._layer_tabs.setCurrentIndex(index)
         self._layer_tabs.setStyleSheet('''
             QTabBar::tab {{}}
             QTabBar::tab:selected {{background-color: {color}; border: 1px solid #777777; border-radius: 4px;}}
         '''.format(
             color=self._layers[layer_key_name][LayerKeys.TAB_COLOR]))
Пример #19
0
    def __init__(self, title: str, parent=None):
        super().__init__(parent)
        self.__color_picker = QColorDialog(self)
        self.__color_picker.setOption(QColorDialog.ColorDialogOption.DontUseNativeDialog)
        self.__color_picker.setOption(QColorDialog.ColorDialogOption.NoButtons)
        self.__color_picker.setWindowFlags(Qt.Widget)

        self.__group_box = QGroupBox(title)
        self.__group_box_layout = QVBoxLayout()
        self.__group_box_layout.addWidget(self.__color_picker)
        self.__group_box.setLayout(self.__group_box_layout)
        self.__group_box_layout.setStretch(1, 1)

        self.__main_layout = QVBoxLayout(self)
        self.__main_layout.addWidget(self.__group_box)
Пример #20
0
    def _select_color(self, item):
        if not isinstance(item, QTableWidgetItem):
            raise ValueError

        if item.text() != "":
            return

        color = QColorDialog().getColor()
        if not color.isValid():
            item.setSelected(False)
            return

        item.setBackgroundColor(color)
        item.setSelected(False)

        self._update_image_data()
Пример #21
0
    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)
Пример #22
0
 def chooseFontBackgroundColor(self):
     """
     Selecione a cor de fundo do texto
     """
     cor = QColorDialog.getColor()
     if cor.isValid():
         self.tedit.setTextBackgroundColor(cor)
Пример #23
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)
 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)
Пример #25
0
    def showDialog(self):
      
        col = QColorDialog.getColor()

        if col.isValid():
            self.frm.setStyleSheet("QWidget { background-color: %s }"
                % col.name())
Пример #26
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()
Пример #27
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())
Пример #28
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())
Пример #29
0
    def onRemoveBackgroud(self):
        box = QMessageBox()
        box.setText("Selecione a cor do background")
        box.setIcon(QMessageBox.Information)
        box.exec()
        diag = QColorDialog()
        backColor = diag.getColor()

        final = self.getBackground()
        b = self.__img[:, :, 0]
        g = self.__img[:, :, 1]
        r = self.__img[:, :, 2]
        b[final] = backColor.blue()
        g[final] = backColor.green()
        r[final] = backColor.red()

        self.open_image(self.__img)
Пример #30
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)))
Пример #31
0
 def boxClicked(self):
     dialog = QColorDialog()
     if dialog.exec_():
         self.setColorText(dialog.selectedColor().name())