Grant Tang | 1 Sep 03:53 2009
Picon

no response for mouse event in PyQt4 4.5.4

Hi,


We have an software EMAN2 which choose PyQt4 to implement the GUI interface. Which works fine until recently I upgrade my PyQt4 to 4.5.4. After the upgrading, I lose response to all mouse event, including mouse clicking on a 2D/3D image and mouse wheel (I use wheel to zoom in or out of image). I tried PyQt4 4.5.2, still no response for all mouse event. The mouse works perfectly fine for PyQt4 4.4.4. I doubt all 4.5 versions will not work. Could somebody help?

I post some pieces of code for my mouse wheel event, hope it help:  
class Main2DWindowEventHandler(BoxEventsHandler):
    def __connect_Signals_to_slots(self):
        QtCore.QObject.connect(self.main_2d_window.emitter(), QtCore.SIGNAL('mousewheel'), self.mouse_wheel())

class EMImage2DEmitMouseMode(EMImage2DMouseEvents):
    def mouse_wheel(self, event):
        seld.mediator.emit(QtCore.SIGNAL('mousewheel'), event)

#actual slot function
class EMImage2DModule(EMGUIModule):
    def weelEvent(self, event):
        #blah, blah
I tried to print out message in this slot function. It prints out in PyQt4.4.4 but nothing got printed in PyQt4.5.*.

Since it works fine with PyQt4 4.4.4 and previous versions. I doubt something new in 4.5.* make it not work.

Thanks for any comments, 

Grant
<div>
<p>Hi,</p>
<div><br></div>
<div>We have an software EMAN2 which choose PyQt4 to implement the GUI interface. Which works fine until recently I upgrade my PyQt4 to 4.5.4. After the upgrading, I lose response to all mouse event, including mouse clicking on a 2D/3D image and mouse wheel (I use wheel to zoom in or out of image). I tried PyQt4 4.5.2, still no response for all mouse event.&nbsp;The mouse works perfectly fine for PyQt4 4.4.4. I doubt all 4.5 versions will not work. Could somebody help?</div>
<div><br></div>
<div>I post some pieces of code for my mouse wheel event, hope it help: &nbsp;</div>
<div>class Main2DWindowEventHandler(BoxEventsHandler):</div>
<div>&nbsp;&nbsp; &nbsp;def __connect_Signals_to_slots(self):</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;QtCore.QObject.connect(self.main_2d_window.emitter(), QtCore.SIGNAL('mousewheel'), self.mouse_wheel())</div>
<div><br></div>
<div>class EMImage2DEmitMouseMode(EMImage2DMouseEvents):</div>
<div>&nbsp;&nbsp; &nbsp;def mouse_wheel(self, event):</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;seld.mediator.emit(QtCore.SIGNAL('mousewheel'), event)</div>
<div><br></div>
<div>
#actual slot function</div>
<div>class EMImage2DModule(EMGUIModule):</div>
<div>&nbsp;&nbsp; &nbsp;def weelEvent(self, event):</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;#blah, blah</div>
<div>I tried to print out message in this slot function. It prints out in PyQt4.4.4 but nothing got printed in PyQt4.5.*.</div>
<div><br></div>
<div>Since it works fine with PyQt4 4.4.4 and previous versions. I doubt something new in 4.5.* make it not work.</div>
<div><br></div>
<div>Thanks for any comments,&nbsp;</div>
<div>
<br>Grant<br>
</div>
</div>
Erik Janssens | 1 Sep 08:06 2009
Picon

Re: random deadlocks in pyqt application

Hello Giovanni,

Thanks again for your assistance.  I believe I'm handling
these things correctly, also there is no use of python threads
in the application. I will reread those things to make
sure.

But we do use python's Queue module, do you think this
might cause issues ?  As far as I can see there is nothing
in the behaviour of the application that suggests this.

Regards,

Erik

> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 31 Aug 2009 02:28:14 +0200
> From: Giovanni Bajo <rasky <at> develer.com>
> Subject: Re: [PyQt] random deadlocks in pyqt application
> To: erik.janssens <at> conceptive.be
> Cc: PyQT mailing list <pyqt <at> riverbankcomputing.com>
> Message-ID: <1251678494.4741.26.camel <at> ozzu>
> Content-Type: text/plain
> 
> On dom, 2009-08-30 at 11:22 +0200, Erik Janssens wrote:
> > Hi,
> > 
> > I'm having random deadlocks in my pyqt application (I don't do
> > any locking and such in the app itself, but the app has
> > 2 QThreads).
> > 
> > They appear to occur random when the application is used like
> > a madman (opening and closing windows all the time).  A strange
> > observation is that the chances for deadlock are higher when using
> > xvfb instead of the normal x display.  (I use this for running
> > unittests overnight)
> > 
> > I'm running Ubuntu 9.04 using python2.5 (the deadlocks also 
> > appear when using python2.6)
> > 
> > The first line in the stack trace is always :
> > 
> > "xcb_wait_for_reply () from /usr/lib/libxcb.so.1"
> > 
> > Has anybody seen this before or can give me a clue on how
> > to proceed with this issue ?
> 
> This exact segfault doesn't ring any bell to me, so I only have generic
> advices for you.
> 
> I saw many segfaults related to the fact that the QThreads are not being
> used in the way that they should:
> http://qt.nokia.com/doc/4.5/threads.html#threads-and-qobjects
> 
> Make sure that you are following all the advices in there.
> 
> Also, don't use Python's threading module if you're going to touch Qt's
> objects.

Hans-Peter Jansen | 1 Sep 09:02 2009
Picon

Re: no response for mouse event in PyQt4 4.5.4

Am Dienstag, 1. September 2009 schrieb Grant Tang:
> Hi,
> We have an software EMAN2 which choose PyQt4 to implement the GUI
> interface. Which works fine until recently I upgrade my PyQt4 to 4.5.4.
> After the upgrading, I lose response to all mouse event, including mouse
> clicking on a 2D/3D image and mouse wheel (I use wheel to zoom in or out
> of image). I tried PyQt4 4.5.2, still no response for all mouse event.
> The mouse works perfectly fine for PyQt4 4.4.4. I doubt all 4.5 versions
> will not work. Could somebody help?
>
> I post some pieces of code for my mouse wheel event, hope it help:
> class Main2DWindowEventHandler(BoxEventsHandler):
>     def __connect_Signals_to_slots(self):
>         QtCore.QObject.connect(self.main_2d_window.emitter(),
> QtCore.SIGNAL('mousewheel'), self.mouse_wheel())
                                               ^^
This looks wrong: calling the function, instead of leaving a reference, 
while mouse_wheel() does not look like returning any callable.

 
> class EMImage2DEmitMouseMode(EMImage2DMouseEvents):
>     def mouse_wheel(self, event):
>         seld.mediator.emit(QtCore.SIGNAL('mousewheel'), event)
          ^^^^
          self?

>
> #actual slot function
> class EMImage2DModule(EMGUIModule):
>     def weelEvent(self, event):
          ^^^^^^^^^
          wheelEvent?

>         #blah, blah
> I tried to print out message in this slot function. It prints out in
> PyQt4.4.4 but nothing got printed in PyQt4.5.*.
>
> Since it works fine with PyQt4 4.4.4 and previous versions. I doubt
> something new in 4.5.* make it not work.

If PyQt 4.5 events wouldn't work, guess how many complaints would arrive?
This is all so basic, that I doubt, the problem is in PyQt. 

Please provide  a minimum self-containing example of your issue.

Pete
tabish--> | 1 Sep 10:11 2009
Picon

has any one implemented a side bar like the one in Mac


i wanted to implement the side bar like the one in Mac had anyone implemented
it in Pyqt.
or does any one has any idea about how should i go about implementing it.
--

-- 
View this message in context: http://www.nabble.com/has-any-one-implemented-a-side-bar-like-the-one-in-Mac-tp25236085p25236085.html
Sent from the PyQt mailing list archive at Nabble.com.

Phil Thompson | 1 Sep 14:01 2009

Re: Sip iterator question

