Skip to content

Commit

Permalink
Play a bit with highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
chick committed Apr 16, 2014
1 parent 7b230af commit 4d6dc8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 3 additions & 4 deletions ast_viewer/views/code_views/code_pane.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ def __init__(self, code_presenter=None, panel_count=2):
self.expand_all_button.clicked.connect(self.expand_all_asts)
toolbar_layout.addWidget(self.expand_all_button)

toolbar_layout.addSpacing(1)
# del_button = QtGui.QPushButton("Del")
# del_button.clicked.connect(self.code_presenter.delete_last)
# toolbar_layout.addWidget(del_button)

del_button = QtGui.QPushButton("Del")
del_button.clicked.connect(self.code_presenter.delete_last)
toolbar_layout.addWidget(del_button)
toolbar_layout.addStretch(1)

layout.addLayout(toolbar_layout)
Expand Down
7 changes: 6 additions & 1 deletion ast_viewer/views/highlighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, parent=None):
"\\bdouble\\b", "\\benum\\b", "\\bexplicit\\b", "\\bfriend\\b",
"\\binline\\b", "\\bint\\b", "\\blong\\b", "\\bnamespace\\b",
"\\boperator\\b", "\\bprivate\\b", "\\bprotected\\b",
"\\bpublic\\b", "\\bshort\\b", "\\bsignals\\b", "\\bsigned\\b",
"\\bpublic\\b", "\\bself\\b", "\\bshort\\b", "\\bsignals\\b", "\\bsigned\\b",
"\\bslots\\b", "\\bstatic\\b", "\\bstruct\\b",
"\\btemplate\\b", "\\btypedef\\b", "\\btypename\\b",
"\\bunion\\b", "\\bunsigned\\b", "\\bvirtual\\b", "\\bvoid\\b",
Expand All @@ -21,6 +21,11 @@ def __init__(self, parent=None):
self.highlightingRules = [(QtCore.QRegExp(pattern), keywordFormat)
for pattern in keywordPatterns]

assertFormat = QtGui.QTextCharFormat()
assertFormat.setForeground(QtCore.Qt.darkYellow)
assertFormat.setFontWeight(QtGui.QFont.Bold)
self.highlightingRules.append((QtCore.QRegExp("\\bassert\\w*\\b"), assertFormat))

classFormat = QtGui.QTextCharFormat()
classFormat.setFontWeight(QtGui.QFont.Bold)
classFormat.setForeground(QtCore.Qt.darkMagenta)
Expand Down

0 comments on commit 4d6dc8a

Please sign in to comment.