Graphics/PackageDiagram.py

changeset 564
b3d966393ba9
parent 483
ca7d8599a575
child 791
9ec2ac20e54e
equal deleted inserted replaced
563:e35d2cda9a74 564:b3d966393ba9
104 The algorithm is borrowed from Boa Constructor. 104 The algorithm is borrowed from Boa Constructor.
105 """ 105 """
106 initlist = glob.glob(os.path.join(self.package, '__init__.*')) 106 initlist = glob.glob(os.path.join(self.package, '__init__.*'))
107 if len(initlist) == 0: 107 if len(initlist) == 0:
108 ct = QGraphicsTextItem(None, self.scene) 108 ct = QGraphicsTextItem(None, self.scene)
109 ct.setHtml(\ 109 ct.setHtml(
110 self.trUtf8("The directory <b>'{0}'</b> is not a package.")\ 110 self.trUtf8("The directory <b>'{0}'</b> is not a package.")\
111 .format(self.package)) 111 .format(self.package))
112 return 112 return
113 113
114 modules = self.__buildModulesDict() 114 modules = self.__buildModulesDict()
115 if not modules: 115 if not modules:
116 ct = QGraphicsTextItem(None, self.scene) 116 ct = QGraphicsTextItem(None, self.scene)
117 ct.setHtml(\ 117 ct.setHtml(
118 self.trUtf8("The package <b>'{0}'</b> does not contain any modules.") 118 self.trUtf8("The package <b>'{0}'</b> does not contain any modules.")
119 .format(self.package)) 119 .format(self.package))
120 return 120 return
121 121
122 # step 1: build all classes found in the modules 122 # step 1: build all classes found in the modules
127 for cls in list(module.classes.keys()): 127 for cls in list(module.classes.keys()):
128 classesFound = True 128 classesFound = True
129 self.__addLocalClass(cls, module.classes[cls], 0, 0) 129 self.__addLocalClass(cls, module.classes[cls], 0, 0)
130 if not classesFound: 130 if not classesFound:
131 ct = QGraphicsTextItem(None, self.scene) 131 ct = QGraphicsTextItem(None, self.scene)
132 ct.setHtml(\ 132 ct.setHtml(
133 self.trUtf8("The package <b>'{0}'</b> does not contain any classes.") 133 self.trUtf8("The package <b>'{0}'</b> does not contain any classes.")
134 .format(self.package)) 134 .format(self.package))
135 return 135 return
136 136
137 # step 2: build the class hierarchies 137 # step 2: build the class hierarchies
288 288
289 @param routes list of relationsships 289 @param routes list of relationsships
290 """ 290 """
291 for route in routes: 291 for route in routes:
292 if len(route) > 1: 292 if len(route) > 1:
293 assoc = AssociationItem(\ 293 assoc = AssociationItem(
294 self.__getCurrentShape(route[1]), 294 self.__getCurrentShape(route[1]),
295 self.__getCurrentShape(route[0]), 295 self.__getCurrentShape(route[0]),
296 Generalisation) 296 Generalisation)
297 self.scene.addItem(assoc) 297 self.scene.addItem(assoc)
298 298

eric ide

mercurial