[PyKDE] ConvertToSubClassCode
Hi, My difficulties to translate this C++ idiom to Python: bool Plot::eventFilter(QObject *object, QEvent *e) { if ( e-type() == QEvent::Resize ) { const QSize size = ((QResizeEvent *)e)-size(); if ( object == (QObject *)axis(yLeft) ) // HOW TO THIS IN PYTHON? { // ... } } return QwtPlot::eventFilter(object, e); } were due to the fact that I did not implement ConvertToSubClassCode for the Qwt widgets. Therefore, the 'is' operator did not work as expected. Since Qwt is more of a bunch of widgets than a neat hierarchy like PyKDE, the most natural choice is to convert down from a QObject to a specific subclass. As far as I understand, the sipc module knows how to handle more than one static PyObject *sipSubClass_QObject(const QObject *sipCpp) (as long as they are implemented in different modules), but sip does not support it. I sneaked my way out (for sip-3.8) by coding: %C++Code // Hack: more than 1 sipSubClass_QObject() is not supported by sip. // So we do it, with a little bit of help from pyqwt_sip_output_patch.py static PyObject *sipSubClass_QObject(const QObject *sipCpp) { // The table of Python class objects indexed by their names. // The table must be sorted by name. ... return sipMapStringToClass( sipCpp-className(), map, sizeof(map)/sizeof(map[0])); } %End And patching sip's output like this: static PyObject *registerClasses(PyObject *,PyObject *) { if (sipRegisterClasses(sipModule,-1) 0) return NULL; // pyqwt_sip_output_patch.py sipRegisterSubClassConvertor(sipClass_QObject,(PyObject *(*)(const void* ))sipSubClass_QObject); /* Register the module's sub-class convertors. */ ... - Question: wouldn't it be possible to implement a %ConvertToSubClassCodeFrom FromObject directive to handle the cases that extensionmodules want to convert down from QObject (or other used superclasses)? Gerard ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] PyKDE Components preliminary release
On Monday November 17 2003 20:18, David Boddie wrote: Jim's release of PyKDE 3.8 took me by surprise and I've been racing to catch up with this assortment of prototype components for PyKDE: http://www.boddie.org.uk/david/Projects/Python/KDE/index.html Documentation is currently minimal and is mainly found through the installer. The quality of the presentation is nowhere near as impressive as that of Jim's wabbit tool (PyKDE initiates, type wabbit at the command line!) but there should be enough there to indicate what each component does. I hope people are reading the rest of the HTML docs in PyKDE/docs too. At the command line, launch the installation tool from its parent directory by typing: python config.py Those who get as far as installing the Wiki KPart (KParts/EmbedWiki) will find some unfinished documentation in the Docs subdirectory. I'm aiming to add to that, convert it to HTML and distribute it to each of the other components. Additions to the documentation could be useful, although I imagine that the bulk of those will result from documenting the code. Some of the other components probably have too narrow an appeal for inclusion in the general PyKDE package. The Spritefile processing ones are of interest to a couple of people (we get a kick out of seeing these things as thumbnails) but its rather tedious to expect people to install dependencies and locate appropriate files for a minority file format. Suggestions for alternative formats are welcome! Have fun experimenting and let me know what problems you encounter. I'm happy to see this released and (as I told David a few weeks ago but haven't gotten around to it yet) am really looking forward to playing with some of this - especially the Wike KPart, which I think sounds brilliant. David and I agreed (I think) to make this a separate project - my thought was to add it to PyKDE in contrib/ (and build separately - David writes good build scripts, too), but a standalone project is equally good (or maybe better). Also coming in the (near?) future is Roland Schulz's plugins for enabling Python-developed widgets in QtDesigner and with QWidgetFactory. (Roland - I haven't forgotten the libpythonize problem, but I've been tied up on other stuff). I owe both David and Roland some testing and maybe some libpythonize fixing. P.S. Jim, PyKDE built first time! :-) Cool! Jim ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] Need to know who triggers a callback?
kscalet wrote: Gordon Tyler wrote: kscalet wrote: what would be the best approach in finding out, if a signal is send due to a real gui action like key-presses and mouse-clicks, or due to a programmatic action like setButton, setCurrentText, etc on a specific widget. It's often needed to trigger some action only in the former case, so I assume, there is an easy way to find out the source of action, but did not find it out myself. http://doc.trolltech.com/3.2/qobject.html#sender This looks more like a solution to my 2nd problem. Or is there some more info I can get from the sender (activated by gui-clicking / activated by set-function)? As of Phil, there isn't. What are you actually trying to accomplish here? What is the specific case? http://doc.trolltech.com/3.2/qsignalmapper.html If I understand this correctly, it would give me a nice way to, say, map 3 QButtons (no data!) to one slot. Yep. Ciao, Gordon ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] DCOP Problems and Solutions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'd be interested in hearing opinions on any of this. I'll make some decision on kab in the next few days depending on what feedback I get. Now obviously I'm for putting kab in pyKDE :) I'm not sure what kjs exactly does - but working in python and then allowing java-script for scripting - doesn't make much sense to me. For the problem I want kab for - python play out its strenghs when dealing with conversions between different sorts of (string-based) formats. And there's plethorea of PDA/CellPhones out there, that could benefit from an fairly easy way to be synchronized, because all of them have their own format... Of course I'm not sure what kdepim is up to - maybe they will change great parts of the related interface, so putting effort into kab would make not much sense - at least now. Does anybody know what they are going to change for kde 3.2? Regards, Diez -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/umIKBUNnEs5xWG4RAg82AJ9LOfDpMA3lE9PzpKXrThaCx/YzKgCgms0L 7inbkTCV7A1fBuMUHkyZtpo= =0YOq -END PGP SIGNATURE- ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] DCOP Problems and Solutions
On Tuesday November 18 2003 10:16, Diez B. Roggisch wrote: I'd be interested in hearing opinions on any of this. I'll make some decision on kab in the next few days depending on what feedback I get. Now obviously I'm for putting kab in pyKDE :) I'm not sure what kjs exactly does - but working in python and then allowing java-script for scripting - doesn't make much sense to me. kjs is in PyKDE because it fits in with khtml (and more likely because it was fairly easy to add). For the problem I want kab for - python play out its strenghs when dealing with conversions between different sorts of (string-based) formats. And there's plethorea of PDA/CellPhones out there, that could benefit from an fairly easy way to be synchronized, because all of them have their own format... It seems like a good Python application to me - the first program I did with Python/PyKDE was an address book (before I started maintaining PyKDE). Of course I'm not sure what kdepim is up to - maybe they will change great parts of the related interface, so putting effort into kab would make not much sense - at least now. Does anybody know what they are going to change for kde 3.2? Just from looking at 3.2 briefly, it appears that the address book application (along with KMail, KOrganizer and some other stuff) will all be rolled into kontact but still remain as standalone applications. I would expect the kab lib won't change much though. I'd also like to be able to script kontact eventually (and a lot of it is plugin-based already). Jim ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] ConvertToSubClassCode
On Tuesday 18 November 2003 7:35 am, Gerard Vermeulen wrote: Hi, My difficulties to translate this C++ idiom to Python: bool Plot::eventFilter(QObject *object, QEvent *e) { if ( e-type() == QEvent::Resize ) { const QSize size = ((QResizeEvent *)e)-size(); if ( object == (QObject *)axis(yLeft) ) // HOW TO THIS IN PYTHON? { // ... } } return QwtPlot::eventFilter(object, e); } were due to the fact that I did not implement ConvertToSubClassCode for the Qwt widgets. Therefore, the 'is' operator did not work as expected. Since Qwt is more of a bunch of widgets than a neat hierarchy like PyKDE, the most natural choice is to convert down from a QObject to a specific subclass. As far as I understand, the sipc module knows how to handle more than one static PyObject *sipSubClass_QObject(const QObject *sipCpp) (as long as they are implemented in different modules), but sip does not support it. I don't understand - sip does support it, look at qtable.sip or qcanvas.sip. Or am I missing something? Phil ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[PyKDE] QToolButton Problem ...
Hi All, after installing PyQt-x11-gpl-3.8.1, sip-x11-gpl-3.8 and Python-2.2.3 I got the follwing error message when I run the example application.py: linux90:/opt/PyQt-x11-gpl-3.8.1/examples2 # python application.py Traceback (most recent call last): File application.py, line 273, in ? mw = ApplicationWindow() File application.py, line 107, in __init__ self.fileOpen = QToolButton(openIcon,'Open File',QString.null,self.load,self.fileTools,'open file') File /usr/local/lib/python2.2/site-packages/qt.py, line 843, in __init__ libqtc.sipCallCtor(20,self,args) TypeError: Argument 1 of QToolButton() has an invalid type Is there a fix available ?? Regards Armin Steinhoff ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
Re: [PyKDE] QToolButton Problem ...
On Tuesday 18 November 2003 16:41, Armin Steinhoff wrote: Hi All, [snip] self.fileOpen = QToolButton(openIcon,'Open File',QString.null,self.load,self.fileTools,'open file') File /usr/local/lib/python2.2/site-packages/qt.py, line 843, in __init__ libqtc.sipCallCtor(20,self,args) TypeError: Argument 1 of QToolButton() has an invalid type Is there a fix available ?? Is openIcon a valid QImage object? If not, that's most likely the problem. -- Randy Carnahan Charter Communications 1-888-968-3442 SW::POP Michigan Region I am Geek. Hear me Code! ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde