Unable to call up an UI within a UI

20 views
Skip to first unread message

likage

unread,
Feb 27, 2015, 1:39:04 AM2/27/15
to python_in...@googlegroups.com
Hi all, sorry if my following question sounds stupid but I am pretty much in a lost, big way!

I have created 2 UIs using the Qt-Designer.
Sub UI (publishInfoUI) -  http://pastebin.com/raw.php?i=LK2P8pQ0

And the following is the main code:

And I am using the following to run it in Maya:
import sys
sys
.path.insert(0, '/user_data/dev_test/anmg/')
import mainTool
reload
(mainTool)
win
= mainTool.MigrationUi()
win
.show()

So basically what I am trying to achieve here is that, when the MigrationUI is booted, upon clicking on the "Edit Selected" button, it should boot up the sub UI, but sadly it is not in this case.
I did add a print statement within "PublishInfoUI" class, while it is printing and indeed reading it, it does not seems to execute within.

I had needed this sub UI as later on I will need it to display the items selected in the QTreeWidget and mapped it onto the sub UI.

Any pointers?

Justin Israel

unread,
Feb 27, 2015, 1:53:33 AM2/27/15
to python_in...@googlegroups.com
# anmgToolUI
def editSelected(self): 
    inputWin = PublishInfoUI() 
    inputWin.show()

You are creating that widget without a parent, so it gets garbage collected immediately and you never see it.

Try calling it with:

inputWin = PublishInfoUI(self)
inputWin.setAttribute(QtCore.Qt.WA_DeleteOnClose)
inputWin.show()

That will make sure you don’t leak the window reference when you close it. Or you can do this if you want a modal dialog:

inputWin = PublishInfoUI()
inputWin.exec_()

Justin


You received this message because you are subscribed to the Google Groups “Python Programming for Autodesk Maya” group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4a9d4782-5f81-49a6-907b-c03f81b9ac44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

likage

unread,
Feb 27, 2015, 4:20:46 AM2/27/15
to python_in...@googlegroups.com
Hey Justin, this works great!

Just a quick question - if I am to use the solution as mentioned by you, will it be possible/any easy to map the information in my selection from the treeWidget onto the sub UI?

likage

unread,
Feb 27, 2015, 6:10:16 AM2/27/15
to python_in...@googlegroups.com
Please ignore my question from my previous post, as I have figure it out.

Thanks again :)

Panupat Chongstitwattana

unread,
Feb 27, 2015, 7:03:54 PM2/27/15
to python_in...@googlegroups.com
Is this

inputWin.setAttribute(QtCore.Qt.WA_DeleteOnClose)

The same as overriding close method with deleteLater ?

To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

Justin Israel

unread,
Feb 27, 2015, 8:42:20 PM2/27/15
to python_in...@googlegroups.com

Ya it is effectively the same thing except Qt handles it for you in the closeEvent


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/9d847ab0-b688-48e1-94a6-6e59e13be325%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages