Re: [PyKDE] Problem building PyQt-x11-gpl-snapshot-20030120
On Sat, Jan 25, 2003 at 12:24:14AM +0100, Laurent Rathle wrote: Le Vendredi 24 Janvier 2003 19:31, Phil Thompson a ?crit : Are you also using the latest SIP snapshot? I've installed it, but now make complains : In file included from sipqtQCDEStyle.h:31, from qtcmodule.cpp:42: sipqtQMotifStyle.h:52: parse error before `{' token sipqtQMotifStyle.h:55: destructors must be member functions sipqtQMotifStyle.h:59: non-member function `QVariant property(const char*)' cannot have `const' method qualifier sipqtQMotifStyle.h:66: non-member function `QPixmap stylePixmap(QStyle::StylePixmap, const QWidget*, const QStyleOption)' cannot have `const' method qualifier sipqtQMotifStyle.h:67: non-member function `int styleHint(QStyle::StyleHint, const QWidget*, const QStyleOption, QStyleHintReturn*)' cannot have `const' method qualifier sipqtQMotifStyle.h:68: non-member function `QSize sizeFromContents(QStyle::ContentsType, const QWidget*, const QSize, const QStyleOption)' cannot have `const' method qualifier sipqtQMotifStyle.h:69: non-member function `int pixelMetric(QStyle::PixelMetric, const QWidget*)' cannot have `const' method qualifier sipqtQMotifStyle.h:70: non-member function `QStyle::SubControl querySubControl(QStyle::ComplexControl, const QWidget*, const QPoint, const QStyleOption)' cannot have `const' method qualifier sipqtQMotifStyle.h:71: non-member function `QRect querySubControlMetrics(QStyle::ComplexControl, const QWidget*, QStyle::SubControl, const QStyleOption)' cannot have `const' method qualifier and it's just the beginning. I guess it's because it's a snapshot ? In general, there are very little problems with Phil's snapshots. Looking in my 3.5 build I see that line 52 gives: class SIP_MODULE_EXTERN sipQMotifStyle : public QMotifStyle Please read README.Linux and check if it applies to your Mandrake distribution. Does your compiler complain about missing header files? Try to stuff the -Wall flag in the makefiles. Gerard ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] How to add more widgets to a QScrollView once the exec_loop start s?
On Wednesday 22 January 2003 4:55 pm, Tuvi, Selim wrote: Hi, I am developing an application that has a QScrollView widget in it. The QScrollView widget has a QVBox in which I add more widgets. When I initially add the widgets before the exec_loop starts I can see what I added on the screen. But if I add them through a button click event then the widgets do not get added (or they get added but I can not see them). Widgets are hidden when they are first created so those that are created after the w.show() must be shown explicitly. Add l.show() after creating the QLabel. Phil ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Proper way to show multiple windows?
Ken, I did the isModal() check and it returned 0 but using nw.show() does not leave the window up it just flashes away. If I use nw.exec_loop() then the window stays up but I can't open another on. This was so easy to do in wxpython. It must be as easy here I just can't figure it out SG --- Kenneth Godee [EMAIL PROTECTED] wrote: Ok, here's a couple of things to try/look at Did you do a isModal() on your nw instance? This will return true or false, don't assume it's not modal because you gave it = 0 Try nw.show() instead of nw.exec.loop() Show() I believe will pass control back to calling program. You might have to put the calling program/window into a while loop. Just a couple of ideas. What your trying to do should work. The reason I wanted to see the rest of the inhert calls, is because PyQt has a limit of like two inherts. SearchScreen.__init__(self,parent,name,modal,fl) def newWin(self): nw = custDetailImp() nw.exec_loop() class musicDetail(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) --- Kenneth Godee [EMAIL PROTECTED] wrote: For the most help, please cc the list. Ok, like I said I'm pretty new to this But I'm still trying to see what qt class/widget your basing your class on nw = musicDetailimp, which inherts musicDetail, which herits For instance, I've a form that calls a fuction that produces a dialog window. 1. def srch_dialog(self, vparent): srch = srch_class(parent = vparent, modal = 1) 2. class srch_class(SearchForm): def __init__(self,parent = None,name = None,modal = 0,fl = 0): SearchForm.__init__(self,parent,name,modal,fl) 3. class SearchForm(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) The widget I'm basing every thing on is QDialog. -- Ok, I've another form, maybe better example... This form has a listbox in it. When I click on a item in the list box it calls this function... def func_addialog(self,value,invnum): # creates instance of dialog window cac = createcopy(parent = value, modal = 1, fl = 0) class createcopy(addcopy): def __init__(self,parent = None,name = None,modal = 0,fl = 0): addcopy.__init__(self,parent,name,modal,fl) class addcopy(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) -- Another thing I find helpfull is to make sure the window your is truley modal or not? Have you used the isModal()?, I've had many times I thought I called it one thing and turned out to be another. Also look into the difference between exec_loop() and show() Just some thoughts. Ken On Thu, 23 Jan 2003 21:21:08 -0800 (PST) star gazer [EMAIL PROTECTED] wrote: Thanks for the help. here is a snippet of the mainclass... class searchMenuImp(SearchScreen): def __init__(self,parent = None,name = None,modal = 0,fl = 0): SearchScreen.__init__(self,parent,name,modal,fl) self.lv_search.setAllColumnsShowFocus(1) def newWin(self): nw = musicDetailImp() nw.exec_loop() from a imported file is the ref to ... class musicDetailImp(musicDetail): def __init__(self,parent = None,name = None,modal = 0,fl = 0): musicDetail.__init__(self,parent,name,modal,fl) Thanks Star Gazer --- Kenneth Godee [EMAIL PROTECTED] wrote: On Thu, 23 Jan 2003 16:08:03 -0800 (PST) star gazer [EMAIL PROTECTED] wrote: I'm trying to figure out the correct way to display multiple windows, filled with info, based on a mysql lookup by double-clicking on a line in a QListView box. I have the lookup working the Qlistview working and I have the info screen working. The problem is I am not sure of the correct way to display the info screens. In Wxpython I did the following procedure, it allowed me to dbl-clk on as many items as I wanted to just by going back to the master window and dbl-clking on another line and it would open another === message truncated === __ Do you Yahoo!? Yahoo! Mail Plus - Powerful.
Re: [PyKDE] Next attempt to tackle QSpinBox strangeness
On Friday 24 January 2003 1:43 pm, Hans-Peter Jansen wrote: On Thursday 23 January 2003 19:46, me wrote: Problem: reimplemented QSpinBox don't get focus events and doesn't behave correctly on up/down cursor key events (value doesn't change). Also, manually editing the QSpinBox value doesn't generate a valueChanged signal, nor does it revert invalid values. Therefore, I'm going to translate this app to c++ in order to check this behaviour of Qt directly soon. Done, attached. Looks like the c++ version doesn't generate focus events, either, but behaves correctly on cursor keys and manual editing. Consequently both actions generate a valueChanged signal, unlike the py version. Thanks for putting the effort into this - it was very helpful. The bug is that qspinbox.sip should say... bool eventFilter(QObject *,QEvent *); ...instead of... void eventFilter(QObject *,QEvent *); It will be fixed in tonight's snapshot. Interesting side note: I needed to prepare the event() handlers not to call the base class in order to avoid an attribute error during qApp.quit(). Phil, it appears, that the QSpinBox base class disappears while subclassed SpinBox event() handler is active. This doesn't look right to me. While making both versions functional identical, I've rewritten the event decoder qEvent(), but couldn't believe my eyes: during qApp.quit() the value of the global defined qEventDict{} in the .py script is replaced with a None value somewhere under the covers! Please remove the try/except statement in qEvent, uncomment the print statement and look yourself: close app PushButton event: type 'NoneType' Traceback (most recent call last): File sbtest.py, line 121, in event print PushButton event:, qEvent(t) File sbtest.py, line 79, in qEvent if t in qEventDict.keys(): AttributeError: 'NoneType' object has no attribute 'keys' SpinBox event: type 'NoneType' Traceback (most recent call last): File sbtest.py, line 96, in event print SpinBox event:, qEvent(t) File sbtest.py, line 79, in qEvent if t in qEventDict.keys(): Something is definitely going wrong here. I think this is just Python and Qt racing each other to tidy up. As the behaviour of either isn't formally documented I think it's more a feature rather than a bug. Phil ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
[PyKDE] sip macro expansion
Hi Phil, is it possible to escape a '$' as part of a sip .pro-file template? E.g. if I want to have a line like LIBS = $$(PRESIP_LIBS) (which is a valid qmake construct) to appear in my .pro file, sip swallows the first $ because of the macro expansion. If I try with $$$(PRESIP_LIBS) it complains about an invalid macro. Is there a way to get $$(BLAH) into the resulting .pro - file? Yours, -- :M: -- Dipl.-Inf. Michael 'Mickey' Lauer [EMAIL PROTECTED] Raum 10b - ++49 69 798 28358 Fachbereich Informatik und Biologie -- ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Proper way to show multiple windows?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Saturday 25 January 2003 16:30, star gazer wrote: Ken, I did the isModal() check and it returned 0 but using nw.show() does not leave the window up it just flashes away. If I use nw.exec_loop() then the window stays up but I can't open another on. This was so easy to do in wxpython. It must be as easy here I just can't figure it out Non-modal windows are a piece of cake. See (and buy...): http://www.opendocs.org/pyqt/index.lxp?lxpwrap=x6734%2ehtm - -- Boudewijn Rempt | http://www.valdyas.org/index2.html -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE+Mrc2daCcgCmN5d8RAj8rAKCgFVNImFOQJ/UabdsMAA+Mqal0MQCgrv50 +PuslgHBkddtlMDDNuQgoDU= =Jhqk -END PGP SIGNATURE- ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] sip macro expansion
On Saturday 25 January 2003 4:13 pm, Michael Lauer wrote: Hi Phil, is it possible to escape a '$' as part of a sip .pro-file template? E.g. if I want to have a line like LIBS = $$(PRESIP_LIBS) (which is a valid qmake construct) to appear in my .pro file, sip swallows the first $ because of the macro expansion. If I try with $$$(PRESIP_LIBS) it complains about an invalid macro. Is there a way to get $$(BLAH) into the resulting .pro - file? Use a pair of $ for every single $ you want in the output, ie. (BLAH). Phil ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Problem building PyQt-x11-gpl-snapshot-20030120
Le Samedi 25 Janvier 2003 10:39, Gerard Vermeulen a écrit : Please read README.Linux and check if it applies to your Mandrake distribution. Does your compiler complain about missing header files? Try to stuff the -Wall flag in the makefiles. I found that it does'nt apply. So the compilation went right. I did make, make install, but now, when I want to install Eric, it complains that PyQt is not here. In fact, it has problem with this : import qVersion, PYQT_VERSION in the build.py. It can't import qVersion and PYQT_VERSION. I have libt3.1-devel with PyQt. Thank you for your help, -- [EMAIL PROTECTED] http://www.kde-france.org ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Problem building PyQt-x11-gpl-snapshot-20030120
Did you try some of the examples that come with PyQt? The next problem may be that a static library got stripped of all its symbols: it is called something like libqassistant.a. Test it from your python interpreter: import qt. If it complains about Assistant related stuff, you have to search this list for workarounds. If the build library is different from the install library, the static libraries get stripped to much. If this is the problem. Please report it to Mandrake. Gerard Le Samedi 25 Janvier 2003 10:39, Gerard Vermeulen a écrit : Please read README.Linux and check if it applies to your Mandrake distribution. Does your compiler complain about missing header files? Try to stuff the -Wall flag in the makefiles. I found that it does'nt apply. So the compilation went right. I did make, make install, but now, when I want to install Eric, it complains that PyQt is not here. In fact, it has problem with this : import qVersion, PYQT_VERSION in the build.py. It can't import qVersion and PYQT_VERSION. I have libt3.1-devel with PyQt. Thank you for your help, -- [EMAIL PROTECTED] http://www.kde-france.org ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde - This message was sent using HTTPS service from CNRS Grenoble. --- https://grenoble.cnrs.fr --- ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
[PyKDE] Now tackle dtor strangeness
On Saturday 25 January 2003 17:02, Phil Thompson wrote: Thanks for putting the effort into this - it was very helpful. The bug is that qspinbox.sip should say... bool eventFilter(QObject *,QEvent *); ...instead of... void eventFilter(QObject *,QEvent *); It will be fixed in tonight's snapshot. Thanks. Well done. I feel better now. But please have another look into these two: qApp.quit(). Phil, it appears, that the QSpinBox base class disappears while subclassed SpinBox event() handler is active. This doesn't look right to me. While making both versions functional identical, I've rewritten the event decoder qEvent(), but couldn't believe my eyes: during qApp.quit() the value of the global defined qEventDict{} in the .py script is replaced with a None value somewhere under the covers! Please remove the Something is definitely going wrong here. I think this is just Python and Qt racing each other to tidy up. As the behaviour of either isn't formally documented I think it's more a feature rather than a bug. Well, I cannot see the feature aspect here. OTOH, this obfuscates the code, and it defies the principle of least surprise. I digged into this a bit further and found a way to get around these problems somehow: 1) The qEventDict does survive, if it is declared inside the qEvent function. 2) just keep a reference of QSpinBox, and call it, instead of the baseclass: class SpinBox(QSpinBox): def __init__(self, minValue, maxValue, step = 1, parent = None, name = None): self.lastval = None QSpinBox.__init__(self, minValue, maxValue, step, parent, name) self.QSpinBox = QSpinBox def event(self, e): t = e.type() print SpinBox event:, qEvent(t) return self.QSpinBox.event(self, e) Funny side note: it was enough to fix one of both sub classes this way to prevent attribute errors here. This is pretty undeterministic, and that's exactly the reason, why I don't like this behaviour... Phil, one would expect, that as long as a class exists, its baseclass should exist, either. The same goes for globals in module scope. Note, that this happens, before dtor of QApplication aka PyQtDisownTopLevelWidgets(), and even siplib:finalise() is called: closeEvent exec_loop: 0 PushButton event: WindowDeactivate SpinBox event: WindowDeactivate PushButton event: FocusOut PushButton focusOutEvent PushButton event: Hide SpinBox event: Hide PyQtDisownTopLevelWidgets PyQtDisownTopLevelWidgets finalise begin finalise done Is it possible to keep a reference on these internally and throw them away in finalise()? For reference, current sbtest.py attached. Phil Pete #!/usr/bin/env python # sbtest v0.1: investigate QSpinBox strangeness # # Copyright 2002 Hans-Peter Jansen [EMAIL PROTECTED] # # This program is placed under the GNU General Public License V.2 import sys from qt import * # Just swap the _ of both qEventDicts to suppress the attribute errors qEventDict = { 0: None, 1: Timer, 2: MouseButtonPress, 3: MouseButtonRelease, 4: MouseButtonDblClick, 5: MouseMove, 6: KeyPress, 7: KeyRelease, 8: FocusIn, 9: FocusOut, 10: Enter, 11: Leave, 12: Paint, 13: Move, 14: Resize, 15: Create, 16: Destroy, 17: Show, 18: Hide, 19: Close, 20: Quit, 21: Reparent, 22: ShowMinimized, 23: ShowNormal, 24: WindowActivate, 25: WindowDeactivate, 26: ShowToParent, 27: HideToParent, 28: ShowMaximized, 29: ShowFullScreen, 30: Accel, 31: Wheel, 32: AccelAvailable, 33: CaptionChange, 34: IconChange, 35: ParentFontChange, 36: ApplicationFontChange, 37: ParentPaletteChange, 38: ApplicationPaletteChange, 39: PaletteChange, 40: Clipboard, 42: Speech, 50: SockAct, 51: AccelOverride, 52: DeferredDelete, 60: DragEnter, 61: DragMove, 62: DragLeave, 63: Drop, 64: DragResponse, 70: ChildInserted, 71: ChildRemoved, 72: LayoutHint, 73: ShowWindowRequest, 80: ActivateControl, 81: DeactivateControl, 82: ContextMenu, 83: IMStart, 84: IMCompose, 85: IMEnd, 86: Accessibility, 87: Tablet } def qEvent(t): _qEventDict = { 0: None, 1: Timer, 2: MouseButtonPress, 3: MouseButtonRelease, 4: MouseButtonDblClick, 5: MouseMove, 6: KeyPress, 7: KeyRelease, 8: FocusIn, 9: FocusOut, 10: Enter, 11: Leave, 12: Paint, 13: Move, 14: Resize, 15: Create, 16: Destroy, 17: Show, 18: Hide, 19: Close, 20: Quit, 21: Reparent, 22: ShowMinimized, 23: ShowNormal, 24: WindowActivate, 25: WindowDeactivate, 26: ShowToParent, 27: HideToParent, 28: ShowMaximized, 29: ShowFullScreen, 30: Accel, 31: Wheel,
Re: [PyKDE] Now tackle dtor strangeness
On Saturday 25 January 2003 11:07 pm, Hans-Peter Jansen wrote: On Saturday 25 January 2003 17:02, Phil Thompson wrote: Thanks for putting the effort into this - it was very helpful. The bug is that qspinbox.sip should say... bool eventFilter(QObject *,QEvent *); ...instead of... void eventFilter(QObject *,QEvent *); It will be fixed in tonight's snapshot. Thanks. Well done. I feel better now. But please have another look into these two: qApp.quit(). Phil, it appears, that the QSpinBox base class disappears while subclassed SpinBox event() handler is active. This doesn't look right to me. While making both versions functional identical, I've rewritten the event decoder qEvent(), but couldn't believe my eyes: during qApp.quit() the value of the global defined qEventDict{} in the .py script is replaced with a None value somewhere under the covers! Please remove the Something is definitely going wrong here. I think this is just Python and Qt racing each other to tidy up. As the behaviour of either isn't formally documented I think it's more a feature rather than a bug. Well, I cannot see the feature aspect here. OTOH, this obfuscates the code, and it defies the principle of least surprise. I digged into this a bit further and found a way to get around these problems somehow: 1) The qEventDict does survive, if it is declared inside the qEvent function. 2) just keep a reference of QSpinBox, and call it, instead of the baseclass: class SpinBox(QSpinBox): def __init__(self, minValue, maxValue, step = 1, parent = None, name = None): self.lastval = None QSpinBox.__init__(self, minValue, maxValue, step, parent, name) self.QSpinBox = QSpinBox def event(self, e): t = e.type() print SpinBox event:, qEvent(t) return self.QSpinBox.event(self, e) Funny side note: it was enough to fix one of both sub classes this way to prevent attribute errors here. This is pretty undeterministic, and that's exactly the reason, why I don't like this behaviour... Phil, one would expect, that as long as a class exists, its baseclass should exist, either. The same goes for globals in module scope. The class will exist (because the sub-class keeps a reference to it) but that doesn't mean that the reference to the class in (for example) the module's dictionary still exists. The problem is that the order in which a dictionary's elements are deleted isn't very deterministic. In your example qEventDict is being removed from the module dictionary before the qEvent function is removed. By moving qEventDict into the qEvent function you guarantee it will exist whenever qEvent is called. I would guess that the problem would also go away if you played with the names of qEvent and qEventDict so that they had hash values that caused them to appear in the module dictionary in the opposite order so that qEvent was deleted first. Phil ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Proper way to show multiple windows?
On Sat, Jan 25, 2003 at 07:30:43AM -0800, star gazer wrote: Ken, I did the isModal() check and it returned 0 but using nw.show() does not leave the window up it just flashes away. If I use nw.exec_loop() then the window stays up but I can't open another on. This was so easy to do in wxpython. It must be as easy here I just can't figure it out SG Using a used to tool (wxpython) should always be simple, but it isn't very hard to do a modal dialog in PyQt too ! That the window flashes is because you might create a local instance, which is destroyed at function exit !!! You have to store your window either in a global reference or put it into a list of known windows, where you can delete it once you don't need it anymore (that's what I do). def open_modal_window(self): self.controlledServers.append( ServerControlOv( self, self, Server Control, 0, 0) ) x = len(self.controlledServers)-1 self.controlledServers[x].show() It is quite easy to use container facilities of python. But most applications will be happy with static allocation: dialogA=None def open_modal_window(parent, control): global dialogA dialogA = ServerControlOv( parent, control, Server Control, 0, 0) ) dialogA.show() Anyway you have to use a variable that lives longer than your open function. ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde