Graphics/UMLClassDiagramBuilder.py

branch
Py2 comp.
changeset 2602
affc66a603c7
parent 2525
8b507a9a2d40
child 3057
10516539f238
equal deleted inserted replaced
2601:f415080106ba 2602:affc66a603c7
6 """ 6 """
7 Module implementing a dialog showing a UML like class diagram. 7 Module implementing a dialog showing a UML like class diagram.
8 """ 8 """
9 9
10 from __future__ import unicode_literals # __IGNORE_WARNING__ 10 from __future__ import unicode_literals # __IGNORE_WARNING__
11 11 try: # Py3
12 import itertools 12 from itertools import zip_longest
13 except ImportError:
14 from itertools import izip_longest as zip_longest
13 15
14 from PyQt4.QtGui import QGraphicsTextItem 16 from PyQt4.QtGui import QGraphicsTextItem
15 17
16 import Utilities 18 import Utilities
17 import Preferences 19 import Preferences
204 206
205 # distribute each generation across the width and the 207 # distribute each generation across the width and the
206 # generations across height 208 # generations across height
207 y = 10.0 209 y = 10.0
208 for currentWidth, currentHeight, generation in \ 210 for currentWidth, currentHeight, generation in \
209 itertools.zip_longest(widths, heights, generations): 211 zip_longest(widths, heights, generations):
210 x = 10.0 212 x = 10.0
211 # whiteSpace is the space between any two elements 213 # whiteSpace is the space between any two elements
212 whiteSpace = (width - currentWidth - 20) / (len(generation) - 1.0 or 2.0) 214 whiteSpace = (width - currentWidth - 20) / (len(generation) - 1.0 or 2.0)
213 for className in generation: 215 for className in generation:
214 cw = self.__getCurrentShape(className) 216 cw = self.__getCurrentShape(className)

eric ide

mercurial