On Mon, 31 Aug 2009 16:24:13 +0200, Sébastien Petitdemange
<sebastien.petitdemange <at> esrf.fr> wrote:
> David Boddie wrote:
>> On Mon, 24 Aug 2009 13:08:44 +0200, Sebastien Petitdemange wrote:
>> 
>>> Sébastien Petitdemange wrote:
>> 
>>>> I try to create an iterator using python iterator protocol but I
didn't
>>>> succeed.
>> 
>> [...]
>> 
>>>> Data_HeaderContainer_itemIterator* __iter__();
>>>> %MethodCode
>>>> sipRes = sipCpp;
>>>> %End
>>>> };
>>>>
>>>> and we I use it in python, It say that my object is not an iterator :
>>>>
>>>> for k in i:
>>>> ...     print k
>>>> ...
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>> TypeError: 'Data_HeaderContainer_itemIterator' object is not iterable
>>>>
>>>> what I'm I missing?
>> 
>> Maybe the value returned by __iter__() isn't what the interpreter is
>> expecting. Having said that, I think it's possible that the type
>> structure
>> information created by SIP doesn't have the necessary fields filled in
to
>> allow the object to be used to create an iterator, even if you define
>> __iter__() for this purpose.
>> 
>> Has anyone else encountered this problem, perhaps with tools other than
>> SIP?
>> 
>> David
>> 
>> _______________________________________________
>> PyQt mailing list    PyQt <at> riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>> 
> As a conclusion, to create an iterator in C for python, you have to
> define tp_iter slot and it seems that SIP don't yet recognize __iter__
> as a slot that why it doesn't work.
> 
> Hope this feature will be add to SIP!

Tonight's snapshot will have support for __iter__ and __next__.

Note that it's __next__ (and not next) even for Python v2.

Phil
David Boddie | 1 Sep 14:16 2009

Re: Sip iterator question

On Tue Sep 1 13:01:14 BST 2009, Phil Thompson wrote:

> Tonight's snapshot will have support for __iter__ and __next__.

Cool. :-)

> Note that it's __next__ (and not next) even for Python v2.

Though, curiously, next() appears to work, which is why I didn't notice that.
It's even in the tutorial:

  http://docs.python.org/tutorial/classes.html#iterators

David
Victor Noagbodji | 1 Sep 15:49 2009
Picon

re: has any one implemented a side bar like the one in Mac

what does it exactly look like?

--

-- 
paul victor noagbodji
tabish--> | 1 Sep 16:06 2009
Picon

Re: re: has any one implemented a side bar like the one in Mac


nvictor wrote:
> 
> what does it exactly look like?
> 
> -- 
> paul victor noagbodji
> _______________________________________________
> PyQt mailing list    PyQt <at> riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 
> 
http://www.nabble.com/file/p25240876/MainSidebarIllustration-main_Full.jpg 
--

-- 
View this message in context: http://www.nabble.com/has-any-one-implemented-a-side-bar-like-the-one-in-Mac-tp25236085p25240876.html
Sent from the PyQt mailing list archive at Nabble.com.

Victor Noagbodji | 1 Sep 17:38 2009
Picon

re: has any one implemented a side bar like the one in Mac

isn't that just a QTreeWidget? the QTreeWidgetItems are customized.
the close button can also easily be implemented.

--

-- 
paul victor noagbodji
Christian Caron | 1 Sep 18:45 2009

Snow Leopard

I can't seem to compile PyQt on Snow Leopard.

I installed Snow Leopard with the xcode that came with the disk.

Built Qt 4.5.2: ./configure -opensource -framework -no-qt3support -fast 
Built SIP 4.8.2
PyQt 4.5.4: When I run python configure.py it determines that only PyQt4.QtCore will be built. I looked in configure.py and all the other cfgtext_* fail to build with the following error message: 

