Sorry for trouble you so much, i understand the problem now. But still, i
have a question about it:

 What is the difference beetween a Layout and one which had been morph into
a widget? Can i see the it as a normal Layout and add widget into it
anymore?

And just a small problem, please help me out. I had created a QDialog in
QtDesign ( Dialog without Button )to call later, but when i try to
reimplement the accept function, i don't know how to call the dialog out
itself (like self.dialog) to write ( if i build it by code, i will have
dialog = QtGui.QDialog through) .

Thanks :)


On Sun, Dec 30, 2012 at 7:52 AM, Justin Israel <[email protected]>wrote:

> Ok so I debugged your UI a bit and figured out the problem. It has to do
> with another confusing quirk when trying to combine PyQt widgets with Maya
> UI command as parent/child.
>
> Maya does not like layouts nested in layouts. It makes the path completely
> break to be able to reference them. So what I had to do was restructure
> your UI to put widgets between layouts:
> widget -> layout -> widget -> layout
>
> Also I had to add some import statements to your main python script:
> import maya.OpenMayaUI as mui
> import sip
>
> I've attached the UI file. There were two spots where I had to fix the
> layouts. You had nested layouts at the very top of the window, and also in
> the Color_HLayout. They now have just widget ->layout -> widget. Keep in
> mind that this is perfectly legal to do in PyQt. It is just the Maya quirk
> when doing this specific operation of adding Maya UI to your PyQt layout:
>
> b = CModifyWUI.CModifyUI(parent = CModifyWUI.getMainWindow())
> b.show()
> layout_pointer = long(sip.unwrapinstance(b.Color_HLayout))
> path = mui.MQtUtil.fullName(layout_pointer)
>
> # this should not crash now
> cmds.setParent(path)
> # this should properly add the button
> b = cmds.button()
>
>
> -- justin
>
>
>
> On Fri, Dec 28, 2012 at 8:42 PM, Tuan Nguyen <[email protected]>wrote:
>
>> Btw, not that I think you are doing this anyways but though it is worth
>>> mentioning... that part at the bottom of your python ui module (in the
>>> __main__) block is only meant for standalone (outside of Maya) apps. You
>>> shouldn't be creating a QApplication anywhere.
>>>
>>> Thanks, i didn't notice that, its auto-generation after converted from
>> UI file.
>>
>> And yes, if i just call out the UI file, everything is fine, both 2011
>> and 2012. But if i try to insert a Maya's UI element (i tested  on 2012 ) ,
>> it crash right away . It only happens with my UI file, the example you gave
>> me is fine, no crash, and the Maya UI parented to QtUI.
>>
>> So after i subclass UI file, this is what i do next
>>
>> import maya.cmds as cmds
>> import sip
>> import maya.OpenMayaUI as mui
>>
>> #Call out UI
>> b = CModifyWUI.CModifyUI(parent = CModifyWUI.getMainWindow())
>> b.show()
>> # its an emty HBoxLayout i save for insert element later
>> layout_pointer = long(sip.unwrapinstance(b.Color_HLayout))
>> path = mui.MQtUtil.fullName(layout_pointer)
>> button = cmds.button(parent = path)
>>
>> :(
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].


Attachment: ConfirmDialog.ui
Description: Binary data

Reply via email to