def __init__(self, document): QSyntaxHighlighter.__init__(self, document) # Multi-line strings (expression, flag, style) # FIXME: The triple-quotes in these two lines will mess up the # syntax highlighting from this point onward self.tri_single = (QRegExp("'''"), 1, STYLES['string2']) self.tri_double = (QRegExp('"""'), 2, STYLES['string2']) rules = [] # Keyword, operator, and brace rules rules += [(r'\b%s\b' % w, 0, STYLES['keyword']) for w in PythonHighlighter.keywords] rules += [(r'%s' % o, 0, STYLES['operator']) for o in PythonHighlighter.operators] rules += [(r'%s' % b, 0, STYLES['brace']) for b in PythonHighlighter.braces] rules += [(r'%s' % b, 0, STYLES['builtinFunction']) for b in dir(builtins)] # All other rules rules += [ # 'self' (r'\bself\b', 0, STYLES['self']), (r'\bsetData\b', 0, STYLES['dataAccess']), (r'\bgetData\b', 0, STYLES['dataAccess']), (r'\bsetClean\b', 0, STYLES['dataAccess']), (r'\bsetDirty\b', 0, STYLES['dataAccess']), (r'\bcurrentData\b', 0, STYLES['dataAccess']), # Double-quoted string, possibly containing escape sequences (r'"[^"\\]*(\\.[^"\\]*)*"', 0, STYLES['string']), # Single-quoted string, possibly containing escape sequences (r"'[^'\\]*(\\.[^'\\]*)*'", 0, STYLES['string']), # 'def' followed by an identifier (r'\bdef\b\s*(\w+)', 1, STYLES['defclass']), # 'class' followed by an identifier (r'\bclass\b\s*(\w+)', 1, STYLES['defclass']), # From '#' until a newline (r'#[^\n]*', 0, STYLES['comment']), # Numeric literals (r'\b[+-]?[0-9]+[lL]?\b', 0, STYLES['numbers']), (r'\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b', 0, STYLES['numbers']), (r'\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b', 0, STYLES['numbers']), ] # Build a QRegExp for each pattern self.rules = [(QRegExp(pat), index, fmt) for (pat, index, fmt) in rules]
def __init__(self, parent=None): super(Highlighter, self).__init__(parent) self.parent = parent self.__rules = [] self._numericFormat = QTextCharFormat() self._quotationFormat = QTextCharFormat() self._commentFormat = QTextCharFormat() # Quotes self._singleQuotes = QRegExp("'''") self._doubleQuotes = QRegExp('"""') # mel multi-line comment: /* */ self._melMLComStart = re.compile('/\\*') self._melMLComEnd = re.compile('\\*/')
def ui(self): super(ReplacerView, self).ui() replace_layout = layouts.HorizontalLayout(spacing=2, margins=(0, 0, 0, 0)) replace_layout.setAlignment(Qt.AlignLeft) self.main_layout.addLayout(replace_layout) self._find_replace_cbx = checkbox.BaseCheckBox(parent=self) replace_layout.addWidget(self._find_replace_cbx) self._replace_line = lineedit.BaseLineEdit(parent=self) self._replace_line.setPlaceholderText('Search') self._with_line = lineedit.BaseLineEdit(parent=self) self._with_line.setPlaceholderText('Replace') reg_ex = QRegExp("[a-zA-Z_0-9]+") text_validator = QRegExpValidator(reg_ex, self._replace_line) self._replace_line.setValidator(text_validator) self._with_line.setValidator(text_validator) self._search_replace_btn = buttons.BaseButton(parent=self) self._search_replace_btn.setIcon(resources.icon('find_replace')) replace_layout.addWidget(self._replace_line) replace_layout.addStretch() replace_layout.addWidget(self._with_line) replace_layout.addWidget(self._search_replace_btn) self._replace_line.setEnabled(False) self._with_line.setEnabled(False)
def connectWidgets(self, widgets): super(AttributeSystemWidget, self).connectWidgets(widgets) self.uiNameLINE.setValidator( QRegExpValidator(QRegExp('[A-Z][0-9a-zA-Z]+'), self.uiNameLINE)) self.uiAddBTN.clicked.connect(self.addDefinition) self.uiDeleteBTN.clicked.connect(self.deleteDefinition) self.uiUpBTN.clicked.connect(lambda: self.moveDefinition("up")) self.uiDownBTN.clicked.connect(lambda: self.moveDefinition("down")) self.uiAttributeLIST.currentItemChanged.connect(self.loadDefinition) self.uiTypeCBOX.currentIndexChanged.connect(self.refresh) # Connect self.uiNameLINE.editingFinished.connect(self.nameChanged) self.uiTypeCBOX.currentIndexChanged.connect(self.definitionChanged) self.uiBooleanValueCHK.clicked.connect(self.definitionChanged) self.uiFloatValueSPN.valueChanged.connect(self.definitionChanged) self.uiFloatMinSPN.valueChanged.connect(self.definitionChanged) self.uiFloatMaxSPN.valueChanged.connect(self.definitionChanged) self.uiFloatHasMinCHK.clicked.connect(self.definitionChanged) self.uiFloatHasMaxCHK.clicked.connect(self.definitionChanged) self.uiIntegerValueSPN.valueChanged.connect(self.definitionChanged) self.uiIntegerMinSPN.valueChanged.connect(self.definitionChanged) self.uiIntegerMaxSPN.valueChanged.connect(self.definitionChanged) self.uiIntegerHasMinCHK.clicked.connect(self.definitionChanged) self.uiIntegerHasMaxCHK.clicked.connect(self.definitionChanged) self.refresh()
def ui(self): super(RenamerView, self).ui() renamer_widget = QWidget() renamer_widget.setLayout( layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0))) renamer_widget.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self.main_layout.addWidget(renamer_widget) rename_layout = layouts.HorizontalLayout(spacing=2, margins=(0, 0, 0, 0)) rename_layout.setAlignment(Qt.AlignLeft) renamer_widget.layout().addLayout(rename_layout) self._base_name_cbx = checkbox.BaseCheckBox(parent=self) rename_layout.addWidget(self._base_name_cbx) self._renamer_line = lineedit.BaseLineEdit(parent=self) self._renamer_line.setPlaceholderText('New Name') rename_layout.addWidget(self._renamer_line) reg_ex = QRegExp("^(?!^_)[a-zA-Z_]+") text_validator = QRegExpValidator(reg_ex, self._renamer_line) self._renamer_line.setValidator(text_validator) self._renamer_btn = buttons.BaseButton(parent=self) self._renamer_btn.setIcon(resources.icon('rename')) rename_layout.addWidget(self._renamer_btn)
def __init__(self, document): super(PythonHighlighter, self).__init__(document) # Multi-line strings (expression, flag, style) # FIXME: The triple-quotes in these two lines will mess up the # syntax highlighting from this point onward self.tri_single = (QRegExp("'''"), 1, syntax_styles('string2')) self.tri_double = (QRegExp('"""'), 2, syntax_styles('string2')) rules = [] # Keyword, operator, and brace rules rules += [(r'\b%s\b' % w, 0, syntax_styles('keyword')) for w in PythonHighlighter.keywords] rules += [(r'%s' % o, 0, syntax_styles('operator')) for o in PythonHighlighter.operators] rules += [(r'%s' % b, 0, syntax_styles('brace')) for b in PythonHighlighter.braces] # All other rules rules += [ # 'self' (r'\bself\b', 0, syntax_styles('self')), # Double-quoted string, possibly containing escape sequences (r'"[^"\\]*(\\.[^"\\]*)*"', 0, syntax_styles('string')), # Single-quoted string, possibly containing escape sequences (r"'[^'\\]*(\\.[^'\\]*)*'", 0, syntax_styles('string')), # 'def' followed by an identifier # (r'\bdef\b\s*(\w+)', 0, syntax_styles('defclass')), # 'class' followed by an identifier # (r'\bclass\b\s*(\w+)', 0, syntax_styles('defclass')), # From '#' until a newline (r'#[^\n]*', 0, syntax_styles('comment')), # ('\\b\.[a-zA-Z_]+\\b(?=\()', 0, syntax_styles('bold')), # Numeric literals (r'\b[+-]?[0-9]+[lL]?\b', 0, syntax_styles('numbers')), (r'\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b', 0, syntax_styles('numbers')), (r'\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b', 0, syntax_styles('numbers')), ] # Build a QRegExp for each pattern self.rules = [(QRegExp(pat), index, fmt) for (pat, index, fmt) in rules]
def __init__(self, document, colors=None): super(PythonHiglighter, self).__init__(document) if colors: self._colors = colors else: self._colors = get_colors() self._tri_single = (QRegExp("'''"), 1, self.get_style(self._colors['docstring'])) self._tri_double = (QRegExp('"""'), 2, self.get_style(self._colors['docstring'])) rules = list() # rules += [(r".*", 0, self.get_style(self._colors['default'], False))] # Defaults rules += [('\\b%s\\b' % w, 0, self.get_style(self._colors['keywords'], True)) for w in Syntax['keywords']] # Keywords rules += [("\\b[A-Za-z0-9_]+(?=\\()", 0, self.get_style(self._colors['methods'], False))] # Methods rules += [ (r'[~!@$%^&*()-+=]', 0, self.get_style(self._colors['operator'])) ] # for o in pythonSyntax.syntax['operators']] # Operators rules += [(r'%s' % b, 0, self.get_style(self._colors['brace'])) for b in Syntax['braces']] # Braces rules += [("\\b%s\\b" % b, 0, self.get_style(self._colors['definition'], True)) for b in Syntax['definition']] # Definition rules += [("\\b%s\\b" % b, 0, self.get_style(self._colors['extra'])) for b in Syntax['extras']] # Extra # rules += [(r'#([.*]+|[^#]*)', 0, self.get_style(design.comment))] # Comment rules += [(r"\b[\d]+\b", 0, self.get_style(self._colors['digits'])) ] # Digits # ("(?:^|[^A-Za-z])([\d|\.]*\d+)", 0, self.get_style(design.digits)), rules += [(r'[ru]?"[^"\\]*(\\.[^"\\]*)*"', 0, self.get_style(self._colors['string'])) ] # Double-quoted string rules += [(r"[ru]?'[^'\\]*(\\.[^'\\]*)*'", 0, self.get_style(self._colors['string'])) ] # Single-quoted string self.rules = [(QRegExp(pat), index, fmt) for (pat, index, fmt) in rules]
def string_is_hex(color_str): """ Returns whether or not given string is a valid hexadecimal color :param color_str: str :return: bool """ if color_str.startswith('#'): color_str = color_str[1:] hex_regex1 = QRegExp('^[0-9A-F]{3}$', Qt.CaseInsensitive) hex_regex2 = QRegExp('^[0-9A-F]{6}$', Qt.CaseInsensitive) hex_regex3 = QRegExp('^[0-9A-F]{8}$', Qt.CaseInsensitive) if hex_regex1.exactMatch(color_str) or hex_regex2.exactMatch(color_str) or hex_regex3.exactMatch(color_str): return True return False
def __init__(self, document): QSyntaxHighlighter.__init__(self, document) self.comments = (QRegExp(r"/\*"), QRegExp(r"\*/"), 1, STYLES['string2']) rules = [] # Keyword, operator, and brace rules rules += [(r'\b%s\b' % w, 0, STYLES['keyword']) for w in MelHighlighter.keywords] rules += [(r'\b%s\b' % w, 0, STYLES['string2']) for w in MelHighlighter.keywords2] rules += [(r'%s' % o, 0, STYLES['operator']) for o in MelHighlighter.operators] rules += [(r'%s' % b, 0, STYLES['brace']) for b in MelHighlighter.braces] # All other rules # Build a QRegExp for each pattern rules += [ # Numeric literals (r'\b[+-]?[0-9]+[lL]?\b', 0, STYLES['numbers']), (r'\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b', 0, STYLES['numbers']), (r'\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b', 0, STYLES['numbers']), # Double-quoted string, possibly containing escape sequences (r'"[^"\\]*(\\.[^"\\]*)*"', 0, STYLES['string']), # 'def' followed by an identifier (r'\bproc\b\s*(\w+)', 1, STYLES['defclass']), # 'class' followed by an identifier (r'\bglobal\b\s*(\w+)', 1, STYLES['defclass']), # From '//' until a newline (r'//[^\n]*', 0, STYLES['comment']), ] self.rules = [(QRegExp(pat), index, fmt) for (pat, index, fmt) in rules]
def __init__(self, parent=None, **kwargs): super(StringEditor, self).__init__(parent=parent, **kwargs) self._default_value = "" self._clean_value = kwargs.get('clean', True) self.value_line = QLineEdit(self) reg_exp = QRegExp('^([a-zA-Z0-9_]+)') self.main_layout.addWidget(self.value_line) self.value_line.textEdited.connect(self._validate_text) self.value_line.editingFinished.connect(self.OnValueUpdated) self.value_line.returnPressed.connect(self.OnValueUpdated)
def setupUi(self, widget): """ Creates and lays out the widgets defined in the ui file. :Parameters: widget : `QtGui.QWidget` Base widget """ #super(PreferencesDialog, self).setupUi(widget) # TODO: Switch back to this if we get loadUiType working. self.baseInstance = loadUiWidget("preferences_dialog.ui", self) self.setWindowIcon(QIcon.fromTheme("preferences-system")) self.buttonFont.setIcon(QIcon.fromTheme("preferences-desktop-font")) self.buttonNewProg.setIcon(QIcon.fromTheme("list-add")) # ----- General tab ----- # Set initial preferences. parent = self.parent() self.checkBox_parseLinks.setChecked(parent.preferences['parseLinks']) self.checkBox_newTab.setChecked(parent.preferences['newTab']) self.checkBox_syntaxHighlighting.setChecked( parent.preferences['syntaxHighlighting']) self.checkBox_teletypeConversion.setChecked( parent.preferences['teletype']) self.checkBox_lineNumbers.setChecked(parent.preferences['lineNumbers']) self.checkBox_showAllMessages.setChecked( parent.preferences['showAllMessages']) self.checkBox_showHiddenFiles.setChecked( parent.preferences['showHiddenFiles']) self.checkBox_autoCompleteAddressBar.setChecked( parent.preferences['autoCompleteAddressBar']) self.useSpacesCheckBox.setChecked(parent.preferences['useSpaces']) self.useSpacesSpinBox.setValue(parent.preferences['tabSpaces']) self.lineEditTextEditor.setText(parent.preferences['textEditor']) self.lineEditDiffTool.setText(parent.preferences['diffTool']) self.updateFontLabel() # ----- Programs tab ----- self.progLayout = QVBoxLayout() self.extLayout = QVBoxLayout() # Extensions can only be: <optional .><alphanumeric><optional comma><optional space> #self.progValidator = QRegExpValidator(QRegExp("[\w,. ]+"), self) self.extValidator = QRegExpValidator(QRegExp(r"(?:\.?\w*,?\s*)+"), self) self.lineEdit.setValidator(self.extValidator) # Create the fields for programs and extensions. self.populateProgsAndExts(parent.programs)
def __init__(self, name="", parent=None, node=None, canvas=None): super(EditableLabel, self).__init__(parent) self.node = node self.canvas = canvas self.visibilityPolicy = VisibilityPolicy.Auto self.nameLabel = QtWidgets.QLabel(name) self.nameLabel.setContentsMargins(0, 0, 0, 0) self.nameLabel.setAttribute(QtCore.Qt.WA_TranslucentBackground) self._font = QtGui.QFont('Consolas') self._font.setPointSize(6) self.nameLabel.setFont(self._font) self.setWidget(self.nameLabel) self.installEventFilter(self) self.prevName = name self.nameEdit = None self._isEditable = False self._beingEdited = False self.regex = QRegExp("^[A-Za-z0-9_-]+$")
def ui(self): super(PrefixSuffixView, self).ui() prefix_layout = layouts.HorizontalLayout(spacing=5, margins=(0, 0, 0, 0)) prefix_layout.setAlignment(Qt.AlignLeft) self.main_layout.addLayout(prefix_layout) self._prefix_cbx = checkbox.BaseCheckBox(parent=self) prefix_layout.addWidget(self._prefix_cbx) self._prefix_line = lineedit.BaseLineEdit(parent=self) self._prefix_line.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self._prefix_line.setPlaceholderText('Prefix') prefix_reg_exp = QRegExp("^(?!^_)[a-zA-Z_]+") prefix_validator = QRegExpValidator(prefix_reg_exp, self._prefix_line) self._prefix_line.setValidator(prefix_validator) self._prefix_combo = combobox.BaseComboBox(parent=self) self._prefix_combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) prefix_layout.addWidget(self._prefix_line) prefix_layout.addWidget(self._prefix_combo) self._prefix_btn = buttons.BaseButton(parent=self) self._prefix_btn.setIcon(resources.icon('prefix')) self._remove_prefix_btn = buttons.BaseButton(parent=self) self._remove_prefix_btn.setIcon(resources.icon('trash')) prefix_layout.addWidget(self._prefix_btn) prefix_layout.addWidget(self._remove_prefix_btn) remove_first_layout = layouts.HorizontalLayout(spacing=2, margins=(0, 0, 0, 0)) remove_first_layout.setAlignment(Qt.AlignLeft) self.main_layout.addLayout(remove_first_layout) self._remove_first_cbx = checkbox.BaseCheckBox(parent=self) remove_first_layout.addWidget(self._remove_first_cbx) self._remove_first_lbl = label.BaseLabel('Remove first: ') self._remove_first_spn = spinbox.BaseSpinBox(parent=self) self._remove_first_spn.setFocusPolicy(Qt.NoFocus) self._remove_first_spn.setMinimum(0) self._remove_first_spn.setMaximum(99) last_digits_lbl = label.BaseLabel(' digits', parent=self) remove_first_layout.addWidget(self._remove_first_lbl) remove_first_layout.addWidget(self._remove_first_spn) remove_first_layout.addWidget(last_digits_lbl) self._remove_first_btn = buttons.BaseButton(parent=self) self._remove_first_btn.setIcon(resources.icon('trash')) remove_first_layout.addStretch() remove_first_layout.addWidget(self._remove_first_btn) self.main_layout.addWidget(dividers.Divider(parent=self)) suffix_layout = layouts.HorizontalLayout(spacing=5, margins=(0, 0, 0, 0)) suffix_layout.setAlignment(Qt.AlignLeft) self.main_layout.addLayout(suffix_layout) self._suffix_cbx = checkbox.BaseCheckBox(parent=self) suffix_layout.addWidget(self._suffix_cbx) self._suffix_line = lineedit.BaseLineEdit(parent=self) self._suffix_line.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) suffix_reg_exp = QRegExp("^[a-zA-Z_0-9]+") suffix_validator = QRegExpValidator(suffix_reg_exp, self._suffix_line) self._suffix_line.setValidator(suffix_validator) self._suffix_line.setPlaceholderText('Suffix') self._suffix_combo = combobox.BaseComboBox(parent=self) self._suffix_combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) suffix_layout.addWidget(self._suffix_line) suffix_layout.addWidget(self._suffix_combo) self._suffix_btn = buttons.BaseButton(parent=self) self._suffix_btn.setIcon(resources.icon('suffix')) self._remove_suffix_btn = buttons.BaseButton(parent=self) self._remove_suffix_btn.setIcon(resources.icon('trash')) suffix_layout.addWidget(self._suffix_btn) suffix_layout.addWidget(self._remove_suffix_btn) remove_last_layout = layouts.HorizontalLayout(spacing=5, margins=(0, 0, 0, 0)) remove_last_layout.setAlignment(Qt.AlignLeft) self.main_layout.addLayout(remove_last_layout) self._remove_last_cbx = checkbox.BaseCheckBox(parent=self) remove_last_layout.addWidget(self._remove_last_cbx) self._remove_last_lbl = label.BaseLabel('Remove last: ', parent=self) self._remove_last_spn = spinbox.BaseSpinBox(parent=self) self._remove_last_spn.setFocusPolicy(Qt.NoFocus) self._remove_last_spn.setMinimum(0) self._remove_last_spn.setMaximum(99) last_digits_lbl2 = label.BaseLabel(' digits', parent=None) remove_last_layout.addWidget(self._remove_last_lbl) remove_last_layout.addWidget(self._remove_last_spn) remove_last_layout.addWidget(last_digits_lbl2) self._remove_last_btn = buttons.BaseButton() self._remove_last_btn.setIcon(resources.icon('trash')) remove_last_layout.addStretch() remove_last_layout.addWidget(self._remove_last_btn)
def __init__(self, document=None): super(PythonHighlighter, self).__init__(document) # Multi-line strings (expression, flag, style) # FIXME: The triple-quotes in these two lines will mess up the # syntax highlighting from this point onward self.tri_single = (QRegExp("'''"), 1, self.lookup('string2')) self.tri_double = (QRegExp('"""'), 2, self.lookup('string2')) rules = [] # Keyword, operator, and brace rules rules += [(r'\b%s\b' % w, 0, self.lookup('keyword')) for w in PythonHighlighter.keywords] rules += [(r'%s' % o, 0, self.lookup('operator')) for o in PythonHighlighter.operators] rules += [(r'%s' % b, 0, self.lookup('brace')) for b in PythonHighlighter.braces] # All other rules rules += [ # 'STAGE' (r'\bSTAGE\b', 0, self.lookup('STAGE')), # 'self' (r'\bself\b', 0, self.lookup('self')), (r'\b__init__\b', 0, self.lookup('self')), # Double-quoted string, possibly containing escape sequences (r'"[^"\\]*(\\.[^"\\]*)*"', 0, self.lookup('string')), # Single-quoted string, possibly containing escape sequences (r"'[^'\\]*(\\.[^'\\]*)*'", 0, self.lookup('string')), # Decorator (r'\@\w*', 0, self.lookup('decorator')), # 'def' followed by an identifier (r'\bdef\b\s*(\w+)', 1, self.lookup('defclass')), # 'class' followed by an identifier (r'\bclass\b\s*(\w+)', 1, self.lookup('defclass')), # From '#' until a newline (r'#[^\n]*', 0, self.lookup('comment')), # from 'todo' until a new line (r'(todo|Todo)[^\n]*', 0, self.lookup('todo')), # Numeric literals (r'\b[+-]?[0-9]+[lL]?\b', 0, self.lookup('numbers')), (r'\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b', 0, self.lookup('numbers')), (r'\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b', 0, self.lookup('numbers')), ] # Build a QRegExp for each pattern special_rules = [ # tokens.TOKEN_PREFIX (r'\$\{[\w\./:\$\{]*\}', 0, self.lookup('${}')), (r'(?<=\$\{)(\})', 0, self.lookup('${}')) ] self.rules = [] for (pat, index, fmt) in rules: self.rules.append((QRegExp(pat), index, fmt)) # Rules that need more than regex to work self.special_rules = [] for (pat, index, fmt) in special_rules: self.rules.append((QRegExp(pat), index, fmt)) self.special_rules.append((QRegExp(pat), index, fmt))
def color_from_string(string, alpha): xs = string.strip() regex = QRegExp(REGEX_QCOLOR) match = regex.exactMatch(xs) if match: return QColor(xs) regex = QRegExp(REGEX_FN_RGB) match = regex.exactMatch(xs) if match: captured_texts = regex.capturedTexts() return QColor(int(captured_texts[-3]), int(captured_texts[-2]), int(captured_texts[-1])) if alpha: regex = QRegExp(REGEX_HEX_RGBA) match = regex.exactMatch(xs) if match: return QColor(_HEXDEC[xs[1:3]], _HEXDEC[xs[3:5]], _HEXDEC[xs[5:7]], _HEXDEC[xs[7:9]]) regex = QRegExp(REGEX_FN_RGBA) match = regex.exactMatch(xs) if match: captured_texts = regex.capturedTexts() return QColor( int(captured_texts[-4]), int(captured_texts[-3]), int(captured_texts[-2]), int(captured_texts[-1])) return QColor()
from __future__ import print_function, division, absolute_import import logging from Qt.QtCore import Qt, Signal, QPoint, QRect, QSize, QEvent, QRegExp, QMimeData from Qt.QtWidgets import QApplication, QPushButton, QTabBar, QLineEdit, QStyle, QStylePainter, QStyleOptionTab from Qt.QtGui import QCursor, QPixmap, QPainter, QMouseEvent, QDrag, QRegExpValidator from tpDcc.libs.python import name as naming LOGGER = logging.getLogger('tpDcc-libs-qt') # ====================================================================== nameRegExp = QRegExp('\\w+') # ====================================================================== class EditableAddButton(QPushButton, object): """ Button that is used in editable tabs to add new tabs """ def __init__(self, parent=None): super(EditableAddButton, self).__init__(parent=parent) self.setText('+') self.setFixedSize(20, 20) # def event(self, evt):