Пример #1
0
    def OnColorPicked(self):
        """
        Event to call color picker
        """

        dialog = QColorDialog(self.color_swatch.qcolor, self)
        if dialog.exec_():
            self.color_swatch.setPalette(QPalette(dialog.currentColor()))
            self.color_swatch.qcolor = dialog.currentColor()
            self.color_swatch._update()
            self.OnValueUpdated()
Пример #2
0
 def onChangeColor(self, label=False):
     res = QColorDialog.getColor(self.color, None, 'Node color setup')
     if res.isValid():
         res.setAlpha(80)
         self.color = res
         if label:
             self.update()
Пример #3
0
 def onChangeColor(self):
     res = QColorDialog.getColor(self.color, None, 'Comment node color setup')
     if res.isValid():
         res.setAlpha(80)
         self.color = res
         self.label().color = res
         self.update()
         self.label().update()
Пример #4
0
    def ui(self):
        if dcc.get_version() <= 2016:
            self.main_layout = self.get_main_layout()
            self.setLayout(self.main_layout)

            self.color_dialog = QColorDialog(parent=self)
            self.color_dialog.setWindowFlags(Qt.Widget)
            self.color_dialog.setOptions(QColorDialog.DontUseNativeDialog
                                         | QColorDialog.NoButtons)
            self.main_layout.addWidget(self.color_dialog)

            bottom_layout = layouts.HorizontalLayout()
            bottom_layout.setAlignment(Qt.AlignRight)
            self.main_layout.addLayout(bottom_layout)

            self.ok_btn = QPushButton('Ok')
            self.cancel_btn = QPushButton('Cancel')
            bottom_layout.addLayout(dividers.DividerLayout())
            bottom_layout.addWidget(self.ok_btn)
            bottom_layout.addWidget(self.cancel_btn)

        else:
            super(MayaColorDialog, self).ui()
Пример #5
0
class MayaColorDialog(dialog.BaseColorDialog):
    def __init__(self, name='MayaColorDialog', parent=None, **kwargs):
        super(MayaColorDialog, self).__init__(name=name,
                                              parent=parent,
                                              **kwargs)

    def ui(self):
        if dcc.get_version() <= 2016:
            self.main_layout = self.get_main_layout()
            self.setLayout(self.main_layout)

            self.color_dialog = QColorDialog(parent=self)
            self.color_dialog.setWindowFlags(Qt.Widget)
            self.color_dialog.setOptions(QColorDialog.DontUseNativeDialog
                                         | QColorDialog.NoButtons)
            self.main_layout.addWidget(self.color_dialog)

            bottom_layout = layouts.HorizontalLayout()
            bottom_layout.setAlignment(Qt.AlignRight)
            self.main_layout.addLayout(bottom_layout)

            self.ok_btn = QPushButton('Ok')
            self.cancel_btn = QPushButton('Cancel')
            bottom_layout.addLayout(dividers.DividerLayout())
            bottom_layout.addWidget(self.ok_btn)
            bottom_layout.addWidget(self.cancel_btn)

        else:
            super(MayaColorDialog, self).ui()

    def setup_signals(self):
        if dcc.get_version() <= 2016:
            pass
        else:
            super(MayaColorDialog, self).setup_signals()

    def _on_set_color(self, color_index):
        if dcc.get_version() <= 2016:
            self.color_dialog.setCurrentColor(
                QColor.fromRgb(self.maya_colors[color_index][0] * 255,
                               self.maya_colors[color_index][1] * 255,
                               self.maya_colors[color_index][2] * 255))
        else:
            super(MayaColorDialog, self)._on_set_color()

    def _on_ok_btn(self):
        if dcc.get_version() <= 2016:
            self.close()
        else:
            super(MayaColorDialog, self)._on_ok_btn()