Of course I can rename the object directly by doing the rename directly in 
setData:
    def setData(self, role, value):
        if role == QtCore.Qt.EditRole:
            self.customItem.rename(value)
Making the Display role also showing correctly as it should.
I'll have to remove the "Rename Objects" button as the rename is happening 
directly on edit.
 
Now that I have a custom item type in my ui (pymel node), I can do commands 
on the node directly(as above). Which I want to avoid if possible.
Till now I have kept the Qt code separate from Maya code. I have one file 
with the ui code and another file with maya code. They interact through the 
controller using signals. (These methods learnt from Practical Maya 
Programming in Python Book) I like the efficiency of keeping them separate
.
I have a test function in the ui code so I can run the ui on a console with 
mayapy and see how it works. Since I made a custom item now, i had to 
import pymel in the test function. This takes a few mini-seconds to load.
    def objs_list():
        from pymel.core import createNode
        #objs = []
        objs = [createNode('polyCube'),
                createNode('polySphere'),
                createNode('polyCone'),
                createNode('polyCylinder')]
        return objs

    def load_objs():
        controller.objList.emit(objs_list())

I have the tool working acceptable now. These questions are just to know 
what is the preferred, efficient or "pythonic" way to write.
Hope you can give me some inputs on how am I doing.
Thanks for taking the time to answer. :)
-Harshad

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/9bb5346f-9fb7-4f86-afb3-e9ee45d3ac2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to