def __init__(self, variant="", parent=None): """ Constructor @param variant name of the language variant (string) @param parent parent widget of this lexer """ QsciLexerPython.__init__(self, parent) Lexer.__init__(self) self.variant = variant self.commentString = "#"
def __init__(self, variant="", parent=None): """ Constructor @param variant name of the language variant (string) @param parent parent widget of this lexer """ QsciLexerPython.__init__(self, parent) Lexer.__init__(self) self.variant = variant self.commentString = "#"
def __init__(self): QsciLexerPython.__init__(self) for key, attrib in self.default_style.items(): value = self.token_id[key] self.setColor(QColor(attrib[1]), value) self.setEolFill(True, value) self.setPaper(QColor(attrib[5]), value) self.setPaper(QColor(attrib[5]), value) font = QFont(attrib[0], attrib[2]) font.setBold(attrib[3]) font.setItalic(attrib[4]) self.setFont(font, value) self.setDefaultPaper(QColor("#ffffff"))
def __init__(self): QsciLexerPython.__init__(self) for key, attrib in self.default_style.items(): value = self.token_id[key] self.setColor(QColor(attrib[1]), value) self.setEolFill(True, value) self.setPaper(QColor(attrib[5]), value) self.setPaper(QColor(attrib[5]), value) font = QFont(attrib[0], attrib[2]) font.setBold(attrib[3]) font.setItalic(attrib[4]) self.setFont(font, value) self.setDefaultPaper(QColor("#ffffff"))
def __init__(self, parent): QsciLexerPython.__init__(self, parent) self.setFont(QtGui.QFont('Consolas', 14)) # 设置默认字体 self.setColor(QColor(0, 0, 0)) # 设置默认的字体颜色 self.setPaper(QColor(255, 255, 255)) # 设置底色 self.setColor(QColor("#B0171F"), QsciLexerPython.Keyword) self.setColor(QColor("#008000"), QsciLexerPython.Comment) # 文档注释 /**开头的颜色 self.setColor(QColor("#008000"), QsciLexerPython.Comment) # 块注释 的颜色 self.setColor(QColor("#007f7f"), QsciLexerPython.Number) # 数字 的颜色 self.setColor(QColor("#ff00ff"), QsciLexerPython.DoubleQuotedString) # 双引号字符串的颜色 self.setColor(QColor("#ff00ff"), QsciLexerPython.SingleQuotedString) # 单引号字符的颜色 self.setColor(QColor("#191970"), QsciLexerPython.Operator) self.setColor(QColor("#0000FF"), QsciLexerPython.UnclosedString) # 未完成输入的字符串的颜色
def __init__(self, style, paper): QsciLexerPython.__init__(self) self.lexerPaper = paper for key, attrib in style.items(): value = propertyID[key] self.setColor(QtGui.QColor(attrib[1]), value) self.setEolFill(True, value) self.setPaper(QtGui.QColor(attrib[5]), value) if self.lexerPaper[0] == "Plain": self.setPaper(QtGui.QColor(attrib[5]), value) else: self.setPaper(QtGui.QColor(self.lexerPaper[1]), value) font = QtGui.QFont(attrib[0], attrib[2]) font.setBold(attrib[3]) font.setItalic(attrib[4]) self.setFont(font, value) if self.lexerPaper[0] == "Plain": self.setDefaultPaper(QtGui.QColor("#ffffff")) else: self.setDefaultPaper(QtGui.QColor(self.lexerPaper[1]))
def __init__(self, *args): QsciLexerPython.__init__(self, *args) self.setIndentationWarning(QsciLexerPython.Tabs)
def __init__(self, variant="", parent=None): """ Constructor @param variant name of the language variant (string) @param parent parent widget of this lexer """ QsciLexerPython.__init__(self, parent) SubstyledLexer.__init__(self) self.variant = variant self.commentString = "#" self.keywordSetDescriptions = [ self.tr("Keywords"), self.tr("Highlighted identifiers"), ] ############################################################## ## default sub-style definitions ############################################################## # list of style numbers, that support sub-styling self.baseStyles = [11] self.defaultSubStyles = { 11: { 0: { "Description": self.tr("Standard Library Modules"), "Words": """ __main__ _dummy_thread _thread abc aifc argparse array ast asynchat asyncio asyncore atexit audioop base64 bdb binascii binhex bisect builtins bz2 calendar cgi cgitb chunk cmath cmd code codecs codeop collections colorsys compileall concurrent configparser contextlib copy copyreg crypt csv ctypes curses datetime dbm decimal difflib dis distutils dummy_threading email ensurepip enum errno faulthandler fcntl filecmp fileinput fnmatch formatter fpectl fractions ftplib functools gc getopt getpass gettext glob grp gzip hashlib heapq hmac html http http imaplib imghdr importlib inspect io ipaddress itertools json keyword linecache locale logging lzma macpath mailbox mailcap marshal math mimetypes mmap modulefinder msilib msvcrt multiprocessing netrc nis nntplib numbers operator os ossaudiodev parser path pathlib pdb pickle pickletools pipes pkgutil platform plistlib poplib posix pprint pty pwd py_compile pyclbr queue quopri random re readline reprlib resource rlcompleter runpy sched select selectors shelve shlex shutil signal site smtpd smtplib sndhdr socket socketserver spwd sqlite3 ssl stat statistics string stringprep struct subprocess sunau symbol symtable sys sysconfig syslog tabnanny tarfile telnetlib tempfile termios textwrap threading time timeit tkinter token tokenize trace traceback tracemalloc tty turtle types unicodedata unittest urllib uu uuid venv warnings wave weakref webbrowser winreg winsound wsgiref xdrlib xml xmlrpc zipfile zipimport zlib""", "Style": { "fore": 0xDD9900, "font_bold": True, } }, 1: { "Description": self.tr("__future__ Imports"), "Words": """ __future__ with_statement unicode_literals print_function division absolute_import generator_stop annotations""", "Style": { "fore": 0xEE00AA, "font_italic": True, } }, 2: { "Description": self.tr("PyQt5 Modules"), "Words": """ PyQt5 Qsci Qt QtCore QtDBus QtDesigner QtGui QtHelp QtLocation QtMacExtras QtMultimedia QtMultimediaWidgets QtNetwork QtNetworkAuth QtNfc QtOpenGL QtPositioning QtPrintSupport QtQml QtQuick QtQuickWidgets QtRemoteObjects QtSensors QtSerialPort QtSql QtSvg QtTest QtWebChannel QtWebEngine QtWebEngineCore QtWebEngineWidgets QtWebSockets QtWidgets QtWinExtras QtX11Extras QtXml QtXmlPatterns sip QtWebKit QtWebKitWidgets""", "Style": { "fore": 0x44AADD, "font_bold": True, } }, 3: { "Description": self.tr("Cython Specifics"), "Words": "cython pyximport Cython __cinit__ __dealloc__", "Style": { "fore": 0xdd0000, "font_bold": True, } }, }, }