Re: [PyKDE] Qscintilla error when using QT Designer plugin
On Friday 12 January 2007 1:45 pm, Carlos Eduardo wrote: I created a form with a QScintilla input widget. I followed all instructions from html docs (built QScintilla, QScintilla Python bindings and QT Designer Plugin). Then I run pyuic4 to generate the .py files from .ui ones created from designer. I´m having the following error: Traceback (most recent call last): File C:\Carlos\#Projects\UniversalSQL Navigator\UniSQLNav.py, line 115, in a ctionNew_SQL_Window_Clicked from ui.sqlWindow import sqlWindow File C:\Carlos\#Projects\UniversalSQL Navigator\ui\sqlWindow.py, line 25, in module from ui_sqlwindow import Ui_SQLWindow File C:\Carlos\#Projects\UniversalSQL Navigator\ui\ui_sqlwindow.py, line 229 , in module from qsciscintilla import QsciScintilla ImportError: No module named qsciscintilla I saw that in ui_sqlwindow.py the module tries to import qsciscintilla but the module has been installed in PyQt4/Qsci.pyd automatically. If i change the ui_sqlwindow.py auto generated file from: from qsciscintilla import QsciScintilla to from PyQt4.Qsci import QsciScintilla The app loads correctly and widget is displayed. Should be fixed in tonight's PyQt4 snapshot. Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla snapshot not auto-indenting anymore
Hi, that will be fixed in the next release of eric3. Regards, Detlev PS: For those of you, who are willing to patch it themselves. In the Editor methods bindLexer and readSettings (Editor.py) make the lines dealing with autoindentation settings for Python read if Preferences.getEditor(PythonAutoIndent): if QSCINTILLA_VERSION() 0x010600: self.lexer.setAutoIndentStyle(QextScintilla.AiOpening) else: self.lexer.setAutoIndentStyle(0) else: self.lexer.setAutoIndentStyle(QextScintilla.AiMaintain) On Sunday 16 July 2006 23:18, Andreas Pakulat wrote: On 16.07.06 21:28:40, Phil Thompson wrote: On Sunday 16 July 2006 8:22 pm, Andreas Pakulat wrote: Hi Phil, I'm not sure you saw my post in the eric3 editor bug thread, so I'm posting this as new thread. I installed qscintiall snapshot 20060709 and now I don't get any auto indentation at all, not for if foo:return or foo = {bar:1,return In eric3 for python files. Did you eventually make the lexer to clever this time ;-) I saw it - it's on my TODO list. However it works fine with my simple test editor. Good to know :-) Autocompletion behaviour is controlled by a number of settings so you may not have the right combination. I guess you mean auto indentation? Anyway, maybe there's something in eric3 that makes this break now, I do see a method for calculating the indentation for a line in eric3. Disabling that doesn't help, so I guess Detlev needs to look into this. BTW: Is something wrong with the new eric3 list? I tried subscribing today but didn't get any confirmation mail yet. Andreas -- Detlev Offenbach [EMAIL PROTECTED] ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla snapshot not auto-indenting anymore
On 17.07.06 21:37:59, Andreas Pakulat wrote: On 17.07.06 19:04:21, Detlev Offenbach wrote: PS: For those of you, who are willing to patch it themselves. In the Editor methods bindLexer and readSettings (Editor.py) make the lines dealing with autoindentation settings for Python read Thanks, I would have asked for it else ;-) For those who are not brave enough to edit the files themselves I attach a patch which changes the 2 methods accordingly. While we're at it: Using the patch needs a qscintilla snapshot, which needs a pyqt3 snapshot (not sure wether that needs a sip snapshot). This in turn means hacking install.py because the format of the pyqt version string changed in the current snapshots (it's 3-snapshot-date now). I hacked my install.py by replacing the pyqtVersion[:9] with pyqtVersion[2:11] (and the same for the qscintilla check) but this is not really nice. Detlev would you be so kind to post the proper change for this? Forgot to attach the patch and one also needs to change eric/QScintilla/QextScintillaCompat's QSCINTILLA_VERSION function to use if 'snapshot' in QSCINTILLA_VERSION_STR: instead of the .startsWith() Andreas -- Everything will be just tickety-boo today. diff -ur eric-3.9.1/eric/QScintilla/Editor.py eric-3.9.1.new/eric/QScintilla/Editor.py --- eric-3.9.1/eric/QScintilla/Editor.py2006-06-16 16:24:38.0 +0200 +++ eric-3.9.1.new/eric/QScintilla/Editor.py2006-07-17 21:24:33.0 +0200 @@ -809,7 +809,10 @@ self.lexer.setFoldComments(Preferences.getEditor(PythonFoldComment)) self.lexer.setFoldQuotes(Preferences.getEditor(PythonFoldString)) if Preferences.getEditor(PythonAutoIndent): -self.lexer.setAutoIndentStyle(0) + if QSCINTILLA_VERSION() 0x010600: + self.lexer.setAutoIndentStyle(QextScintilla.AiOpening) + else: + self.lexer.setAutoIndentStyle(0) else: self.lexer.setAutoIndentStyle(QextScintilla.AiMaintain) elif self.apiLanguage in [C++, C#, IDL, Java, JavaScript]: @@ -2032,7 +2035,10 @@ self.lexer.readSettings(Preferences.Prefs.settings, /eric3/Scintilla) if self.lexer.language() == 'Python': if Preferences.getEditor(PythonAutoIndent): -self.lexer.setAutoIndentStyle(0) + if QSCINTILLA_VERSION() 0x010600: +self.lexer.setAutoIndentStyle(QextScintilla.AiOpening) +else: + self.lexer.setAutoIndentStyle(0) else: self.lexer.setAutoIndentStyle(QextScintilla.AiMaintain) elif self.lexer.language() in ['C++', 'C#', 'IDL', 'Java', 'JavaScript']: ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla snapshot not auto-indenting anymore
On Sunday 16 July 2006 8:22 pm, Andreas Pakulat wrote: Hi Phil, I'm not sure you saw my post in the eric3 editor bug thread, so I'm posting this as new thread. I installed qscintiall snapshot 20060709 and now I don't get any auto indentation at all, not for if foo:return or foo = {bar:1,return In eric3 for python files. Did you eventually make the lexer to clever this time ;-) I saw it - it's on my TODO list. However it works fine with my simple test editor. Autocompletion behaviour is controlled by a number of settings so you may not have the right combination. Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla snapshot not auto-indenting anymore
On 16.07.06 21:28:40, Phil Thompson wrote: On Sunday 16 July 2006 8:22 pm, Andreas Pakulat wrote: Hi Phil, I'm not sure you saw my post in the eric3 editor bug thread, so I'm posting this as new thread. I installed qscintiall snapshot 20060709 and now I don't get any auto indentation at all, not for if foo:return or foo = {bar:1,return In eric3 for python files. Did you eventually make the lexer to clever this time ;-) I saw it - it's on my TODO list. However it works fine with my simple test editor. Good to know :-) Autocompletion behaviour is controlled by a number of settings so you may not have the right combination. I guess you mean auto indentation? Anyway, maybe there's something in eric3 that makes this break now, I do see a method for calculating the indentation for a line in eric3. Disabling that doesn't help, so I guess Detlev needs to look into this. BTW: Is something wrong with the new eric3 list? I tried subscribing today but didn't get any confirmation mail yet. Andreas -- Domestic happiness and faithful friends. ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] qscintilla 1.65 make problems
On Friday 27 January 2006 3:35 pm, Scott Rifkin wrote: I am trying to install eric3 and need to install qt, qscintilla, sip , and pyqt beforehand. I can't run as root. I'm running Red Hat Enterprise Linux AS release 3 (Taroon Update 6). I installed Qt 4.1.0 in a directory under my home directory ~/local/Trolltech/Qt-4.1.0 and that worked. I unpacked qscintilla-1.65 to ~/local/Trolltech/ and removed thread support and commented out the DESTDIR variable in qscintilla.pro My QTDIR is set to ~/local/Trolltech/Qt-4.1.0 in .bash_profile. When I try to run make in ~/local/Trolltech/qscintilla-1.65-gpl-1.6/qt/, I get the following slew of errors. Any help on getting this all to work would be much appreciated. QScintilla hasn't been ported to Qt4 yet. Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Translations (Brazilian Portuguese)
Hi Phil ! I did a brazilian portuguese one. Many thanks to Jul, because i used his as a base to mine, since his french translation helped me to solve some strings. Here it go. :) Em Qua 27 Jul 2005 17:38, Phil Thompson escreveu: The current QScintilla snapshot will become QScintilla v1.6 in a couple of weeks. There have been a number of new lexers added, so if anybody wants to update the existing translations, now would be a good time. Thanks, Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde -- Douglas Soares de Andrade dsa at unilestemg.br UnilesteMG - www.unilestemg.br ICQ, MSN = 76277921, douglas at tuxfamily.org qscintilla.tar.gz Description: application/tgz ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Translations
Here is the french one. Regards, ++ Jul. Phil Thompson wrote: The current QScintilla snapshot will become QScintilla v1.6 in a couple of weeks. There have been a number of new lexers added, so if anybody wants to update the existing translations, now would be a good time. Thanks, Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde qscintilla_fr.tbz2 Description: Binary data ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
I'd need to read the code a bit more and get something working with Qt 3 before I could be sure it would work with Qt 4. There's probably a good reason why the code is currently arranged the way it is. The only reason will be to follow the pattern of other platform ports. That's not a good reason in itself. Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
On July 5, 2005 03:11 pm, Phil Thompson wrote: On Tuesday 05 July 2005 8:55 pm, Thomas Fjellstrom wrote: I know the whole Qt4 thing has come up time and time again, but hopefully my questions are a little different ;) How much work has already gone into porting Scintilla to Qt4? None. If any has been done, would I be able to get my hands on it? I'd prefer not to have to start from scratch ;) I'm assuming (hoping more like) that not much will actually have to be done, maybe a few QPainter api differences (I haven't looked at depth into the differences to the new painter api, hopefully its somewhat compatable) I'm currently using qt3 for a little editor: http://pic.tomasu.org/screenshots/sciq-07-05-05.png Was hoping to get it to work under qt4, but I have no idea how much work it'll be to get QScintilla to work with it.. I don't expect that it will take much work. Well, so far its going ok, with the help of qt3to4 :) it found alot of things it could automatically handle ;) though right at this moment, QContextMenuEvent::isConsumed seems not to me mentioned anywhere in the qt4 docs, or porting guide. we shall see. Phil Since It seems I'll have to do the work, is there any objections to packaging qscintilla with my editor? Since I have no idea if my work will be fit for inclusion in the standard distro :) No - so long as you conform to the QScintilla license. Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
On Tue, 05 Jul 2005 18:46:32, Thomas Fjellstrom wrote: And you were 100% correct. It now works, but is still using the qt3 support classes (I'll fix that eventually). And I'm getting this odd warning: QPainter::begin: Widget painting can only begin as a result of a paintEvent Yes, you shouldn't paint onto widget outside paint events. In theory, there should be plenty of ways to work around this, although it might mean a certain amount of refactoring. There were only two QPainter::begin's ever called in the qscintilla source, and even after commenting them out, I still get the message. I've attempted to ask at #qt on freenode irc, but so far nothing. I'll join the Qt list and see if they have an answer. I saw the follow-ups in the following thread: http://lists.trolltech.com/qt-interest/2005-07/thread00187-0.html Do you want to upload the partially ported code somewhere so that the rest of us can take a look? We might be able to make some constructive comments. David ___ $0 Web Hosting with up to 200MB web space, 1000 MB Transfer 10 Personalized POP and Web E-mail Accounts, and much more. Signup at www.doteasy.com ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
On July 6, 2005 12:07 pm, David Boddie wrote: On Tue, 05 Jul 2005 18:46:32, Thomas Fjellstrom wrote: And you were 100% correct. It now works, but is still using the qt3 support classes (I'll fix that eventually). And I'm getting this odd warning: QPainter::begin: Widget painting can only begin as a result of a paintEvent Yes, you shouldn't paint onto widget outside paint events. In theory, there should be plenty of ways to work around this, although it might mean a certain amount of refactoring. There were only two QPainter::begin's ever called in the qscintilla source, and even after commenting them out, I still get the message. I've attempted to ask at #qt on freenode irc, but so far nothing. I'll join the Qt list and see if they have an answer. I saw the follow-ups in the following thread: http://lists.trolltech.com/qt-interest/2005-07/thread00187-0.html Do you want to upload the partially ported code somewhere so that the rest of us can take a look? We might be able to make some constructive comments. I haven't changed the drawingcode (in PlatQt.cpp) much at all. So just look in there for how QScintilla works.. Basically, It has a Surface object that gets instantiated in paintEvent, and the drawing happens in calls to other scintilla qt functions called from paintEvent. (mainly in ScintillaQt.cpp::paintEvent() and the Surface methods in PlatQt.cpp) David -- Thomas Fjellstrom [EMAIL PROTECTED] ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
On Wednesday 06 July 2005 20:04, Thomas Fjellstrom wrote: I haven't changed the drawingcode (in PlatQt.cpp) much at all. So just look in there for how QScintilla works.. Basically, It has a Surface object that gets instantiated in paintEvent, and the drawing happens in calls to other scintilla qt functions called from paintEvent. (mainly in ScintillaQt.cpp::paintEvent() and the Surface methods in PlatQt.cpp) The QtCallTip::paintEvent() function appears to be OK in that the QPainter paints onto the QtCallTip widget. However, ScintillaQt::paintEvent() involves painting onto a QWidget using a Surface helper class: QPainter painter(PWindow(wMain)); sw - Init(painter,0); sw - SetUnicodeMode(isUnicodeMode); Paint(sw,rcPaint); sw - Release(); If I understand it correctly, this won't work any more because the painting is not occurring inside the paint event of the QWidget returned by PWindow(wMain). You could paint onto a QPixmap instead, but you will still have to paint onto a widget at some point, so I don't think that it will get around the problem because you will still be doing that externally. I hope someone will correct me if I'm wrong, but the solution I see is to change QextScintillaBase to use a QWidget subclass in which you can reimplement paintEvent() to do the painting currently in ScintillaQt, and just call repaint() on this widget from ScintillaQt::paintEvent(). Alternatively, with a QWidget subclass like this, you might also be able to simplify the event filter implemented in QextScintillaBase. The paintEvent() implementation in this custom widget would call ScintillaQt::paintEvent() directly, probably passing a QPainter rather than a QPaintEvent. I'd need to read the code a bit more and get something working with Qt 3 before I could be sure it would work with Qt 4. There's probably a good reason why the code is currently arranged the way it is. David ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
On Tuesday 05 July 2005 8:55 pm, Thomas Fjellstrom wrote: I know the whole Qt4 thing has come up time and time again, but hopefully my questions are a little different ;) How much work has already gone into porting Scintilla to Qt4? None. If any has been done, would I be able to get my hands on it? I'd prefer not to have to start from scratch ;) I'm assuming (hoping more like) that not much will actually have to be done, maybe a few QPainter api differences (I haven't looked at depth into the differences to the new painter api, hopefully its somewhat compatable) I'm currently using qt3 for a little editor: http://pic.tomasu.org/screenshots/sciq-07-05-05.png Was hoping to get it to work under qt4, but I have no idea how much work it'll be to get QScintilla to work with it.. I don't expect that it will take much work. Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
On July 5, 2005 03:11 pm, Phil Thompson wrote: On Tuesday 05 July 2005 8:55 pm, Thomas Fjellstrom wrote: I know the whole Qt4 thing has come up time and time again, but hopefully my questions are a little different ;) How much work has already gone into porting Scintilla to Qt4? None. If any has been done, would I be able to get my hands on it? I'd prefer not to have to start from scratch ;) I'm assuming (hoping more like) that not much will actually have to be done, maybe a few QPainter api differences (I haven't looked at depth into the differences to the new painter api, hopefully its somewhat compatable) I'm currently using qt3 for a little editor: http://pic.tomasu.org/screenshots/sciq-07-05-05.png Was hoping to get it to work under qt4, but I have no idea how much work it'll be to get QScintilla to work with it.. I don't expect that it will take much work. Well, so far its going ok, with the help of qt3to4 :) it found alot of things it could automatically handle ;) though right at this moment, QContextMenuEvent::isConsumed seems not to me mentioned anywhere in the qt4 docs, or porting guide. we shall see. Phil Since It seems I'll have to do the work, is there any objections to packaging qscintilla with my editor? Since I have no idea if my work will be fit for inclusion in the standard distro :) -- Thomas Fjellstrom [EMAIL PROTECTED] ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
On July 5, 2005 03:29 pm, Thomas Fjellstrom wrote: we shall see. Wow, quite a few (obsolete) methods being used... And they were (obsolete) in qt3 :o -- Thomas Fjellstrom [EMAIL PROTECTED] ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla and Qt4
On July 5, 2005 03:11 pm, you wrote: On Tuesday 05 July 2005 8:55 pm, Thomas Fjellstrom wrote: Was hoping to get it to work under qt4, but I have no idea how much work it'll be to get QScintilla to work with it.. I don't expect that it will take much work. And you were 100% correct. It now works, but is still using the qt3 support classes (I'll fix that eventually). And I'm getting this odd warning: QPainter::begin: Widget painting can only begin as a result of a paintEvent There were only two QPainter::begin's ever called in the qscintilla source, and even after commenting them out, I still get the message. I've attempted to ask at #qt on freenode irc, but so far nothing. I'll join the Qt list and see if they have an answer. Phil -- Thomas Fjellstrom [EMAIL PROTECTED] ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Scrollbars
On Sat, 15 Jan 2005 09:47:56 you wrote: Can you post some code that demonstrates the problem? Here is an app that demos the problem: import sys from qt import * from qtext import QextScintilla class Editor(QDialog): def __init__(self): QDialog.__init__(self) self.QS = QextScintilla(self) self.QS.setGeometry(8,8,500,300) b = QPushButton('Toggle Scrollbar',self) b.setGeometry(190,320,120,22) self.connect(b,SIGNAL('clicked()'),self.fn) def fn(self): self.QS.SendScintilla(self.QS.SCI_SETHSCROLLBAR, not self.QS.SendScintilla(self.QS.SCI_GETHSCROLLBAR)) if __name__ == __main__: a = QApplication(sys.argv) a.connect(a,SIGNAL('lastWindowClosed()'),a,SLOT('quit()')) w = Editor(); a.setMainWidget(w); w.show() a.exec_loop() This will be fixed in the next QScintilla snapshot - probably next weekend. Thanks for the test case. Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Scrollbars
On Saturday 15 January 2005 5:36 pm, bdw wrote: I can switch off the horizontal scrollbar in QScintilla with SCI_SETHSCROLLBAR but it then resizes itself to half its original height. Why does it want to be half the height? Is it a bug, or do I have to do something else to get QScintilla to resize itself properly? Can you post some code that demonstrates the problem? Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Scrollbars
On Sat, 15 Jan 2005 09:47:56 you wrote: Can you post some code that demonstrates the problem? Here is an app that demos the problem: import sys from qt import * from qtext import QextScintilla class Editor(QDialog): def __init__(self): QDialog.__init__(self) self.QS = QextScintilla(self) self.QS.setGeometry(8,8,500,300) b = QPushButton('Toggle Scrollbar',self) b.setGeometry(190,320,120,22) self.connect(b,SIGNAL('clicked()'),self.fn) def fn(self): self.QS.SendScintilla(self.QS.SCI_SETHSCROLLBAR, not self.QS.SendScintilla(self.QS.SCI_GETHSCROLLBAR)) if __name__ == __main__: a = QApplication(sys.argv) a.connect(a,SIGNAL('lastWindowClosed()'),a,SLOT('quit()')) w = Editor(); a.setMainWidget(w); w.show() a.exec_loop() = bdw ___ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Lexers
Thanks for your reply. On Monday 10 Jan 2005 10:27, you wrote: QScintilla is a port of Scintilla, not an enhancement of it. If there are issues with how well lexers work (or if you want a new lexer) then these should be fixed in Scintilla itself and they will then appear in QScintilla. Okay - I'll try the Scintilla mailing list on these issues. The real point of all this is to introduce a couple proposals for improving the lexers in QScintilla. The first one is obvious: make QextScintillaLexer Python-friendly so it can be fully sub-classed. It's not clear from your explanation exactly what the problem is. Can you give some specific examples? Phil If I was writing a Qt app in C++ which used QScintilla, I could just go ahead and sub-class QextScintillaLexer without any problems. But because I'm a Python programmer using QScintilla via PyQt, I can't. Call me stupid, but I still don't understand the problem. To make the Python problems explicit in code, here's how I might set a lexer language using QScintilla's low-level API: qsb.SendScintilla(qsb.SCI_SETLEXERLANGUAGE, QString('perl').latin1()) This works because QString can pass a const char* to the function even though Python can't do it itself. Pardon? What's wrong with... qsb.SendScintilla(qsb.SCI_SETLEXERLANGUAGE, 'perl') ...? Here's the same thing from the C++ source code for QextScintilla.setLexer(): SendScintilla(SCI_SETLEXERLANGUAGE, lex - lexer()); Now if 'lex' is a Python sub-class of QextScintillaLexer that I have passed to setLexer(), I can't pull the QString trick any more. And since Python functions can't return const char*, whenever lex.lexer() gets called all I'll see is a segmentation fault. You mean you actually see a segmentation fault, or your understanding suggests that you will get a segmentation fault? There are two reasons why I'm bothering with any of this. The first is because I want to set custom keyword lists. This would allow me to, say, provide HTML syntax highlighting to suit different browsers or different versions of the w3c standards. The second is to access more of Scintilla's 60 lexers by creating my own lexer classes. (I assume QScintilla won't be implementing classes for all 50 of the remaining lexers any time soon...) Implementations of lexers in the high-level API are added on request. Let me know which ones you need. I can partially achieve both these things using the low-level API, but this entails needlessly duplicating a whole load of code which has already been done better by QScintilla. As I say, if I could only sub-class QextScintillaLexer in Python, all these problems would go away. If you are expecting to change the behaviour of the underlying Scintilla lexer by subclassing then you are going to be disappointed - Scintilla just isn't designed like that. (Scintilla is really a C program written in C++.) Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Lexers
On Tuesday 11 Jan 2005 09:22, you wrote: Call me stupid, but I still don't understand the problem. No Phil, call me stupid, because (surprise, surprise) it's me that doesn't understand the problem. This is what I get, I suppose, for not rolling my sleeves up and re-running the code that was causing me the problems. I won't bore you with the details of how I convinced myself of what I was so inarticulately trying to explain (probably some hangover from former days as a VB programmer). Anyway, thanks for taking the trouble to put me right on this - I'm sure you have far better things to do with your time. For what it's worth, though, I am sure I will now be able to achieve some things in my project that I previously thought impossible. So, back to the drawing-board... ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Lexers
Hello. I am in the middle of writing a text editor in Python using PyQt/QScintilla. I would like my editor to include syntax highlighting for HTML, XML, XSLT, etc. but I have found that QScintilla does not support these very well (or at all). There is a lexer for HTML, but the syntax highlighting seems very inaccurate. For example, it correctly colourises good syntax like a href=index.html, but then does the same for html-nonsense like href a=index.html. There is also no support for CSS. I thought I might be able to fix some of this myself by sub-classing QextScintillaLexerHTML. However, I soon found that several of the functions which have to be re-implemented return const char * rather than a QString. This means none of the lexers can be usefully sub-classed in Python because the QextScintilla class expects const char * return types when it sets/calls the lexers internally. My next step was to try creating my own lexer classes in Python using the low-level API. I had some success at this, but at the expense of features like auto-indentation which are only provided by QextScintilla when it's using one of its own lexers. If only I could sub-class QextScintillaLexer in Python! The next thing was to try learning a bit of C++ and write my own lexers. But then I had a look at the source code for the HTML lexer and thought again - all that stuff to handle the scripting languages made my head spin... My last hope was to try looking at something simpler, like the source code for the XML lexer - except that there is no real XML lexer because it is just an alias for the HTML lexer! The real point of all this is to introduce a couple proposals for improving the lexers in QScintilla. The first one is obvious: make QextScintillaLexer Python-friendly so it can be fully sub-classed. This will open up all the hidden languages (like CSS) to Python developers who want to go ahead and create their own lexer classes (or sub-classes). It's not clear from your explanation exactly what the problem is. Can you give some specific examples? And the second proposal is: include a purely markup-orientated XML lexer (i.e. one not based on the HTML lexer). This would then make it easy to add lexer classes for XHTML, XSLT, XSD, etc. by sub-classing from the XML lexer. QScintilla is a port of Scintilla, not an enhancement of it. If there are issues with how well lexers work (or if you want a new lexer) then these should be fixed in Scintilla itself and they will then appear in QScintilla. Phil ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Lexers
Thanks for your reply. On Monday 10 Jan 2005 10:27, you wrote: QScintilla is a port of Scintilla, not an enhancement of it. If there are issues with how well lexers work (or if you want a new lexer) then these should be fixed in Scintilla itself and they will then appear in QScintilla. Okay - I'll try the Scintilla mailing list on these issues. The real point of all this is to introduce a couple proposals for improving the lexers in QScintilla. The first one is obvious: make QextScintillaLexer Python-friendly so it can be fully sub-classed. It's not clear from your explanation exactly what the problem is. Can you give some specific examples? Phil If I was writing a Qt app in C++ which used QScintilla, I could just go ahead and sub-class QextScintillaLexer without any problems. But because I'm a Python programmer using QScintilla via PyQt, I can't. To make the Python problems explicit in code, here's how I might set a lexer language using QScintilla's low-level API: qsb.SendScintilla(qsb.SCI_SETLEXERLANGUAGE, QString('perl').latin1()) This works because QString can pass a const char* to the function even though Python can't do it itself. Here's the same thing from the C++ source code for QextScintilla.setLexer(): SendScintilla(SCI_SETLEXERLANGUAGE, lex - lexer()); Now if 'lex' is a Python sub-class of QextScintillaLexer that I have passed to setLexer(), I can't pull the QString trick any more. And since Python functions can't return const char*, whenever lex.lexer() gets called all I'll see is a segmentation fault. There are two reasons why I'm bothering with any of this. The first is because I want to set custom keyword lists. This would allow me to, say, provide HTML syntax highlighting to suit different browsers or different versions of the w3c standards. The second is to access more of Scintilla's 60 lexers by creating my own lexer classes. (I assume QScintilla won't be implementing classes for all 50 of the remaining lexers any time soon...) I can partially achieve both these things using the low-level API, but this entails needlessly duplicating a whole load of code which has already been done better by QScintilla. As I say, if I could only sub-class QextScintillaLexer in Python, all these problems would go away. ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla Lexers
On Monday 10 January 2005 15:38, yawber wrote: If I was writing a Qt app in C++ which used QScintilla, I could just go ahead and sub-class QextScintillaLexer without any problems. But because I'm a Python programmer using QScintilla via PyQt, I can't. PyQt includes a sip binding for QextScintillaLexer (and subclasses), meaning it can be imported into a Python program and subclassed. I'm not sure of the mechanics of getting this to work with the rest of QScintilla, but it looks like it should be possible. Jim ___ PyKDE mailing listPyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re:[PyKDE] QScintilla bug and workaround
Hi Torsten and List User, I had the same problem with AltGR but another solution, maybe useful for those who do not like to patch QScintilla at C-Level: Thank you for your analysis, I did check the ascii-value first and then just set the state to 0 to pass just the ascii - key. But your solution is the better one Regards, Timo Just subclass the keyPressEvent Handler and modify it, class SomeClassEdit(QextScintilla): def __init__(self,parent=None,name=None,flags=0): QextScintilla.__init__(self, parent, name, flags | Qt.WDestructiveClose) ... blabala ... def keyPressEvent(self,ke): # In windows scintilla, Alt Gr expansion lead to command expansion # and thus with German keyboards and others no characters which need # alt gr can be composed # Workaround : Subclass KeyEvent-Handler and modify Key-Event for # to translate Alt and Control to Meta # # if ke.state() == Qt.AltButton | Qt.ControlButton : mke = QKeyEvent(ke.type(),ke.key(),ke.ascii(),Qt.MetaButton,ke.text()) ke.accept() QextScintilla.keyPressEvent(self,mke) else: QextScintilla.keyPressEvent(self,ke) ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] qscintilla python example?
On Monday 23 August 2004 8:56 pm, Jay Lyerly wrote: Hi, I'm starting on a PyQT project that needs an editor component for python files. I figured I'd use qscintilla, since its already installed as part of pyqt. What I can't find is a nice simple example of using it in practice. Are there any such simple implementations? (Simpler than eric, i mean). Attached. Maybe you could add it to the Wiki? For that matter, is there another choice I should consider? Phil ed.py Description: application/python ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla for windows
On Sunday 18 April 2004 1:39 am, Dianhong wrote: Hi, I just bought a BlackAdder personal edition, which includes pyQt, qt, sip, but it does not include QScintilla, which is needed for eric3. So can anyone be kind tell me how to build and install Build and install QScintilla for windows? You have to buy the commercial versions of Qt and PyQt. Phil ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QScintilla
On Friday 20 June 2003 7:34 am, Philippe A. Bouchard wrote: Hi, I am having problems compiling QScintilla under MinGW: Creating library file: C:\UNIX\local\lib\libqscintilla.a Editor.o(.text+0xeb3f):Editor.cxx: undefined reference to `Document::FindTextA(int, int, char const*, bool, bool, bool, bool, bool, int*)' Editor.o(.text+0xec08):Editor.cxx: undefined reference to `Document::FindTextA(int, int, char const*, bool, bool, bool, bool, bool, int*)' Editor.o(.text+0xecee):Editor.cxx: undefined reference to `Document::FindTextA(int, int, char const*, bool, bool, bool, bool, bool, int*)' Editor.o(.text+0x14137):Editor.cxx: undefined reference to `Document::FindTextA(int, int, char const*, bool, bool, bool, bool, bool, int*)' Editor.o(.text+0x149a1):Editor.cxx: undefined reference to `Document::FindTextA(int, int, char const*, bool, bool, bool, bool, bool, int*)' C:\UNIX\local\bin\make.exe: *** [C:\UNIX\local\lib\qscintilla.dll] Error 1 Is this the GPL version of QScintilla? Phil ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde