Graphics/ImportsDiagram.py

changeset 2025
8bb085c59cd2
parent 1845
d481279d882b
child 2026
18f2b30ed046
equal deleted inserted replaced
2024:717b72b32420 2025:8bb085c59cd2
26 Class implementing a dialog showing an imports diagram of a package. 26 Class implementing a dialog showing an imports diagram of a package.
27 27
28 Note: Only package internal imports are show in order to maintain 28 Note: Only package internal imports are show in order to maintain
29 some readability. 29 some readability.
30 """ 30 """
31 def __init__(self, package, parent=None, name=None, showExternalImports=False): 31 def __init__(self, project, package, parent=None, name=None,
32 showExternalImports=False):
32 """ 33 """
33 Constructor 34 Constructor
34 35
36 @param project reference to the project object
35 @param package name of a python package to show the import 37 @param package name of a python package to show the import
36 relationships (string) 38 relationships (string)
37 @param parent parent widget of the view (QWidget) 39 @param parent parent widget of the view (QWidget)
38 @param name name of the view widget (string) 40 @param name name of the view widget (string)
39 @keyparam showExternalImports flag indicating to show exports from outside 41 @keyparam showExternalImports flag indicating to show exports from outside
47 while hasInit: 49 while hasInit:
48 ppath = os.path.dirname(ppath) 50 ppath = os.path.dirname(ppath)
49 hasInit = len(glob.glob(os.path.join(ppath, '__init__.*'))) > 0 51 hasInit = len(glob.glob(os.path.join(ppath, '__init__.*'))) > 0
50 self.shortPackage = self.packagePath.replace(ppath, '').replace(os.sep, '.')[1:] 52 self.shortPackage = self.packagePath.replace(ppath, '').replace(os.sep, '.')[1:]
51 53
52 UMLDialog.__init__(self, self.packagePath, parent) 54 pname = project.getProjectName()
55 if pname:
56 name = "{0}: {1}".format(pname, project.getRelativePath(self.packagePath))
57 else:
58 name = self.packagePath
59 UMLDialog.__init__(self, name, parent)
53 60
54 if not name: 61 if not name:
55 self.setObjectName("ImportsDiagram") 62 self.setObjectName("ImportsDiagram")
56 else: 63 else:
57 self.setObjectName(name) 64 self.setObjectName(name)

eric ide

mercurial