--- author: '' category: '' date: 2010/02/16 19:20 description: '' link: '' priority: '' slug: BB871 tags: open source, programming, pyqt, python, qt title: Yak Shavings for February 16, 2010 type: text updated: 2010/02/16 19:20 url_type: '' --- yak shaving (idiomatic) Any apparently useless activity which, by allowing you to overcome intermediate difficulties, allows you to solve a larger problem. A while ago, I wrote how I `implemented a generic syntax highlighter for PyQt using Pygments `_. I got a request for such a feature in Marave, so I digged that code and... it's freaking useless. It's just too slow for reasonable use. So, that yak's hair is all grown up again, and I just got this new pair of scissors! The goal is a way to highlight syntax in a QPlainTextEdit that: * Doesn't require programming to add a new highlighter * Doesn't require programming to add a new color scheme * Doesn't require me to spend a year writing highlighters for existing languages * Is fast enough A quick google shows that for C++ you can use `Source highlight qt `_ which is based on `GNU source highlight `_. Alas, no python binding that I could find. So, let's write one! Here it is: http://marave.googlecode.com/svn/trunk/marave/highlight/ And here's a screenshot of the demo program running, showing itself in its entirety: .. raw:: html You can create a color scheme using CSS, a language definition is a text file, there are a bazillion already written, it seems to be fast enough. So, another yak shaved, another feature (not finished!) for `Marave `_