[PyQt] How to detect if event loop is already running?

2012-01-09 Thread Panupat Chongstitwattana
Running PyQt inside Maya 2010.

If I start a UI and haven't closed it, running the script again will
completely freeze Maya and I get the message about The event loop is
already running.

I can prevent that by manually clicking the [x] button to close the UI
before I rerun the script. But I'm wondering if there's any condition I can
check if the UI is already running? And possibly force close it?

I've checked some other emails suggesting __name__ = __main__ method, but
since my script will always be run inside Maya, the __name__ will never be
equal to __main__ I suppose.

Thanks.

Best regard,
Panupat C.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] Gesture programming in PyQt

2012-01-09 Thread Phil Thompson
On Sun, 08 Jan 2012 18:05:52 +0100, Detlev Offenbach
det...@die-offenbachs.de wrote:
 Am Samstag, 7. Januar 2012, 18:31:16 schrieb Phil Thompson:
 On Sat, 7 Jan 2012 15:33:08 +0100, Detlev Offenbach
 
 det...@die-offenbachs.de wrote:
  Hi Phil,
  
  can you test my little test script on your side? I tried it over here
 
 with
 
  Python 3.2.2, Qt 4.7.4 and latest released sip/PyQt.
 
 What is it supposed to do?
 
 Phil
 
 I used it to get some know how in gesture programming. The custom
gesture 
 should register swipes using the touchpad of e.g. a MacBook. I couldn't
 get it 
 working because it crashed when the custome gesture recognizer is
 registered. 
 The script itself doesn't do anything useful except printing some info
 about 
 the gesture being handled.

So what do I have to do to test it?

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Gesture programming in PyQt

2012-01-09 Thread Detlev Offenbach
Am Montag, 9. Januar 2012, 09:58:39 schrieb Phil Thompson:
 On Sun, 08 Jan 2012 18:05:52 +0100, Detlev Offenbach
 
 det...@die-offenbachs.de wrote:
  Am Samstag, 7. Januar 2012, 18:31:16 schrieb Phil Thompson:
  On Sat, 7 Jan 2012 15:33:08 +0100, Detlev Offenbach
  
  det...@die-offenbachs.de wrote:
   Hi Phil,
   
   can you test my little test script on your side? I tried it over
   here
  
  with
  
   Python 3.2.2, Qt 4.7.4 and latest released sip/PyQt.
  
  What is it supposed to do?
  
  Phil
  
  I used it to get some know how in gesture programming. The custom
 
 gesture
 
  should register swipes using the touchpad of e.g. a MacBook. I couldn't
  get it
  working because it crashed when the custome gesture recognizer is
  registered.
  The script itself doesn't do anything useful except printing some info
  about
  the gesture being handled.
 
 So what do I have to do to test it?
 

Just start it and perform some swipes on the touchpad. As I said, for me it 
even failed starting up.

Regards,
Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Gesture programming in PyQt

2012-01-09 Thread Phil Thompson
On Mon, 09 Jan 2012 19:11:18 +0100, Detlev Offenbach
det...@die-offenbachs.de wrote:
 Am Montag, 9. Januar 2012, 09:58:39 schrieb Phil Thompson:
 On Sun, 08 Jan 2012 18:05:52 +0100, Detlev Offenbach
 
 det...@die-offenbachs.de wrote:
  Am Samstag, 7. Januar 2012, 18:31:16 schrieb Phil Thompson:
  On Sat, 7 Jan 2012 15:33:08 +0100, Detlev Offenbach
  
  det...@die-offenbachs.de wrote:
   Hi Phil,
   
   can you test my little test script on your side? I tried it over
   here
  
  with
  
   Python 3.2.2, Qt 4.7.4 and latest released sip/PyQt.
  
  What is it supposed to do?
  
  Phil
  
  I used it to get some know how in gesture programming. The custom
 
 gesture
 
  should register swipes using the touchpad of e.g. a MacBook. I
couldn't
  get it
  working because it crashed when the custome gesture recognizer is
  registered.
  The script itself doesn't do anything useful except printing some
info
  about
  the gesture being handled.
 
 So what do I have to do to test it?
 
 
 Just start it and perform some swipes on the touchpad. As I said, for me
 it 
 even failed starting up.

What touchpad?

For me it starts up and displays the Testing Gestures text. I quit it
with the close button.

Phil
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Override QStyledItemDelegate.initStyleOption not working?

2012-01-09 Thread Andreas Pakulat
Hi,

I'd like to customize the display of a model via a styleditemdelegate,
in particular I want to add a decorating icon depending on some custom
role from the model.

As far as I can see the easiest way to do this would be overriding
initStyleOption since then I can set the icon and icon-size directly on
the option and leave the rest to the standard paint etc. methods.

Unfortunately it seems this does not work in PyQt, the code is executed
properly but the icon does not show up in the itemview. Since the
function in C++ takes a pointer to the option-parameter I wonder wether
this is simply not possible with PyQt or wether I need to go hunting for
the bug elsewhere?

Using Qt 4.7.4, sip 4.13  and PyQt 4.8.6

Andreas

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] QWebkit / QWebFrame

2012-01-09 Thread James Polk
Howdy,

I believe Guru Hans-Peter ;-) posted a collection of PyQt examples that
he converted into Python from the Qt C++ examples..

In one titled fancybrowser.py


There's a few lines that read...


        @QtCore.pyqtSlot()
        def submit(self):
            frame = self.ui.webView.page().mainFrame()

then


            firstName    = frame.findFirstElement(#firstname)


It appears that the function findFirstElement() appeared in a version of Qt
that came along after the one I'm on (4.5.3)

1) Can anyone suggest a code workaround that would accomplish same 

    that will work in 4.5.3 rather than 4.7 or 4.8 (whenever that appeared)


2) Secondly,...as an alternative, one that I hesitate to try,...is it possible 
for two
    versions of Qt (and I guess two versions of PyQt and Sip) to exist 
simultaneously?
    Using one version for *this* and another version for *that* ?___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] QWebkit / QWebFrame

2012-01-09 Thread James Polk


whoops,...correction

I typed fancybrowser.py but I actually meant formextractor.py

Thanks,
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt