thanks Christian.
sounds like that'll really help out.

interestingly, using

pymel.lsUI(type=['floatSlider'],l=1)

will return (among other floatSliders), the full pathname of the
floatslider i have parented into my qt designer ui.
so maya does know about the widget paths in this ui after all......

....but:

qFloatSlider = pymel.toQtObject('myFloatSlider')
pointer = sip.unwrapinstance(qFloatSlider)
mui.MQtUtil.fullName(pointer)

produces:
# TypeError: in method 'MQtUtil_fullName', argument 1 of type 'QObject
const *' #

printing out pointer:
print pointer
1002092800

type(pointer)
long

bemused by the inability of <mui.MQtUtil.fullName(pointer)> to
function as expected.

-mt


On Nov 11, 5:30 pm, Christian Akesson <[email protected]> wrote:
> I've been using a ui designed, then brought into Maya and make attachable
> through a dock panel.
> I do all the signal and behavior hook ups and some extensions to the ui
> through code in the init...
> Full path names and GetQtWidget works for me when I pass the string of the
> panel name. I also use GetMayaWindow when bringing in the ui....
> Also the method I added for finding any UI element with full path name
> (bool) worked when I tested it.
>
> Just ping if you have any questions, I will share from what I have gathered
> so far :-)
>
> /Christian
>
> On Thu, Nov 11, 2010 at 12:43 PM, mtherrell <[email protected]> wrote:
> > folow up question to David.. or anyone else who has successfully used
> > these wrapper functions.
>
> > when you get a good maya pathstring to your widget using the
> > GetFullname wrapper (that uses <mui.MQtUtil.fullName(pointer)>)
>
> > is the ui you are doing this on generated completely with maya
> > commands or pymel?
> > or can you also get a path from a widget in a ui generated soley with
> > qt (in this case qtDesigner then uic..), and then launched in maya?
>
> > the later is what i am trying to do.. without success so far.
> > if the former scenario is the only way for this wrapper to return a
> > path,
> > then that makes me think maya really knows nothing about my designer
> > generated UI other than signals coming from it.
>
> > hmmmm.
>
> > On Nov 11, 12:20 pm, mtherrell <[email protected]> wrote:
> > > thanks guys for the tips!
>
> > > what i have learned so far:
>
> > > it appears that maya itself does not keep track of the widget
> > > hierarchy in my subclassed, qtDesigner generated UI.
>
> > > David, i tried out your GetFullName wrapper. running this on my
> > > QObject i still get:
>
> > > # TypeError: in method 'MQtUtil_fullName', argument 1 of type 'QObject
> > > const *' #
>
> > > note that, <pointer = sip.unwrapinstance(QObject)>, is actually
> > > returning a number of type long.
> > > but, <mui.MQtUtil.fullName(pointer)>, seems to still be choking on it.
> > > that concerns me a bit..
> > > if the pointer is there, why cant the api use it to get me a pathname?
>
> > > i wrote my own hacky "fullpathname" test function that returns the
> > > full
> > > pathname of a QWidget in question, and gave it the same QObject that i
> > > give your wrapper. and it gives me what i would expect from your
> > > wrapper..
> > > accept your wrapper of course would show that maya understands widget
> > > paths in my UI.. and my function is purely QT.
>
> > > somthing like this:
> > > def getFullQWidgetPathName(startQWidget):
>
> > >     pathString = ''
> > >     path = []
> > >     p = startQWidget
>
> > >     while type(p)!= NoneType:
> > >         path.append('%s|'%p.objectName())
> > >         p = p.parentWidget()
>
> > >     path.reverse()
> > >     pathString = pathString.join(path)
> > >     return pathString.rstrip('|')
>
> > > i can see my tool window in maya, its parented underneath the maya
> > > main window, but maya seems to know nothing else about it.
> > > trying to use any maya ui commands to parent or place the floatSlider
> > > using the resulting path string from my hacky test function, produces:
>
> > > # RuntimeError: floatSlider: Object ‘MayaWindow|tabChangedSignalTest|
> > > centralwidget|tabWidget|qt_tabwidget_stackedwidget|tab_2|
> > > gridLayoutWidget|sliderLayout’ not found. #
>
> > > (and after much to-do i did make sure that is the actual widget
> > > hierarchy in the pyQT UI. maya does not even see my tools main window
> > > even though it is a child.. and yet it functions properly as a child.
> > > everything in the UI works.. like using signals from a button to
> > > create a sphere and a static-ui slider to move the sphere in x etc...)
>
> > > so after all that, i sort of feel like maya really does not know
> > > anything about the pyQT widget hierarchies, unless you use the loadUI
> > > command or create the interface itself with maya commands.
>
> > > however, i did find a way to parent and position a maya float slider
> > > into this purely pyQT UI running in maya.
> > > i downloaded and installed pymel 1.0.2.
> > > included in this update are commands like toQObject(). i use
> > > toQobject() to get the QObject of the float slider i create, then go
> > > on using pyQT to parent and position the slider.
> > > it works. the only problem is that maya still does not know the
> > > floatSlider has been parented. so when you delete the main tool
> > > window, it does not delete the folatslider. you can however delete it
> > > explicitly with deleteUI maya command.
>
> > > this situation is functional for what i want to do, if not ideal. i
> > > can at least use maya specific widgets along side pyQT specific
> > > widgets. which is great. but i still cant believe that maya knows
> > > nothing about the widget hierarchy of the pyQT ui! and yet maya still
> > > displays it and catches signals from it just fine.
>
> > > will keep you updated as i learn more.
> > > -thanks again,
> > > Mark therrell
>
> > > On Nov 10, 11:14 am, mtherrell <[email protected]> wrote:
>
> > > > BTW, David thanks for the wrappers!
> > > > i did not know how to use sip wrap and unwrap in order to send the
> > > > pointers to and from QT
>
> > > > guss i need to learn more about sip.
> > > > im and old-school maya guy from way back.. and i used pyqt, after
> > > > that, in a proprietary pipeline for a long time..
> > > > but im very new to combining the two!
>
> > > > cheers and thanks for the help!
> > > > -mt
>
> > > > On Nov 9, 3:18 pm, John Creson <[email protected]> wrote:
>
> > > > > another bit to try.
>
> > > > > give the layout a unique name and set parent to that unique name
>
> > > > > or, dumpwidgets and weed through the dump...
>
> > > > > for widge in cmds.lsUI(dumpWidgets=True):
> > > > >     if widge.startswith('mywindow'):
> > > > >        print widge
>
> > > > > MQtUtil is also a great place to start digging.
>
> > > > > On Tue, Nov 9, 2010 at 4:39 AM, David Moulder <
> > [email protected]> wrote:
> > > > > > I think you'll find this useful... some basic wraps of MQtUtil I
> > did.
> > > > > >  I originally got the idea for this from
> >http://nathanhorne.com/?p=183
> > > > > > It's well worth bookmarking these TD's and using Google Reader.
> >  I'm forever
> > > > > > stealing and learning from these guys!
> > > > > >http://pastebin.com/rE6uhtm4
> > > > > > I've not tried to do what your attempting yet but I hope to when I
> > get 5
> > > > > > minutes at work...
> > > > > > -Dave
>
> > > > > > On Mon, Nov 8, 2010 at 6:45 PM, mtherrell <[email protected]>
> > wrote:
>
> > > > > >> thanks David.
>
> > > > > >> in a function of my subclassed qtDesigner ui, i have access to the
> > > > > >> QGridLayoutitself  and/ or the QTabWidget that has that grid
> > layout
> > > > > >> within it.
> > > > > >> like this: self.sliderLayout ..
>
> > > > > >> i am trying to get the maya fullname of that widget using
> > > > > >> MQtUtil.fullName().
>
> > > > > >> my problem is MQtUtil.fullName().. and its c++ ducumentaion vs.
> > python
> > > > > >> documentation.
> > > > > >> MQtUtil.fullName() supposedly returns the fullname as an MString
> > or
> > > > > >> the control, given it's QObject.
>
> > > > > >> but i do not know how to represent the QObject pointer in python.
> > the
> > > > > >> docs say fullName() requires a pointer to the QObject.
> > > > > >> even after reading up on how python handles pointers.. i still
> > cannot
> > > > > >> get MQtUtil.fullName() to work in python..
>
> > > > > >> any help or examples on how to represent the QObject as a pointer
> > in
> > > > > >> python.. ort how to translate the c++ docs into python in general
> > > > > >> would be a great help!
>
> > > > > >> thanks
> > > > > >> -mt
> > > > > >> On Nov 6, 12:48 pm, David Moulder <[email protected]>
> > wrote:
> > > > > >> > hmm, should be possible in 2011.
>
> > > > > >> > As long as you know the fullName of the parent layout then can
> > you not
> > > > > >> > use
> > > > > >> > the setParent() cmd and then add the floatSlider.
> > > > > >> > Then get the float slider back as a QObject see the api MQtUtil
> > i think.
> > > > > >> >  I
> > > > > >> > think pymel has toQObject, not documented tho.
>
> > > > > >> > I suppose you can then use signal as slots with that QObject.
>
> > > > > >> > It's an interesting mix as it's all Qt but the implementation in
> > both
> > > > > >> > are
> > > > > >> > different.
>
> > > > > >> > -Dave
>
> > > > > >> > On Sat, Nov 6, 2010 at 7:04 PM, mtherrell <
> > [email protected]>
> > > > > >> > wrote:
> > > > > >> > > i should probably restate the problem and be a bit more
> > clear..
>
> > > > > >> > > my goal is to generate a maya float slider using the pymel
> > > > > >> > > floatSlider() command, in a subclass of an interface created
> > in qt
> > > > > >> > > designer (and then pyuic4.. not using "loadUI").
> > > > > >> > > i want to be able to treat this slider like any other
> > QObject..
> > > > > >> > > placing and attaching it into a QGridLayout in my QT
> > interface, and
> > > > > >> > > connecting its signals to
> > > > > >> > > functions within my subclass. (whether by signals and slots or
> > by the
> > > > > >> > > callback functions of the floatslider() command itself..not
> > sure)
>
> > > > > >> > > my problem is that i do not know how to get the QObject that
> > > > > >> > > represents the maya floatSlider so that i can do all these
> > things to
> > > > > >> > > it.
> > > > > >> > > the object that is returned by pymel does not seem to allow
> > QObject
> > > > > >> > > functions. (not a QObject?)
>
> > > > > >> > > am i missing something simple?
> > > > > >> > > i am very new to qt and pymel..
> > > > > >> > > its likely just newb-ism.
> > > > > >> > > just needed a little help.
>
> > > > > >> > > thanks.
>
> > > > > >> > > On Nov 5, 5:02 pm, mtherrell <[email protected]> wrote:
> > > > > >> > > > i am using pymel 1.0 in maya 2011.
> > > > > >> > > > i am using QTDesigner to create my interface base class.
>
> > > > > >> > > > unfortunately, (and surprisingly) QT does not have a float
> > slider.
> > > > > >> > > > so
> > > > > >> > > > i need to make my float slider in my
>
> ...
>
> read more »

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to