@Justin, thanks for getting back to me.
So, I did a rewrite, however as long as I did not comment out both the 'app 
= QtGui.QApplication(sys.argv)' and 'app.exec_()', running the code would 
still cause my Maya to hang... Any ideas?

But still, I would like to have some insights if the code that I have 
written is the correct way to go?


# PyQt4 Modules
from PyQt4 import QtGui, QtCore
import sys
import maya.cmds as cmds


class BasicDialog(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.initData()
        self.initUI()
    
    def initData(self):
        data = QtCore.QStringList()
        #data = []
        geos = cmds.ls(type = "mesh")
        sel = cmds.listRelatives(geos, parent = True)
        for item in sel:
            data.append(QtCore.QString(str(item)))
        
        # Model
        self.ui_model = QtGui.QStringListModel(data)
        
    def initUI(self):
        listView = QtGui.QListView()
        listView.setModel(self.ui_model)
        
        layout = QtGui.QVBoxLayout()
        layout.addWidget(listView)
        self.setLayout(layout)
        

if __name__ == "__main__":
    #app = QtGui.QApplication(sys.argv)
    win = BasicDialog()
    win.show()
    #app.exec_()


Also, another question I have is, is using 'data = []' the same as 'data = 
QtCore.QStringList()'? In my case, which would be better? Seeing that both 
seems to be giving me the same results..

-- 
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_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4894d625-0e32-4fa8-8a0a-4398c14c7776%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to