Hello all,
I am having a few issues with my class inheritance in PyQt.
I am writing an application that has a rather large dialog with lots of
different panels that perform different operations and require different
setups. To keep it as clean as I could I decided I should create separate
classes for the separate panels.
The issue I am having is passing a class instance across classes.
In my MainWindowSetup class I create an instance of the PyQt window and set
it up, this shows the dialog and all the panels etc. I then create an
instance of my ModelWindow inside my MainWindowSetup but I cannot seem to
access the functionality from within the PyQt window from my ModelWindow
class.
The error I get is:
AttributeError: 'ModelWindow' object has no attribute 'uiMainWindow'
I am rather confused, as by creating the instance of my MainWindowSetup
class shouldn't the ModelWindow class become a child of the MainWindowSetup
and by doing so I should be able to access the PyQt window properties?
Or is it that I am missing some fundamental class inheritance knowledge? I
can keep coding as I can setup my panels for the moment inside my
MainWindowSetup class but further down the line it will get messy to keep
everything to one class
Here is my code thus far:
class MainWindowSetup(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.uiMainWindow = Ui_MainWindow()
self.uiMainWindow.setupUi(self)
self.uiModelWindow = ModelWindow()
class ModelWindow(QtGui.QTreeWidget):
def __init__(self):
print "!! Initialised model window"
QtGui.QTreeWidget.__init__(self)
self.modelTree = self.uiMainWindow.uiModelTree # This is where
I get the error
Thanks for any help!
Cheers,
Ben
--
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/e2edeb85-1147-4ae4-b899-7e31768a7522%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.