--- a/Graphics/ClassItem.py Tue Sep 11 18:46:46 2012 +0200 +++ b/Graphics/ClassItem.py Wed Sep 12 19:41:50 2012 +0200 @@ -9,12 +9,12 @@ from PyQt4.QtGui import QFont, QGraphicsSimpleTextItem, QStyle -from .UMLItem import UMLItem +from .UMLItem import UMLModel, UMLItem import Utilities -class ClassModel(object): +class ClassModel(UMLModel): """ Class implementing the class model. """ @@ -28,10 +28,11 @@ @param attributes list of attribute names of the class (list of strings) """ - self.name = name + super().__init__(name) + self.methods = methods self.attributes = attributes - + def addMethod(self, method): """ Method to add a method to the class model. @@ -39,7 +40,7 @@ @param method method name to be added (string) """ self.methods.append(method) - + def addAttribute(self, attribute): """ Method to add an attribute to the class model. @@ -47,7 +48,7 @@ @param attribute attribute name to be added (string) """ self.attributes.append(attribute) - + def getMethods(self): """ Method to retrieve the methods of the class. @@ -55,7 +56,7 @@ @return list of class methods (list of strings) """ return self.methods[:] - + def getAttributes(self): """ Method to retrieve the attributes of the class. @@ -63,14 +64,6 @@ @return list of class attributes (list of strings) """ return self.attributes[:] - - def getName(self): - """ - Method to retrieve the class name. - - @return class name (string) - """ - return self.name class ClassItem(UMLItem): @@ -93,8 +86,8 @@ @keyparam parent reference to the parent object (QGraphicsItem) @keyparam scene reference to the scene object (QGraphicsScene) """ - UMLItem.__init__(self, x, y, rounded, parent) - self.model = model + UMLItem.__init__(self, model, x, y, rounded, parent) + self.external = external self.noAttrs = noAttrs