Ok, I overloaded the PumpThread module, so the result code is:
##########################################################
## pyqt_pumpThread.py
import sys
newpath2 = '/usr/lib64/python2.5/site-packages/'
if not newpath2 in sys.path:
sys.path.append(newpath2)
newpath3 = '/usr/autodesk/maya2009-x64/devkit/other/PyQtScripts/qt/
zGUI'
if not newpath3 in sys.path:
sys.path.append(newpath3)
newpath4 = '/usr/autodesk/maya2009-x64/devkit/other/PyQtScripts/qt'
if not newpath4 in sys.path:
sys.path.append(newpath4)
import maya.utils as utils
import threading
import time
from PyQt4 import QtCore, QtGui
pumpedThread = None
app = None
def get_app():
global app
return app
def set_app(i_app):
global app
app = i_app
def get_pt():
global pumpedThread
return pumpedThread
def set_pt(i_pt):
global pumpedThread
pumpedThread = i_pt
def pumpQt():
app = get_app()
def processor():
app.processEvents()
while 1:
time.sleep(0.01)
utils.executeDeferred( processor )
def initializePumpThread():
if get_pt() == None:
set_app(QtGui.QApplication(sys.argv))
set_pt(threading.Thread( target = pumpQt, args = () ))
get_pt().start()
##########################################################
You can import this module in your Qdialog script, but don't use exec
() because pumpThread manages this, you only need to use show():
##########################################################
import pyqt_pumpThread as pt
pt.initializePumpThread()
myDialog = QtGui.QDialog()
##Your actions
myDialog.show()
##########################################################
This works ok to me, I hope for you too.
Sukuba ñ_ñ
On 9 jun, 00:41, Taylor Carrasco <[email protected]> wrote:
> Yes exactly, I tried unsuccesfully to implement pumpthread simply because of
> the name.
>
> I definitely want it on a separate thread (not competing with PyQt Dialog
> Window's thread).
>
> !!!
>
> On Mon, Jun 8, 2009 at 6:01 AM, sukuba <[email protected]> wrote:
>
> > I'm not sure if I understand your problem, but, maybe what you're
> > looking for is the pumpThread module, it throws your pyqt window in a
> > new thread so you can access to your maya scene while pyqt window is
> > running, without lock it.
> > If that's the problem, I can tell you more about how to use this.
>
> > On 8 jun, 13:11, mleep <[email protected]> wrote:
> > > Is there a way to have access to the Maya scene (regular user input/
> > > access) with a QDialog window running in the background?
>
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---