Пример #1
0
    def initializeFormats(self):
        Config = self.Config
        Config["fontfamily"] = "monospace"
        #Config["fontsize"] = 10
        for name, color, bold, italic in (
                ("normal", "#000000", False, False),
                ("keyword", "#000080", True, False),
                ("builtin", "#0000A0", False, False),
                ("comment", "#007F00", False, True),
                ("string", "#808000", False, False),
                ("number", "#924900", False, False),
                ("lparen", "#000000", True, True),
                ("rparen", "#000000", True, True)):
            Config["%sfontcolor" % name] = color
            Config["%sfontbold" % name] = bold
            Config["%sfontitalic" % name] = italic

        baseFormat = QTextCharFormat()
        baseFormat.setFontFamily(Config["fontfamily"])
        #baseFormat.setFontPointSize(Config["fontsize"])

        for name in ("normal", "keyword", "builtin", "comment",
                     "string", "number", "lparen", "rparen"):
            format = QTextCharFormat(baseFormat)
            format.setForeground(QColor(Config["%sfontcolor" % name]))
            if Config["%sfontbold" % name]:
                format.setFontWeight(QFont.Bold)
            format.setFontItalic(Config["%sfontitalic" % name])
            self.Formats[name] = format
Пример #2
0
 def initializeFormats(cls):
     Config = cls.Config
     baseFormat = QTextCharFormat()
     baseFormat.setFontFamily(Config["fontfamily"])
     baseFormat.setFontPointSize(Config["fontsize"])
     for name in ("normal", "keyword", "builtin", "constant", "decorator",
                  "comment", "string", "number", "error", "pyqt"):
         format = QTextCharFormat(baseFormat)
         format.setForeground(QColor(Config["%sfontcolor" % name]))
         if Config["%sfontbold" % name]:
             format.setFontWeight(QFont.Bold)
         format.setFontItalic(Config["%sfontitalic" % name])
         PythonHighlighter.Formats[name] = format
Пример #3
0
 def initializeFormats(cls):
     Config = cls.Config
     baseFormat = QTextCharFormat()
     baseFormat.setFontFamily(Config["fontfamily"])
     baseFormat.setFontPointSize(Config["fontsize"])
     for name in ("normal", "keyword", "builtin", "constant",
             "decorator", "comment", "string", "number", "error",
             "pyqt"):
         format = QTextCharFormat(baseFormat)
         format.setForeground(QColor(Config["%sfontcolor" % name]))
         if Config["%sfontbold" % name]:
             format.setFontWeight(QFont.Bold)
         format.setFontItalic(Config["%sfontitalic" % name])
         PythonHighlighter.Formats[name] = format
Пример #4
0
 def base_fmt(self):
     fmt = QTextCharFormat()
     fmt.setFontFamily('monospace')
     return fmt