--- a/Graphics/PackageItem.py Tue Sep 11 18:46:46 2012 +0200 +++ b/Graphics/PackageItem.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 PackageModel(object): +class PackageModel(UMLModel): """ Class implementing the package model. """ @@ -25,9 +25,10 @@ @param name package name (string) @param moduleslist list of module names (list of strings) """ - self.name = name + super().__init__(name) + self.moduleslist = moduleslist - + def addModule(self, modulename): """ Method to add a module to the package model. @@ -35,7 +36,7 @@ @param modulename module name to be added (string) """ self.moduleslist.append(modulename) - + def getModules(self): """ Method to retrieve the modules of the package. @@ -43,15 +44,7 @@ @return list of module names (list of strings) """ return self.moduleslist[:] - - def getName(self): - """ - Method to retrieve the package name. - - @return package name (string) - """ - return self.name - + class PackageItem(UMLItem): """ @@ -64,7 +57,7 @@ """ Constructor - @param model module model containing the module data (ModuleModel) + @param model package model containing the package data (PackageModel) @param x x-coordinate (integer) @param y y-coordinate (integer) @param rounded flag indicating a rounded corner (boolean) @@ -73,8 +66,7 @@ @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.noModules = noModules scene.addItem(self)