@Panupat Actually, no I don't go into this specifically in my PyQt chapter. You do however see the example of how to use sip and MQtUtil to get the reference to the Maya MainWindow. I was trying really hard not to cross a certain threshold of difficulty in my examples for that video, not to mention that the PyQt section was considered a bonus chapter. I would love to make another video completely dedicated to PyQt at some point and spend much more time on the finer details.
@Kurian Thats pretty strange. Its complaining that a QDialog doesn't want to accept a 'parent' argument in its init. Out of curiosity, what version of PyQt are you using? from PyQt4 import QtCore; print QtCore.PYQT_VERSION_STR And this is for Maya 2012? I updated the example to not pass in the parent by keyword, but rather by just the 1st argument: Line 14: super(MyDialog, self).__init__(parent, **kwargs) See if that makes a difference for you? It still seems strange to me. Even Qt 4.5.x (which is the version maya 2011 uses) accepts that form of an __init__ signature. Interested to know if that small change fixes your problem. -- justin On Nov 20, 2011, at 9:20 PM, Kurian O.S wrote: > Hi Justin, > > thanks for the example man , this is so cool and when I try to run , I got > this > > # Error: 'parent' is not a Qt property or a signal > # Traceback (most recent call last): > # File "<maya console>", line 9, in <module> > # File "<maya console>", line 14, in __init__ > # AttributeError: 'parent' is not a Qt property or a signal # > > any idea ? > > On Mon, Nov 21, 2011 at 9:45 AM, Panupat Chongstitwattana > <[email protected]> wrote: > Wow Justin. Thanks for showing us that example. It's great reference. > Do you cover that in your cmiVFX tutorial too? > > Panupat C. > > On Mon, Nov 21, 2011 at 10:07 AM, Justin Israel <[email protected]> > wrote: > > Hah, ya I had a feeling. > > Now that I am home, I was able to write out an example: > > https://gist.github.com/1381489 > > Its more complicated because you have to use sip and the MQtUtil function to > > translate between maya node paths, and QObjects/QWidgets > > Here is what the script is doing: > > 1. Create the layout in PyQt > > 2. Unwrap it from python into a pointer using sip > > 3. use the pointer to get the full maya node path > > 4. set it as the UI parent > > Then you create the model panel using the commands module > > 1. Get a pointer to the underlying widget of the model panel > > 2. wrap that into a python QObject using sip > > 3. Add that new object into your layout. > > I also added a repaint in the show() method for the QDialog because maya > > likes to really lag in repainting its interface sometimes, so you wouldnt > > see the camera redrawn until you interacted with it otherwise. > > Let me know if any of that example is unclear. Maybe there is a better way > > to do this, but this way works fine. > > -- justin > > > > > > On Nov 20, 2011, at 6:18 PM, 张宇 wrote: > > > > Thanks for your reply Justin, I am using pyqt not just the qtDesigner, how > > to do that with pyqt? > > > > Http://zhangyu.me > > > > 在 2011-11-21,4:38,Justin Israel <[email protected]> 写道: > > > > Hey there, > > > > You didn't specify if you were actually using PyQt or not. I'm going to > > assume you want to just use Qt Designer, > > > > and then be able to add your modelPanel to the window. There really isnt > > much different from creating this purely in the maya ui commands. > > > > win = cmds.loadUI(f="windowTest.ui") > > > > cmds.setParent(win) > > > > cmds.paneLayout() > > > > m = cmds.modelPanel() > > > > cmds.modelPanel(m, e=True, cam="myCamera") > > > > cmds.showWindow( win ) > > > > cmds.refresh(f=True) > > > > In my "windowTest.ui" file, I simply created a dialog with nothing in it. > > And I have a camera in my scene called "myCamera" > > > > Sometimes the new maya ui kinda lags in refreshing itself, so you would have > > to interact with the new dialog sometimes to > > > > get the camera to redraw. > > > > Are you trying to do this via PyQt? That would have a few more steps since > > you need to translate between maya node paths and actual Qt widgets. > > > > -- justin > > > > > > > > On Nov 20, 2011, at 9:08 AM, 宇 wrote: > > > > I want to embed a maya's modelPanel to a Qt's Layout, but i don't know > > > > how? > > > > I just know you can create a window and layouts in QtDesigner and > > > > create the buttons or other controls with coding by PyQt. > > > > But if i want to create a modelPanel with my own camera embed to the > > > > widow created by qt, how? > > > > My english is not good, if you know what i mean, please give me an > > > > answer . > > > > -- > > > > view archives: http://groups.google.com/group/python_inside_maya > > > > change your subscription settings: > > http://groups.google.com/group/python_inside_maya/subscribe > > > > -- > > > > view archives: http://groups.google.com/group/python_inside_maya > > > > change your subscription settings: > > http://groups.google.com/group/python_inside_maya/subscribe > > > > -- > > view archives: http://groups.google.com/group/python_inside_maya > > change your subscription settings: > > http://groups.google.com/group/python_inside_maya/subscribe > > > > -- > > view archives: http://groups.google.com/group/python_inside_maya > > change your subscription settings: > > http://groups.google.com/group/python_inside_maya/subscribe > > > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > > > > -- > --:: Kurian ::-- > > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
