27 """ |
27 """ |
28 def __init__(self, dialog, view, project, noModules=False): |
28 def __init__(self, dialog, view, project, noModules=False): |
29 """ |
29 """ |
30 Constructor |
30 Constructor |
31 |
31 |
32 @param dialog reference to the UML dialog (UMLDialog) |
32 @param dialog reference to the UML dialog |
33 @param view reference to the view object (UMLGraphicsView) |
33 @type UMLDialog |
34 @param project reference to the project object (Project) |
34 @param view reference to the view object |
|
35 @type UMLGraphicsView |
|
36 @param project reference to the project object |
|
37 @type Project |
35 @param noModules flag indicating, that no module names should be |
38 @param noModules flag indicating, that no module names should be |
36 shown (boolean) |
39 shown |
|
40 @type bool |
37 """ |
41 """ |
38 super().__init__(dialog, view, project) |
42 super().__init__(dialog, view, project) |
39 self.setObjectName("ApplicationDiagram") |
43 self.setObjectName("ApplicationDiagram") |
40 |
44 |
41 self.noModules = noModules |
45 self.noModules = noModules |
47 def __buildModulesDict(self): |
51 def __buildModulesDict(self): |
48 """ |
52 """ |
49 Private method to build a dictionary of modules contained in the |
53 Private method to build a dictionary of modules contained in the |
50 application. |
54 application. |
51 |
55 |
52 @return dictionary of modules contained in the application. |
56 @return dictionary of modules contained in the application |
|
57 @rtype dict |
53 """ |
58 """ |
54 import Utilities.ModuleParser |
59 import Utilities.ModuleParser |
55 extensions = ( |
60 extensions = ( |
56 Preferences.getPython("Python3Extensions") + |
61 Preferences.getPython("Python3Extensions") + |
57 ['.rb'] |
62 ['.rb'] |
267 |
272 |
268 def __addPackage(self, name, modules, x, y): |
273 def __addPackage(self, name, modules, x, y): |
269 """ |
274 """ |
270 Private method to add a package to the diagram. |
275 Private method to add a package to the diagram. |
271 |
276 |
272 @param name package name to be shown (string) |
277 @param name package name to be shown |
|
278 @type str |
273 @param modules list of module names contained in the package |
279 @param modules list of module names contained in the package |
274 (list of strings) |
280 @type list of str |
275 @param x x-coordinate (float) |
281 @param x x-coordinate |
276 @param y y-coordinate (float) |
282 @type float |
277 @return reference to the package item (PackageItem) |
283 @param y y-coordinate |
|
284 @type float |
|
285 @return reference to the package item |
|
286 @rtype PackageItem |
278 """ |
287 """ |
279 from .PackageItem import PackageItem, PackageModel |
288 from .PackageItem import PackageItem, PackageModel |
280 modules.sort() |
289 modules.sort() |
281 pm = PackageModel(name, modules) |
290 pm = PackageModel(name, modules) |
282 pw = PackageItem(pm, x, y, noModules=self.noModules, scene=self.scene, |
291 pw = PackageItem(pm, x, y, noModules=self.noModules, scene=self.scene, |
381 |
390 |
382 def getPersistenceData(self): |
391 def getPersistenceData(self): |
383 """ |
392 """ |
384 Public method to get a string for data to be persisted. |
393 Public method to get a string for data to be persisted. |
385 |
394 |
386 @return persisted data string (string) |
395 @return persisted data string |
|
396 @rtype str |
387 """ |
397 """ |
388 return "project={0}, no_modules={1}".format( |
398 return "project={0}, no_modules={1}".format( |
389 self.project.getProjectFile(), self.noModules) |
399 self.project.getProjectFile(), self.noModules) |
390 |
400 |
391 def parsePersistenceData(self, version, data): |
401 def parsePersistenceData(self, version, data): |
392 """ |
402 """ |
393 Public method to parse persisted data. |
403 Public method to parse persisted data. |
394 |
404 |
395 @param version version of the data (string) |
405 @param version version of the data |
396 @param data persisted data to be parsed (string) |
406 @type str |
397 @return flag indicating success (boolean) |
407 @param data persisted data to be parsed |
|
408 @type str |
|
409 @return flag indicating success |
|
410 @rtype bool |
398 """ |
411 """ |
399 parts = data.split(", ") |
412 parts = data.split(", ") |
400 if ( |
413 if ( |
401 len(parts) != 2 or |
414 len(parts) != 2 or |
402 not parts[0].startswith("project=") or |
415 not parts[0].startswith("project=") or |