Been continuing to do Yasin's tutorials on PyQT, a problem I've been 
running into now is that I can't seemed to be able to get my gui to display 
properly. What I'm trying to get is something similar to 
http://rowinggolfer.blogspot.com/2010/05/qtreeview-and-qabractitemmodel-example.html

However, I haven't had much luck in trying in achieving that. Could anyone 
possibly point out what I've been doing wrong? 

Thank you
Gann Boon Bay

-- 
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/eb133afb-6fa1-48d8-ac53-f777d17c243a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
from PyQt4 import QtCore, QtGui
import cPickle

import maya.OpenMayaUI
import maya.OpenMaya as api
import maya.cmds as cmds
import testtree


import sip

def mayaMainWindow():
    '''Returns the Maya window as a QMainWindow instance.'''
    ptr = maya.OpenMayaUI.MQtUtil.mainWindow()
    if ptr is not None:
        return sip.wrapinstance( long(ptr), QtCore.QObject )


class Selector( QtGui.QMainWindow ):
    '''A window containing a tree view set up for drag and drop.'''

    def __init__( self, parent=mayaMainWindow() ):


        '''Instantiates the window as a child of the Maya main window, sets up the
        QTreeView with an OutlinerModel, and enables the drag and drop operations.
        '''
        super( Selector, self ).__init__( parent )

        self.setObjectName('SelectorUI')

        model=QtGui.QStandardItemModel()

        dialog = QtGui.QDialog()

        dialog.setMinimumSize(250, 500)
        layout = QtGui.QVBoxLayout(dialog)

        self.tree=QtGui.QTreeView(dialog)
        self.tree.setModel(model)
        self.tree.setAlternatingRowColors(True)
        layout.addWidget(self.tree)

        label=QtGui.QLabel("SelectionUI")
        layout.addWidget(label)
        layout.addWidget(self.tree)

        frame=QtGui.QFrame(dialog)
        layout2=QtGui.QHBoxLayout(frame)

        self.refresh_button = QtGui.QPushButton("Refresh")
        self.cancel_button = QtGui.QPushButton("Cancel")

        layout.addWidget(frame)
        self.setCentralWidget( self.tree )

        self.show()

Reply via email to