fabien wrote on Sun, 01 May 2005 05:40:05 -0700: > Hi,
Hello Fabien > I am writing a POV-RAY editor with Python using > either QT or GTK as GUI 'wrapper'. ( I am still trying both ) > > [snip] > > I have also downloaded qscintilla-1.62-gpl-1.5.1. > As for GTK, I also found the LexPOV.cpp file, with > no POV keywords in it and with no POV keywords in > any of the file in the package. > The compilation builds then move the library > libqscintilla.so to /usr/lib/qt3/lib. > > How do I link the newly built library to the folling qt script : > > [snip] QScintilla is a port to Qt of the Scintilla editor control, and PyQt provides the python bindings for it. Scintilla has several dozen lexers (including one for POV), and QScintilla currently provides class wrappers for a small selection of them - but not POV, as you will see from the documentation: http://www.river-bank.demon.co.uk/docs/qscintilla/hierarchy.html Given this, there are two routes you can go down. You could ask the developer of QScintilla to provide support for POV by making a request via the mailing list: http://www.riverbankcomputing.co.uk/pyqt/mailinglist.php Or you could write your own POV lexer class in python using the existing QScintilla APIs. This is not particularly difficult, but it does take some working out. As you already know, a list of POV keywords is required. You will then need to look at the source (LexPOV.cpp and SciLexer.h) to see how the keywords are used and how the lexical states tie up with the SCE_POV enum. QScintilla's lexer classes are mainly wrappers around this information, so once you've worked it out, writing a python class based on QextScintillaLexer is fairly straightforward: >>> class LexerPOV(QextScintillaLexer): >>> def __init__(self, parent, name): >>> QextScintillaLexer.__init__(self, parent, name) >>> def lexer(self): >>> return "pov" >>> def color(self, style): >>> # styles map to (SCE_POV enum) >>> # return your own QColor >>> # or return the base class default >>> return QextScintillaLexer.color(self, style) >>> def keywords(self, set): >>> # if set == 0: >>> # return <pov keywords> >>> # elif ... >>> return 0 >>> def description(self, style): >>> # if style == 0: >>> # return self.tr("Default") >>> # elif ... >>> return QString.null Of course, this is a minimal lexer class - it is possible to be a lot more sophisticated than what is suggested here. John Ridley Send instant messages to your online friends http://uk.messenger.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list