Graphics/UMLItem.py

changeset 2030
db11a2fe9bbc
parent 1509
c0b5e693b0eb
child 2033
4b99609f6a87
equal deleted inserted replaced
2028:30247d523fdb 2030:db11a2fe9bbc
29 super().__init__(parent) 29 super().__init__(parent)
30 self.font = Preferences.getGraphics("Font") 30 self.font = Preferences.getGraphics("Font")
31 self.margin = 5 31 self.margin = 5
32 self.associations = [] 32 self.associations = []
33 self.shouldAdjustAssociations = False 33 self.shouldAdjustAssociations = False
34 self.__id = -1
34 35
35 self.setRect(x, y, 60, 30) 36 self.setRect(x, y, 60, 30)
36 37
37 if rounded: 38 if rounded:
38 p = self.pen() 39 p = self.pen()
142 143
143 painter.setPen(pen) 144 painter.setPen(pen)
144 painter.setBrush(self.brush()) 145 painter.setBrush(self.brush())
145 painter.drawRect(self.rect()) 146 painter.drawRect(self.rect())
146 self.adjustAssociations() 147 self.adjustAssociations()
148
149 def setId(self, id):
150 """
151 Public method to assign an ID to the item.
152
153 @param id assigned ID (integer)
154 """
155 self.__id = id
156
157 def getId(self):
158 """
159 Public method to get the item ID.
160
161 @return ID of the item (integer)
162 """
163 return self.__id
164
165 def buildItemDataString(self):
166 """
167 Public method to build a string to persist the specific item data.
168
169 This string must start with ", " and should be built like
170 "attribute=value" with pairs separated by ", ". value must not contain ", "
171 or newlines.
172
173 @return persistence data (string)
174 """
175 return ""
176
177 def parseItemDataString(self, data):
178 """
179 Public method to parse the given persistence data.
180
181 @param data persisted data to be parsed (string)
182 """
183 pass

eric ide

mercurial