Mercurial > lcfOS
comparison python/codeeditor.py @ 100:fe145e42259d
Fixes after movage
author | windel |
---|---|
date | Mon, 24 Dec 2012 16:35:22 +0100 |
parents | 5a965e9664f2 |
children | af0d7913677a |
comparison
equal
deleted
inserted
replaced
99:6efbeb903777 | 100:fe145e42259d |
---|---|
1 from PyQt4.QtCore import * | 1 from PyQt4.QtCore import * |
2 from PyQt4.QtGui import * | 2 from PyQt4.QtGui import * |
3 import compiler.lexer | 3 #import compiler.lexer |
4 import os.path | 4 import os.path |
5 | 5 |
6 class MySyntaxHighlighter(QSyntaxHighlighter): | 6 class MySyntaxHighlighter(QSyntaxHighlighter): |
7 def __init__(self, parent=None): | 7 def __init__(self, parent=None): |
8 super(MySyntaxHighlighter, self).__init__(parent) | 8 super(MySyntaxHighlighter, self).__init__(parent) |
9 # Syntax highlighting: | 9 # Syntax highlighting: |
10 self.rules = [] | 10 self.rules = [] |
11 fmt = QTextCharFormat() | 11 fmt = QTextCharFormat() |
12 fmt.setForeground(Qt.darkBlue) | 12 fmt.setForeground(Qt.darkBlue) |
13 fmt.setFontWeight(QFont.Bold) | 13 fmt.setFontWeight(QFont.Bold) |
14 for kw in compiler.lexer.keywords: | 14 #for kw in compiler.lexer.keywords: |
15 pattern = '\\b'+kw+'\\b' | 15 # pattern = '\\b'+kw+'\\b' |
16 self.rules.append( (pattern, fmt) ) | 16 # self.rules.append( (pattern, fmt) ) |
17 | 17 |
18 # Comments: | 18 # Comments: |
19 fmt = QTextCharFormat() | 19 fmt = QTextCharFormat() |
20 fmt.setForeground(Qt.gray) | 20 fmt.setForeground(Qt.gray) |
21 fmt.setFontItalic(True) | 21 fmt.setFontItalic(True) |