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

2012-01-11 Thread David Moulder
If you read the pumpthread code you'll see that you can only initialize it once I believe. So calling it multiple times won't make any difference and just ensures it's running. Good luck. QT is great. On Wed, Jan 11, 2012 at 3:53 AM, Panupat Chongstitwattana panup...@gmail.com wrote: Thanks

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

2012-01-10 Thread Panupat Chongstitwattana
Justin, thank you for the link. I'm a little curious, how do I properly use the pumpThread? With pumpThread, my UI would disappear as soon as it appeared. Am I putting the pumpThread at the right place? import pumpThread from PyQt4 import uic class MySimpleUI(object): def __init__(self):

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

2012-01-10 Thread David Moulder
This is now down to pythons garbage collection destroying the ui. If you make a global variable and assign you ui to that then you'll be fine. ie: global myUI myUI = None def mySimpleUI(): myUI = MySimpleUI() myUI.ui.show() -Dave On Tue, Jan 10, 2012 at 10:03 AM, Panupat

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

2012-01-10 Thread Panupat Chongstitwattana
Thank you Dave. It's still acting weird I tried putting global myUI at different places, the UI only shows up if it's inside the function mySimple UI. But when calling the fuction again it would give me this error whether I've closed the first UI or not. # Error: TypeError: 'MySimpleUI' object

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

2012-01-10 Thread David Moulder
http://pastebin.com/czT9EBXM This should be enough to get you going. On Tue, Jan 10, 2012 at 10:34 AM, Panupat Chongstitwattana panup...@gmail.com wrote: Thank you Dave. It's still acting weird I tried putting global myUI at different places, the UI only shows up if it's inside the

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

2012-01-10 Thread Panupat Chongstitwattana
Thanks David. I think I got it working for now. If I want to launch multiple UI, they all will need to initialize pumpthread? On Tue, Jan 10, 2012 at 7:04 PM, David Moulder da...@thirstydevil.co.ukwrote: http://pastebin.com/czT9EBXM This should be enough to get you going. On Tue, Jan 10,

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:

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

2012-01-08 Thread Panupat Chongstitwattana
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 is already running and close it? -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: