Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
    def ui(self):
        super(ExpandablePanel, self).ui()

        widget_palette = QPalette()
        widget_palette.setColor(QPalette.Background, QColor.fromRgb(60, 60, 60))

        self.setAutoFillBackground(True)
        self.setPalette(widget_palette)

        frame = QFrame()
        frame.setFrameShape(QFrame.StyledPanel)
        frame.setFrameShadow(QFrame.Sunken)
        self.main_layout.addWidget(frame)

        main_layout = layouts.VerticalLayout(spacing=0, margins=(2, 2, 2, 2), parent=frame)
        main_layout.setAlignment(Qt.AlignTop)

        self._header_area = QWidget()
        self._header_area.setMinimumHeight(20)
        self._widget_area = QWidget()
        self._widget_area.setAutoFillBackground(True)
        self._widget_area.setPalette(widget_palette)

        self._header_text_label = dividers.Divider(self._header_text)

        self._widget_layout = layouts.VerticalLayout(spacing=5)
        self._widget_layout.setMargin(5)
        self._widget_area.setLayout(self._widget_layout)

        header_layout = layouts.HorizontalLayout(margins=(0, 0, 0, 0))
        header_layout.addWidget(self._icon)
        header_layout.addWidget(self._header_text_label)
        self._header_area.setLayout(header_layout)

        main_layout.addWidget(self._header_area)
        main_layout.addWidget(self._widget_area)

        self._icon.clicked.connect(self.change_state)
Exemplo n.º 3
0
import re
from Qt.QtGui import QSyntaxHighlighter, QColor

PINK = QColor.fromRgb(255, 150, 230)
DEFAULT_STYLE = {
    "function": QColor.fromRgb(0xD83726),
    "comment": QColor.fromRgb(0xBD8C78),
    "keyword": QColor.fromRgb(0xB48800),
    "string": QColor.fromRgb(0x288911),
    "litstring": QColor.fromRgb(0x288911),
    "support": QColor.fromRgb(0xC37B21),
    "number": QColor.fromRgb(0x3D80A0),
    "operator": QColor.fromRgb(0x3D80A0),
    "bool": QColor.fromRgb(0x3D80A0),
}
DEFAULT_RULES = [
    ("function", re.compile(r"def ([a-zA-Z_][a-zA-Z0-9_]*)\b")),
    ("operator", re.compile(r"(\+\=|\-\=|\/\=|\*\=|\%\=|\=|\+|\-|\%|\*|\/)")),
    ("support",
     re.compile(
         r"\b(self|super|__name__|__file__|__init__|__add__|__sub__|__str__|len|abs|min|max|range|any|all|lambda|int|float|str|bytes|dict|set|list|next)\b"
     )),
    ("keyword",
     re.compile(
         r"\b(for|in|if|elif|else|while|continue|break|def|class|return|import|from|with|as)\b"
     )),
    ("number",
     re.compile(r"\b((?:0x[0-9a-fA-F]+)|(?:[0-9]+)(?:\.[0-9]*)?)\b")),
    ("bool", re.compile(r"\b(True|False)\b")),
    ("string", re.compile(r"(?:[^\\]|r?)(\"[^\"]*(?<!\\)\")")),
    ("litstring", re.compile(r"(?:[^\\]|r?)(\'[^\']*\')")),