Graphics/PackageItem.py

changeset 2992
dbdf27746da5
parent 2302
f29e9405c851
child 3057
10516539f238
child 3160
209a07d7e401
equal deleted inserted replaced
2991:226481ff40d1 2992:dbdf27746da5
119 if self.modules: 119 if self.modules:
120 width = max(width, self.modules.boundingRect().width()) 120 width = max(width, self.modules.boundingRect().width())
121 height = height + self.modules.boundingRect().height() 121 height = height + self.modules.boundingRect().height()
122 latchW = width / 3.0 122 latchW = width / 3.0
123 latchH = min(15.0, latchW) 123 latchH = min(15.0, latchW)
124 self.setSize(width + 2 * self.margin, height + latchH + 2 * self.margin) 124 self.setSize(width + 2 * self.margin,
125 height + latchH + 2 * self.margin)
125 126
126 x = self.margin + self.rect().x() 127 x = self.margin + self.rect().x()
127 y = self.margin + self.rect().y() + latchH 128 y = self.margin + self.rect().y() + latchH
128 self.header.setPos(x, y) 129 self.header.setPos(x, y)
129 y += self.header.boundingRect().height() + self.margin 130 y += self.header.boundingRect().height() + self.margin
152 @param painter reference to the painter object (QPainter) 153 @param painter reference to the painter object (QPainter)
153 @param option style options (QStyleOptionGraphicsItem) 154 @param option style options (QStyleOptionGraphicsItem)
154 @param widget optional reference to the widget painted on (QWidget) 155 @param widget optional reference to the widget painted on (QWidget)
155 """ 156 """
156 pen = self.pen() 157 pen = self.pen()
157 if (option.state & QStyle.State_Selected) == QStyle.State(QStyle.State_Selected): 158 if (option.state & QStyle.State_Selected) == \
159 QStyle.State(QStyle.State_Selected):
158 pen.setWidth(2) 160 pen.setWidth(2)
159 else: 161 else:
160 pen.setWidth(1) 162 pen.setWidth(1)
161 163
162 offsetX = self.rect().x() 164 offsetX = self.rect().x()
180 def buildItemDataString(self): 182 def buildItemDataString(self):
181 """ 183 """
182 Public method to build a string to persist the specific item data. 184 Public method to build a string to persist the specific item data.
183 185
184 This string must start with ", " and should be built like 186 This string must start with ", " and should be built like
185 "attribute=value" with pairs separated by ", ". value must not contain ", " 187 "attribute=value" with pairs separated by ", ". value must not
186 or newlines. 188 contain ", " or newlines.
187 189
188 @return persistence data (string) 190 @return persistence data (string)
189 """ 191 """
190 entries = [ 192 entries = [
191 "no_modules={0}".format(self.noModules), 193 "no_modules={0}".format(self.noModules),

eric ide

mercurial