Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spot-web-app
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Spot
spot-web-app
Commits
92e28d1f
Commit
92e28d1f
authored
May 18, 2019
by
Alexandre Duret-Lutz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
catch graphviz errors and display a warning
parent
bda3cf7e
Pipeline
#9228
passed with stage
in 1 minute and 38 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
server/spotapi.py
server/spotapi.py
+20
-17
No files found.
server/spotapi.py
View file @
92e28d1f
...
...
@@ -501,23 +501,26 @@ def translate(ltlformula, method='GET'):
warn
(
res
,
"Only the first 30 states of the automaton are displayed."
)
if
dodot
:
dotsrc
=
spot
.
ostringstream
()
spot
.
print_dot
(
dotsrc
,
aut
,
opt
+
"<30"
)
automaton_svg
=
str_to_svg
(
dotsrc
.
str
().
encode
(
'utf-8'
))
res
[
'automaton_svg'
]
=
automaton_svg
# Check if the automaton was scaled down.
m
=
re
.
search
(
'transform="scale\(([.\d]+) '
,
automaton_svg
)
if
m
:
scale
=
float
(
m
.
group
(
1
))
print
(
scale
)
if
scale
<=
.
9
:
# Re-render vertically and see if the scale is better
dotsrc
=
spot
.
ostringstream
()
spot
.
print_dot
(
dotsrc
,
aut
,
opt
+
"v<30"
)
automaton_svg
=
str_to_svg
(
dotsrc
.
str
().
encode
(
'utf-8'
))
m
=
re
.
search
(
'transform="scale\(([.\d]+) '
,
automaton_svg
)
if
m
and
scale
<
float
(
m
.
group
(
1
)):
res
[
'automaton_svg'
]
=
automaton_svg
try
:
dotsrc
=
spot
.
ostringstream
()
spot
.
print_dot
(
dotsrc
,
aut
,
opt
+
"<30"
)
automaton_svg
=
str_to_svg
(
dotsrc
.
str
().
encode
(
'utf-8'
))
res
[
'automaton_svg'
]
=
automaton_svg
# Check if the automaton was scaled down.
m
=
re
.
search
(
'transform="scale\(([.\d]+) '
,
automaton_svg
)
if
m
:
scale
=
float
(
m
.
group
(
1
))
print
(
scale
)
if
scale
<=
.
9
:
# Re-render vertically and see if the scale is better
dotsrc
=
spot
.
ostringstream
()
spot
.
print_dot
(
dotsrc
,
aut
,
opt
+
"v<30"
)
automaton_svg
=
str_to_svg
(
dotsrc
.
str
().
encode
(
'utf-8'
))
m
=
re
.
search
(
'transform="scale\(([.\d]+) '
,
automaton_svg
)
if
m
and
scale
<
float
(
m
.
group
(
1
)):
res
[
'automaton_svg'
]
=
automaton_svg
except
subprocess
.
CalledProcessError
as
e
:
warn
(
res
,
"Could not display automaton. "
+
str
(
e
))
aut
.
set_name
(
str
(
f
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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