Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.editor
Commits
35bd358f
Commit
35bd358f
authored
Nov 19, 2019
by
Samuel GAIST
Committed by
Flavio TARSETTI
Nov 28, 2019
Browse files
[widgets][toolchaineditor] Make resistent to bad json
parent
a36325c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/editor/widgets/toolchaineditor.py
View file @
35bd358f
...
...
@@ -748,21 +748,14 @@ class Toolchain(QWidget):
self
.
json_object
=
json_object
if
"representation"
in
self
.
json_object
:
self
.
web_representation
=
self
.
json_object
[
"representation"
]
else
:
self
.
web_representation
=
None
if
"editor_gui"
in
self
.
json_object
:
self
.
editor_gui
=
self
.
json_object
[
"editor_gui"
]
else
:
self
.
editor_gui
=
None
self
.
web_representation
=
self
.
json_object
.
get
(
"representation"
)
self
.
editor_gui
=
self
.
json_object
.
get
(
"editor_gui"
)
self
.
clear_space
()
# Get datasets, blocks, analyzers
for
block_type
in
BlockType
:
for
block_item
in
self
.
json_object
[
block_type
.
value
]
:
for
block_item
in
self
.
json_object
.
get
(
block_type
.
value
,
{})
:
block
=
Block
(
block_type
.
name
,
self
.
block_config
,
self
.
connection_config
)
...
...
@@ -780,8 +773,10 @@ class Toolchain(QWidget):
self
.
scene
.
addItem
(
block
)
# Display connections
connections
=
self
.
json_object
[
"connections"
]
channel_colors
=
self
.
json_object
[
"representation"
][
"channel_colors"
]
connections
=
self
.
json_object
.
get
(
"connections"
,
[])
channel_colors
=
self
.
json_object
.
get
(
"representation"
,
{}).
get
(
"channel_colors"
)
for
connection_item
in
connections
:
connection
=
Connection
(
self
.
connection_config
)
...
...
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