11 import os |
11 import os |
12 import time |
12 import time |
13 |
13 |
14 from PyQt6.QtWidgets import QApplication, QGraphicsTextItem |
14 from PyQt6.QtWidgets import QApplication, QGraphicsTextItem |
15 |
15 |
16 from eric7 import Preferences, Utilities |
16 from eric7 import Globals, Preferences |
17 from eric7.EricWidgets.EricProgressDialog import EricProgressDialog |
17 from eric7.EricWidgets.EricProgressDialog import EricProgressDialog |
|
18 from eric7.SystemUtilities import FileSystemUtilities |
18 |
19 |
19 from .UMLDiagramBuilder import UMLDiagramBuilder |
20 from .UMLDiagramBuilder import UMLDiagramBuilder |
20 |
21 |
21 |
22 |
22 class ImportsDiagramBuilder(UMLDiagramBuilder): |
23 class ImportsDiagramBuilder(UMLDiagramBuilder): |
91 extensions = Preferences.getPython("Python3Extensions") |
92 extensions = Preferences.getPython("Python3Extensions") |
92 moduleDict = {} |
93 moduleDict = {} |
93 modules = [] |
94 modules = [] |
94 for ext in Preferences.getPython("Python3Extensions"): |
95 for ext in Preferences.getPython("Python3Extensions"): |
95 modules.extend( |
96 modules.extend( |
96 glob.glob(Utilities.normjoinpath(self.packagePath, "*{0}".format(ext))) |
97 glob.glob( |
|
98 FileSystemUtilities.normjoinpath( |
|
99 self.packagePath, "*{0}".format(ext) |
|
100 ) |
|
101 ) |
97 ) |
102 ) |
98 |
103 |
99 tot = len(modules) |
104 tot = len(modules) |
100 progress = EricProgressDialog( |
105 progress = EricProgressDialog( |
101 self.tr("Parsing modules..."), |
106 self.tr("Parsing modules..."), |
374 """ |
379 """ |
375 data = { |
380 data = { |
376 "project_name": self.project.getProjectName(), |
381 "project_name": self.project.getProjectName(), |
377 "show_external": self.showExternalImports, |
382 "show_external": self.showExternalImports, |
378 "package": ( |
383 "package": ( |
379 Utilities.fromNativeSeparators(self.__relPackagePath) |
384 FileSystemUtilities.fromNativeSeparators(self.__relPackagePath) |
380 if self.__relPackagePath |
385 if self.__relPackagePath |
381 else Utilities.fromNativeSeparators(self.packagePath) |
386 else FileSystemUtilities.fromNativeSeparators(self.packagePath) |
382 ), |
387 ), |
383 } |
388 } |
384 |
389 |
385 return data |
390 return data |
386 |
391 |
397 @rtype tuple of (bool, str) |
402 @rtype tuple of (bool, str) |
398 """ |
403 """ |
399 try: |
404 try: |
400 self.showExternalImports = data["show_external"] |
405 self.showExternalImports = data["show_external"] |
401 |
406 |
402 packagePath = Utilities.toNativeSeparators(data["package"]) |
407 packagePath = FileSystemUtilities.toNativeSeparators(data["package"]) |
403 if os.path.isabs(packagePath): |
408 if os.path.isabs(packagePath): |
404 self.packagePath = packagePath |
409 self.packagePath = packagePath |
405 self.__relPackagePath = "" |
410 self.__relPackagePath = "" |
406 else: |
411 else: |
407 # relative package paths indicate a project package |
412 # relative package paths indicate a project package |