Graphics/ImportsDiagram.py

changeset 12
1d8dd9706f46
parent 0
de9c2efb9d02
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
12 import sys 12 import sys
13 13
14 from PyQt4.QtCore import * 14 from PyQt4.QtCore import *
15 from PyQt4.QtGui import * 15 from PyQt4.QtGui import *
16 16
17 from UMLDialog import UMLDialog 17 from .UMLDialog import UMLDialog
18 from ModuleItem import ModuleItem, ModuleModel 18 from .ModuleItem import ModuleItem, ModuleModel
19 from AssociationItem import AssociationItem, Imports 19 from .AssociationItem import AssociationItem, Imports
20 import GraphicsUtilities 20 from . import GraphicsUtilities
21 21
22 import Utilities.ModuleParser 22 import Utilities.ModuleParser
23 import Utilities 23 import Utilities
24 24
25 class ImportsDiagram(UMLDialog): 25 class ImportsDiagram(UMLDialog):
128 impLst.append(n) 128 impLst.append(n)
129 elif self.showExternalImports: 129 elif self.showExternalImports:
130 impLst.append(n) 130 impLst.append(n)
131 if not n in externalMods: 131 if not n in externalMods:
132 externalMods.append(n) 132 externalMods.append(n)
133 for i in modules[module].from_imports.keys(): 133 for i in list(modules[module].from_imports.keys()):
134 if i.startswith('.'): 134 if i.startswith('.'):
135 dots = len(i) - len(i.lstrip('.')) 135 dots = len(i) - len(i.lstrip('.'))
136 if dots == 1: 136 if dots == 1:
137 n = i[1:] 137 n = i[1:]
138 i = n 138 i = n
151 elif self.showExternalImports: 151 elif self.showExternalImports:
152 impLst.append(n) 152 impLst.append(n)
153 if not n in externalMods: 153 if not n in externalMods:
154 externalMods.append(n) 154 externalMods.append(n)
155 classNames = [] 155 classNames = []
156 for cls in modules[module].classes.keys(): 156 for cls in list(modules[module].classes.keys()):
157 className = modules[module].classes[cls].name 157 className = modules[module].classes[cls].name
158 if className not in classNames: 158 if className not in classNames:
159 classNames.append(className) 159 classNames.append(className)
160 shape = self.__addModule(module, classNames, 0.0, 0.0) 160 shape = self.__addModule(module, classNames, 0.0, 0.0)
161 shapeRect = shape.sceneBoundingRect() 161 shapeRect = shape.sceneBoundingRect()
217 """ 217 """
218 Private method to generate the associations between the module shapes. 218 Private method to generate the associations between the module shapes.
219 219
220 @param shapes list of shapes 220 @param shapes list of shapes
221 """ 221 """
222 for module in shapes.keys(): 222 for module in list(shapes.keys()):
223 for rel in shapes[module][1]: 223 for rel in shapes[module][1]:
224 assoc = AssociationItem(\ 224 assoc = AssociationItem(\
225 shapes[module][0], shapes[rel][0], 225 shapes[module][0], shapes[rel][0],
226 Imports) 226 Imports)
227 self.scene.addItem(assoc) 227 self.scene.addItem(assoc)

eric ide

mercurial