No I have not yet tried using a timer. I didn't even get to deal with Qt 
related things, all I wanted for now was
a mouse hook that would print out "RMB pressed", "MMB pressed" and "LMB 
pressed" respectively upon those events, but it crashes when I call SetWindowsHookEx. See my example 
code attached to one of my previous mails. It's essentially the exact same thing you are doing in C++. Yet it 
fails, and my guts feeling is it's not my fault.
If that would work, the rest (the Qt-related part) should be relatively 
straight forward. Famouse last words, I know.





so have you tried aloys' suggestion? creepy timer event or not, does it
work?

also, what bits and pieces do you need? outside the changing of the
events/signal/slots method the PyQtForSoftimage plugin uses, the plugin is
rather simple but complete.

s

On Thu, Oct 11, 2012 at 2:30 PM, Stefan Kubicek <s...@tidbit-images.com>wrote:

Ha, I remember that post!

Yet, I believe that the bottom line was that your approach was more robust
and faster,
hence I simply tried to do the same thing that you do in C++ in Python.
Also, I want to use it for a very time critical thing and that timer event
gives me the creeps :-)
Ultimately I wanted that it could be adapted and changed quickly without
having to write c++ code and compile anything, Linux was just an
afterthought (we don't use it, but since Alan asked I thought it was one
more reason to give it a try). It's cost me a day and I'm not getting
anywhere, I don't even know how to debug it, it just crashes hard and
Visual Studio won't say a thing even when it's connected to the XSI process.

Anyway, thanks for bringing it back up Steven.
I will probably take the C++ route and add my own bits and pieces where
required.

        Stefan




 are you trying to make a pure python version of the plugin?

eric hulser at blur had a pure python version working using pyhook but it
was filled with various instabilities.
http://sourceforge.net/apps/**mediawiki/pyhook/index.php?**
title=Main_Page<http://sourceforge.net/apps/mediawiki/pyhook/index.php?title=Main_Page>

also, aloys has posted on the original PyQtForSoftimage thread talking
about ways to do it in pure python on linux.

For the linux afficionados out there, you can get very simple and pure

python implementation of PyQt in Softimage by just implementing a XSI
Timer
event and running this code, which emulates the Qt event loop:

def ALUIHelpers_Events_onTimer_
OnEvent(ctx):
    app = QtGui.QApplication.instance()
    if app:
        app.processEvents()
        app.sendPostedEvents(None, QtCore.QEvent.DeferredDelete)

We found 20ms for the timer to be good enough for most UIs.
Lately, with the combination QOpenGL widgets and image players, we bumped
up to 5ms and using a C++ implementation.
We have been using PyQt inside Softimage/Maya for the last two years and
it's been great so far, it's good to see more people jumping on board and
sharing code!


-steven


On Thu, Oct 11, 2012 at 4:40 AM, Stefan Kubicek <s...@tidbit-images.com
>wrote:

 Find attached a very basic test version I put together on Tuesday that
should just respond to mouse clicks by printing out which mouse button
was
pressed (replace stevens dll with this one, restart softimage and in the
plugin manager right-click on the getQtSoftimageAnchor command of the
plugin and choose Invoke... from the popup menu.

Aaaaand...what you get is an instant fast exit to the desktop, and I'm
entirely clueless why.
I tried a couple of things (inlcuding using WH_MOUSE_LL instead of
WH_MOUSE in line 110, which at least doesn't crash but simply does
nothing
else either).

I get the same result using the "listenerKeyboard" procedure starting at
line 93, btw.

If ne1 with more indepth knowledge of win32api, ctypes, mouse and
keyboard
hooks wants to take a closer look please be my guest, it would be cool to
get this running and not having to compile anything for each new version
of
QT, PySide or Softimage, including hope for a working Linux version. Any
hints are highly welcome too.

Of course, there's also a good chance that this can never work due to
architectural restrictions (e.g. the way Python is talking to Softimage),
but what do I know.


Any ideas?





--
------------------------------**-------------
Stefan Kubicek                   Co-founder
------------------------------**-------------
          keyvis digital imagery
         Wehrgasse 9 - Grüner Hof
           1050 Vienna  Austria
        Phone:    +43/699/12614231
--- www.keyvis.at  ste...@keyvis.at ---
--  This email and its attachments are
--confidential and for the recipient only--





--
-------------------------------------------
Stefan Kubicek                   Co-founder
-------------------------------------------
          keyvis digital imagery
         Wehrgasse 9 - Grüner Hof
           1050 Vienna  Austria
        Phone:    +43/699/12614231
--- www.keyvis.at  ste...@keyvis.at ---
--  This email and its attachments are
--confidential and for the recipient only--

Reply via email to