|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2012 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the UML diagram builder base class. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from PyQt5.QtCore import QObject |
|
13 |
|
14 |
|
15 class UMLDiagramBuilder(QObject): |
|
16 """ |
|
17 Class implementing the UML diagram builder base class. |
|
18 """ |
|
19 def __init__(self, dialog, view, project): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param dialog reference to the UML dialog (UMLDialog) |
|
24 @param view reference to the view object (UMLGraphicsView) |
|
25 @param project reference to the project object (Project) |
|
26 """ |
|
27 super(UMLDiagramBuilder, self).__init__(dialog) |
|
28 |
|
29 self.umlView = view |
|
30 self.scene = self.umlView.scene() |
|
31 self.project = project |
|
32 |
|
33 def initialize(self): |
|
34 """ |
|
35 Public method to initialize the object. |
|
36 """ |
|
37 return |
|
38 |
|
39 def buildDiagram(self): |
|
40 """ |
|
41 Public method to build the diagram. |
|
42 |
|
43 This class must be implemented in subclasses. |
|
44 |
|
45 @exception NotImplementedError raised to indicate that this class |
|
46 must be subclassed |
|
47 """ |
|
48 raise NotImplementedError( |
|
49 "Method 'buildDiagram' must be implemented in subclasses.") |
|
50 |
|
51 def getPersistenceData(self): |
|
52 """ |
|
53 Public method to get a string for data to be persisted. |
|
54 |
|
55 @return persisted data string (string) |
|
56 """ |
|
57 return "" |
|
58 |
|
59 def parsePersistenceData(self, version, data): |
|
60 """ |
|
61 Public method to parse persisted data. |
|
62 |
|
63 @param version version of the data (string) |
|
64 @param data persisted data to be parsed (string) |
|
65 @return flag indicating success (boolean) |
|
66 """ |
|
67 return True |