Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
94580040
Commit
94580040
authored
Nov 04, 2015
by
Maxime Perrotin
Browse files
Catch exceptions when statechart can't be rendered
parent
c0c8ecd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
opengeode/Statechart.py
View file @
94580040
...
...
@@ -442,10 +442,14 @@ def render_statechart(scene, graphtree=None, keep_pos=False, dump_gfx=''):
# Harmonize the size of states to avoid having huge composite state(s)
# next to single, small states. Rule: there can't be a state with a size
# that is less than a third of the biggest state.
min_width
=
float
(
max
(
node
.
attr
.
get
(
'width'
,
0.0
)
or
0.0
for
node
in
graphtree
[
'graph'
].
iternodes
()))
min_height
=
float
(
max
(
node
.
attr
.
get
(
'height'
,
0.0
)
or
0.0
for
node
in
graphtree
[
'graph'
].
iternodes
()))
try
:
min_width
=
float
(
max
(
node
.
attr
.
get
(
'width'
,
0.0
)
or
0.0
for
node
in
graphtree
[
'graph'
].
iternodes
()))
min_height
=
float
(
max
(
node
.
attr
.
get
(
'height'
,
0.0
)
or
0.0
for
node
in
graphtree
[
'graph'
].
iternodes
()))
except
ValueError
as
err
:
LOG
.
debug
(
str
(
err
))
min_width
,
min_height
=
0
,
0
if
min_width
and
min_height
:
for
node
in
graphtree
[
'graph'
].
iternodes
():
if
node
.
attr
[
'shape'
]
!=
'record'
:
...
...
opengeode/opengeode.py
View file @
94580040
...
...
@@ -2010,15 +2010,15 @@ class OG_MainWindow(QtGui.QMainWindow, object):
scene
=
self
.
view
.
parent_scene
[
0
][
0
]
else
:
scene
=
self
.
view
.
scene
()
graph
=
scene
.
sdl_to_statechart
()
try
:
graph
=
scene
.
sdl_to_statechart
()
Statechart
.
render_statechart
(
self
.
statechart_scene
,
graph
)
self
.
statechart_view
.
refresh
()
self
.
statechart_view
.
fitInView
(
self
.
statechart_scene
.
itemsBoundingRect
(),
Qt
.
KeepAspectRatioByExpanding
)
except
(
IOError
,
TypeError
)
as
err
:
except
(
AttributeError
,
IOError
,
TypeError
)
as
err
:
LOG
.
debug
(
str
(
err
))
@
QtCore
.
Slot
(
ogAST
.
AST
)
...
...
@@ -2298,12 +2298,12 @@ def export(ast, options):
# Also save the statechart view of the current scene
LOG
.
info
(
'Saving statechart sc_{}.png'
.
format
(
process
.
processName
))
sc_scene
=
SDL_Scene
(
context
=
'statechart'
)
graph
=
diagram
.
sdl_to_statechart
()
try
:
graph
=
diagram
.
sdl_to_statechart
()
Statechart
.
render_statechart
(
sc_scene
,
graph
,
dump_gfx
=
process
.
processName
)
sc_scene
.
refresh
()
except
(
IOError
,
TypeError
)
as
err
:
except
(
AttributeError
,
IOError
,
TypeError
)
as
err
:
LOG
.
debug
(
str
(
err
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment