32 @param file filename of a python module to be shown (string) |
32 @param file filename of a python module to be shown (string) |
33 @param parent parent widget of the view (QWidget) |
33 @param parent parent widget of the view (QWidget) |
34 @param name name of the view widget (string) |
34 @param name name of the view widget (string) |
35 @keyparam noAttrs flag indicating, that no attributes should be shown (boolean) |
35 @keyparam noAttrs flag indicating, that no attributes should be shown (boolean) |
36 """ |
36 """ |
37 UMLDialog.__init__(self, parent=parent) |
37 UMLDialog.__init__(self, buildFunction=self.__buildClasses, parent=parent) |
38 |
38 |
39 self.file = file |
39 self.file = file |
40 self.noAttrs = noAttrs |
40 self.noAttrs = noAttrs |
41 |
41 |
42 pname = project.getProjectName() |
42 pname = project.getProjectName() |
135 del todo[0] |
135 del todo[0] |
136 |
136 |
137 if classesFound: |
137 if classesFound: |
138 self.__arrangeClasses(nodes, routes[:]) |
138 self.__arrangeClasses(nodes, routes[:]) |
139 self.__createAssociations(routes) |
139 self.__createAssociations(routes) |
|
140 self.umlView.autoAdjustSceneSize(limit=True) |
140 else: |
141 else: |
141 ct = QGraphicsTextItem(None, self.scene) |
142 ct = QGraphicsTextItem(None, self.scene) |
142 ct.setHtml( |
143 ct.setHtml( |
143 self.trUtf8("The module <b>'{0}'</b> does not contain any classes.")\ |
144 self.trUtf8("The module <b>'{0}'</b> does not contain any classes.")\ |
144 .format(self.file)) |
145 .format(self.file)) |
181 widths.append(currentWidth) |
182 widths.append(currentWidth) |
182 heights.append(currentHeight) |
183 heights.append(currentHeight) |
183 |
184 |
184 # add in some whitespace |
185 # add in some whitespace |
185 width = width * whiteSpaceFactor |
186 width = width * whiteSpaceFactor |
186 rawHeight = height |
187 ## rawHeight = height |
187 height = height * whiteSpaceFactor - 20 |
188 height = height * whiteSpaceFactor - 20 |
188 verticalWhiteSpace = (height - rawHeight) / (len(generations) - 1.0 or 2.0) |
189 ## verticalWhiteSpace = max( |
|
190 ## (height - rawHeight) / (len(generations) - 1.0 or 2.0), |
|
191 ## 40.0 |
|
192 ## ) |
|
193 verticalWhiteSpace = 40.0 |
189 |
194 |
190 sceneRect = self.umlView.sceneRect() |
195 sceneRect = self.umlView.sceneRect() |
191 width += 50.0 |
196 width += 50.0 |
192 height += 50.0 |
197 height += 50.0 |
193 swidth = width < sceneRect.width() and sceneRect.width() or width |
198 swidth = width < sceneRect.width() and sceneRect.width() or width |
260 self.__getCurrentShape(route[0]), |
265 self.__getCurrentShape(route[0]), |
261 Generalisation, |
266 Generalisation, |
262 topToBottom=True) |
267 topToBottom=True) |
263 self.scene.addItem(assoc) |
268 self.scene.addItem(assoc) |
264 |
269 |
265 def show(self): |
|
266 """ |
|
267 Overriden method to show the dialog. |
|
268 """ |
|
269 self.__buildClasses() |
|
270 UMLDialog.show(self) |
|
271 |
|
272 def relayout(self): |
270 def relayout(self): |
273 """ |
271 """ |
274 Public method to relayout the diagram. |
272 Public method to relayout the diagram. |
275 """ |
273 """ |
276 self.allClasses.clear() |
274 self.allClasses.clear() |