ccaron$ g++ -DQT_NO_DEBUG -DQT_GUI_LIB -I. -I/usr/local/Trolltech/Qt-4.5.2/mkspecs/default -I/usr/local/Trolltech/Qt-4.5.2/lib/QtGui.framework/Headers -I/usr/local/Trolltech/Qt-4.5.2/include -pipe -Os -w cfgtest_QtGui.cpp -o cfgtest_QtGui -F/usr/local/Trolltech/Qt-4.5.2/lib -L/usr/local/Trolltech/Qt-4.5.2/lib -headerpad_max_install_names -framework QtGui -L/usr/local/Trolltech/Qt-4.5.2/lib -F/usr/local/Trolltech/Qt-4.5.2/lib -framework Carbon -framework AppKit -framework QtCore -L/usr/local/Trolltech/Qt-4.5.2/lib -lz -lm -framework ApplicationServices
In file included from /usr/local/Trolltech/Qt-4.5.2/include/QtGui/qmatrix.h:46,
                 from /usr/local/Trolltech/Qt-4.5.2/include/QtGui/qbrush.h:49,
                 from /usr/local/Trolltech/Qt-4.5.2/include/QtGui/qpalette.h:47,
                 from /usr/local/Trolltech/Qt-4.5.2/lib/QtGui.framework/Headers/qwidget.h:48,
                 from cfgtest_QtGui.cpp:1:
/usr/local/Trolltech/Qt-4.5.2/include/QtGui/qregion.h: In member function ‘OpaqueRgnHandle* QRegion::handle(bool) const’:
/usr/local/Trolltech/Qt-4.5.2/include/QtGui/qregion.h:158: error: ‘toQDRgn’ was not declared in this scope

What am I doing wrong?
<div>I can't seem to compile PyQt on Snow Leopard.<div><br></div>
<div>I installed Snow Leopard with the xcode that came with the disk.</div>
<div><br></div>
<div>Built Qt 4.5.2:&nbsp;<span class="Apple-style-span">./configure -opensource -framework -no-qt3support -fast&nbsp;</span>
</div>
<div><span class="Apple-style-span">Built SIP 4.8.2</span></div>
<div><span class="Apple-style-span">PyQt 4.5.4: When I run python configure.py it determines that only PyQt4.QtCore will be built. I looked in configure.py and all the other cfgtext_* fail to build with the following error message:&nbsp;</span></div>
<div><span class="Apple-style-span"><br></span></div>
<div><span class="Apple-style-span"><span class="Apple-style-span"><div><span class="Apple-style-span">ccaron$ g++ -DQT_NO_DEBUG -DQT_GUI_LIB -I. -I/usr/local/Trolltech/Qt-4.5.2/mkspecs/default -I/usr/local/Trolltech/Qt-4.5.2/lib/QtGui.framework/Headers -I/usr/local/Trolltech/Qt-4.5.2/include -pipe -Os -w cfgtest_QtGui.cpp -o cfgtest_QtGui -F/usr/local/Trolltech/Qt-4.5.2/lib -L/usr/local/Trolltech/Qt-4.5.2/lib -headerpad_max_install_names -framework QtGui -L/usr/local/Trolltech/Qt-4.5.2/lib -F/usr/local/Trolltech/Qt-4.5.2/lib -framework Carbon -framework AppKit -framework QtCore -L/usr/local/Trolltech/Qt-4.5.2/lib -lz -lm -framework ApplicationServices</span></div>
<div><span class="Apple-style-span">In file included from /usr/local/Trolltech/Qt-4.5.2/include/QtGui/qmatrix.h:46,</span></div>
<div><span class="Apple-style-span">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from /usr/local/Trolltech/Qt-4.5.2/include/QtGui/qbrush.h:49,</span></div>
<div><span class="Apple-style-span">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from /usr/local/Trolltech/Qt-4.5.2/include/QtGui/qpalette.h:47,</span></div>
<div><span class="Apple-style-span">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from /usr/local/Trolltech/Qt-4.5.2/lib/QtGui.framework/Headers/qwidget.h:48,</span></div>
<div><span class="Apple-style-span">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from cfgtest_QtGui.cpp:1:</span></div>
<div><span class="Apple-style-span">/usr/local/Trolltech/Qt-4.5.2/include/QtGui/qregion.h: In member function &lsquo;OpaqueRgnHandle* QRegion::handle(bool) const&rsquo;:</span></div>
<div><span class="Apple-style-span">/usr/local/Trolltech/Qt-4.5.2/include/QtGui/qregion.h:158: error: &lsquo;toQDRgn&rsquo; was not declared in this scope</span></div>
<div><br></div>
<div>What am I doing wrong?</div></span></span></div>
</div>

Gmane