Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Kamil Hepner
It's very simple: winName = myWindow if pm.windows.window(winName, exists=True): pm.windows.deleteUI(winName) 2012/1/9 Panupat Chongstitwattana panup...@gmail.com In Maya 2010, if I run the script to start a UI that is already running, it would crash Maya D: How can I check if the UI

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Panupat Chongstitwattana
Hi Kamil. Thanks for suggestion. But the cmds deleteUI/window modules can't seem to detect the PyQt window's titles :( On Mon, Jan 9, 2012 at 5:31 PM, Kamil Hepner hektor1...@gmail.com wrote: It's very simple: winName = myWindow if pm.windows.window(winName, exists=True):

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Ricardo Viana
Humm. It should. Check you have your naming right on the .ui for window widget. Best regards Ricardo Viana On Jan 9, 2012, at 11:56 AM, Panupat Chongstitwattana panup...@gmail.com wrote: Hi Kamil. Thanks for suggestion. But the cmds deleteUI/window modules can't seem to detect the PyQt

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Kurian O.S
you can use class MyApp (QApplication): if __name__ == '__main__': app = MyApp( sys.argv) if app.isRunning(): ... do whatevr u want On Mon, Jan 9, 2012 at 5:30 PM, Ricardo Viana cgolhei...@gmail.com wrote: Humm. It should. Check you have your naming right on the .ui

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Panupat Chongstitwattana
Kamil The UI class is Ui_AddPlayblast.py. The set title line looks like this AddPlayblast.setWindowTitle(QtGui.QApplication.translate(AddPlayblast, Manual Add Playblast, None, QtGui.QApplication.UnicodeUTF8)) I tried using both AddPlayblast and Manual Add Playblast to no avail. Is there

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread David Moulder
You are using pumpThread right? If so you shouldn't do sys.exit(app.exec_()) just myapp.show() If your not using pumpThread you have to in Maya 2010. You can find pumpThread in the sdk folder. From memory you need to import it and initialize it before any Qt Gui is created. import pumpThread

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Panupat Chongstitwattana
David - does pumpThread come with Maya 2010? I'll try it out once I get to my studio tomorrow, thanks :) On Mon, Jan 9, 2012 at 7:57 PM, David Moulder da...@thirstydevil.co.ukwrote: You are using pumpThread right? If so you shouldn't do sys.exit(app.exec_()) just myapp.show() If your

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Kurian O.S
O otherwise you can try using this import sip import maya.OpenMayaUI as mui from PyQt4.QtCore import * from PyQt4.QtQtGui import * def getMayaWindow(): ptr = mui.MQtUtil.mainWindow() return sip.wrapinstance(long(ptr), QObject) class Form(QDialog): def __init__(self, parent=None):

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Justin Israel
Kurian, he is using maya 2010 before they rewrote it in qt. so I don't believe MQtUtil even exists. The pumpThread utility is what he needs. It creates a fakey event loop that keeps processing events from qt as they stack up and also takes care of the global qapp that will be shared. There is

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Justin Israel
It should be in the sdk directory and not in your path just yet. But if you cant find it: http://code.google.com/p/svnformaya/source/browse/trunk/pumpThread.py?r=3 On Jan 9, 2012, at 8:14 AM, Justin Israel justinisr...@gmail.com wrote: Kurian, he is using maya 2010 before they rewrote it in

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Kurian O.S
Aha I didnt see that and it wont work previous version and he should use pumbthread in that case .. On Mon, Jan 9, 2012 at 11:19 AM, Justin Israel justinisr...@gmail.comwrote: It should be in the sdk directory and not in your path just yet. But if you cant find it: