Graphics/UMLClassDiagram.py

changeset 2027
144463496a54
parent 2026
18f2b30ed046
child 2030
db11a2fe9bbc
--- a/Graphics/UMLClassDiagram.py	Sat Sep 08 13:02:43 2012 +0200
+++ b/Graphics/UMLClassDiagram.py	Sat Sep 08 17:36:14 2012 +0200
@@ -34,7 +34,7 @@
         @param name name of the view widget (string)
         @keyparam noAttrs flag indicating, that no attributes should be shown (boolean)
         """
-        UMLDialog.__init__(self, parent=parent)
+        UMLDialog.__init__(self, buildFunction=self.__buildClasses, parent=parent)
         
         self.file = file
         self.noAttrs = noAttrs
@@ -137,6 +137,7 @@
         if classesFound:
             self.__arrangeClasses(nodes, routes[:])
             self.__createAssociations(routes)
+            self.umlView.autoAdjustSceneSize(limit=True)
         else:
             ct = QGraphicsTextItem(None, self.scene)
             ct.setHtml(
@@ -183,9 +184,13 @@
         
         # add in some whitespace
         width = width * whiteSpaceFactor
-        rawHeight = height
+##        rawHeight = height
         height = height * whiteSpaceFactor - 20
-        verticalWhiteSpace = (height - rawHeight) / (len(generations) - 1.0 or 2.0)
+##        verticalWhiteSpace = max(
+##            (height - rawHeight) / (len(generations) - 1.0 or 2.0),
+##            40.0
+##        )
+        verticalWhiteSpace = 40.0
         
         sceneRect = self.umlView.sceneRect()
         width += 50.0
@@ -262,13 +267,6 @@
                         topToBottom=True)
                 self.scene.addItem(assoc)
         
-    def show(self):
-        """
-        Overriden method to show the dialog.
-        """
-        self.__buildClasses()
-        UMLDialog.show(self)
-        
     def relayout(self):
         """
         Public method to relayout the diagram.

eric ide

mercurial