Commit 69f25064 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Improve statechart rendering

parent f7818c68
......@@ -148,8 +148,9 @@ The fonts are the fonts from Ubuntu, check licence in file FONT-LICENSE.TXT
Changelog
=========
1.3.2 (11/2015)
1.3.3 (11/2015)
- Better support of platform-dependent screen resolution and dpi
- Minor fixes in statechart scenes (no negative coordinates)
1.3.1 (11/2015)
- Support for State Aggregations (parallel states)
......
......@@ -427,6 +427,7 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''):
for view in scene.views():
RENDER_DPI['X'] = view.physicalDpiX()
RENDER_DPI['Y'] = view.physicalDpiY()
break
# Go recursive first: render children
for aname, agraph in graphtree['children'].viewitems():
......@@ -438,7 +439,7 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''):
for node in graphtree['graph'].iternodes():
if node == aname:
size = temp_scene.itemsBoundingRect()
node.attr['width'] = ((temp_scene.width() + 30)
node.attr['width'] = ((temp_scene.width() + 35)
/ RENDER_DPI['X'])
node.attr['height'] = ((temp_scene.height() + 35)
/ RENDER_DPI['Y'])
......@@ -460,8 +461,8 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''):
for node in graphtree['graph'].iternodes():
if node.attr['shape'] != 'record':
continue
node.attr['width'] = node.attr.get('width') or min_width/3.0
node.attr['height'] = node.attr.get('height') or min_height/3.0
node.attr['width'] = node.attr.get('width') or (min_width / 3.0)
node.attr['height'] = node.attr.get('height') or (min_height / 3.0)
# Statechart symbols lookup table
......@@ -491,7 +492,7 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''):
dump_gfx += '.png'
graph.layout(prog='neato', args='-Nfontsize=12, -Efontsize=8 '
'-Gsplines=curved -Gsep=1 '
'-Gsplines=curved -Gsep=1 -Gdpi=72 '
'-Gstart=random10 -Goverlap=scale '
'-Nstyle=rounded -Nshape=record -Elen=1 {kp} {dump}'
.format(kp='-n1' if keep_pos else '',
......@@ -512,7 +513,9 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''):
shape = node.get('shape')
try:
node_symbol = lookup[shape](node, graph)
if graphtree['children'] and shape == 'record':
if unicode(node_symbol) in graphtree['children'] \
and shape == 'record':
# Use a different color for non-terminal states
node_symbol.setBrush(QtGui.QBrush(QtGui.QColor(249, 249, 249)))
G_SYMBOLS.add(node_symbol)
node_symbols.append(node_symbol)
......@@ -524,6 +527,9 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''):
for edge in edges:
Edge(edge, graph)
# Make sure the scene has no negative coordinates
scene.translate_to_origin()
for aname, agraph in graphtree['children'].viewitems():
# At the end, place the content of the scene of the composite states
# in the symbol by moving them from their temporary scene
......
......@@ -116,7 +116,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '1.3.2'
__version__ = '1.3.3'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......@@ -1371,10 +1371,9 @@ class SDL_View(QtGui.QGraphicsView, object):
''' Display the About dialog '''
QtGui.QMessageBox.about(self, 'About OpenGEODE',
'OpenGEODE - a tiny SDL editor for TASTE\n\n'
'Author: \nMaxime Perrotin'
'\n\nContact: maxime.perrotin@esa.int\n\n'
'Coded with Pyside (Python + Qt)\n'
'and ANTLR 3.1.3 for Python (parser)')
'Version {}\n\n'
'Copyright (c) 2012-2015 European Space Agency\n\n'
'Contact: Maxime.Perrotin@esa.int\n\n'.format(__version__))
# pylint: disable=C0103
def wheelEvent(self, wheelEvent):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment