Graphics/PackageItem.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
10 from PyQt4.QtCore import * 10 from PyQt4.QtCore import *
11 from PyQt4.QtGui import * 11 from PyQt4.QtGui import *
12 12
13 from .UMLItem import UMLItem 13 from .UMLItem import UMLItem
14 14
15
15 class PackageModel(object): 16 class PackageModel(object):
16 """ 17 """
17 Class implementing the package model. 18 Class implementing the package model.
18 """ 19 """
19 def __init__(self, name, moduleslist = []): 20 def __init__(self, name, moduleslist=[]):
20 """ 21 """
21 Constructor 22 Constructor
22 23
23 @param name package name (string) 24 @param name package name (string)
24 @param moduleslist list of module names (list of strings) 25 @param moduleslist list of module names (list of strings)
48 49
49 @return package name (string) 50 @return package name (string)
50 """ 51 """
51 return self.name 52 return self.name
52 53
54
53 class PackageItem(UMLItem): 55 class PackageItem(UMLItem):
54 """ 56 """
55 Class implementing a package item. 57 Class implementing a package item.
56 """ 58 """
57 def __init__(self, model = None, x = 0, y = 0, rounded = False, 59 def __init__(self, model=None, x=0, y=0, rounded=False,
58 noModules = False, parent = None, scene = None): 60 noModules=False, parent=None, scene=None):
59 """ 61 """
60 Constructor 62 Constructor
61 63
62 @param model module model containing the module data (ModuleModel) 64 @param model module model containing the module data (ModuleModel)
63 @param x x-coordinate (integer) 65 @param x x-coordinate (integer)
64 @param y y-coordinate (integer) 66 @param y y-coordinate (integer)
65 @param rounded flag indicating a rounded corner (boolean) 67 @param rounded flag indicating a rounded corner (boolean)
66 @keyparam noModules flag indicating, that no module names should be 68 @keyparam noModules flag indicating, that no module names should be
67 shown (boolean) 69 shown (boolean)
68 @keyparam parent reference to the parent object (QGraphicsItem) 70 @keyparam parent reference to the parent object (QGraphicsItem)
69 @keyparam scene reference to the scene object (QGraphicsScene) 71 @keyparam scene reference to the scene object (QGraphicsScene)
70 """ 72 """
71 UMLItem.__init__(self, x, y, rounded, parent) 73 UMLItem.__init__(self, x, y, rounded, parent)
146 self.modules = None 148 self.modules = None
147 self.model = model 149 self.model = model
148 self.__createTexts() 150 self.__createTexts()
149 self.__calculateSize() 151 self.__calculateSize()
150 152
151 def paint(self, painter, option, widget = None): 153 def paint(self, painter, option, widget=None):
152 """ 154 """
153 Public method to paint the item in local coordinates. 155 Public method to paint the item in local coordinates.
154 156
155 @param painter reference to the painter object (QPainter) 157 @param painter reference to the painter object (QPainter)
156 @param option style options (QStyleOptionGraphicsItem) 158 @param option style options (QStyleOptionGraphicsItem)

eric ide

mercurial