Graphics/UMLDialog.py

changeset 2027
144463496a54
parent 2026
18f2b30ed046
child 2030
db11a2fe9bbc
equal deleted inserted replaced
2026:18f2b30ed046 2027:144463496a54
18 18
19 class UMLDialog(QMainWindow): 19 class UMLDialog(QMainWindow):
20 """ 20 """
21 Class implementing a dialog showing UML like diagrams. 21 Class implementing a dialog showing UML like diagrams.
22 """ 22 """
23 def __init__(self, diagramName="Unnamed", parent=None, name=None): 23 def __init__(self, buildFunction=None, diagramName="Unnamed", parent=None, name=None):
24 """ 24 """
25 Constructor 25 Constructor
26 26
27 @param buildFunction function to build the diagram contents (function)
28 @param diagramName name of the diagram (string)
27 @param parent parent widget of the view (QWidget) 29 @param parent parent widget of the view (QWidget)
28 @param name name of the view widget (string) 30 @param name name of the view widget (string)
29 """ 31 """
30 super().__init__(parent) 32 super().__init__(parent)
31 33
32 if not name: 34 if not name:
33 self.setObjectName("UMLDialog") 35 self.setObjectName("UMLDialog")
34 else: 36 else:
35 self.setObjectName(name) 37 self.setObjectName(name)
36 38
39 self.buildFunction = buildFunction
37 self.scene = QGraphicsScene(0.0, 0.0, 800.0, 600.0) 40 self.scene = QGraphicsScene(0.0, 0.0, 800.0, 600.0)
38 self.umlView = UMLGraphicsView(self.scene, diagramName, self, "umlView") 41 self.umlView = UMLGraphicsView(self.scene, diagramName, self, "umlView")
39 42
40 self.closeAct = \ 43 self.closeAct = \
41 QAction(UI.PixmapCache.getIcon("close.png"), 44 QAction(UI.PixmapCache.getIcon("close.png"),
58 Public slot to set the diagram name. 61 Public slot to set the diagram name.
59 62
60 @param name diagram name (string) 63 @param name diagram name (string)
61 """ 64 """
62 self.umlView.setDiagramName(name) 65 self.umlView.setDiagramName(name)
66
67 def show(self):
68 """
69 Overriden method to show the dialog.
70 """
71 if self.buildFunction:
72 self.buildFunction()
73 super().show()

eric ide

mercurial