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
707241b7
Commit
707241b7
authored
Nov 22, 2019
by
Flavio TARSETTI
Browse files
[widgets][toolchaineditor] blocks x,y,w,h are saved in web representation
parent
e94bd8bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/editor/widgets/toolchaineditor.py
View file @
707241b7
...
...
@@ -643,12 +643,10 @@ class Block(QGraphicsObject):
self
.
custom_width
=
55
self
.
height
=
55
rect
=
QRect
(
0
,
-
text_height
,
self
.
custom_width
,
text_height
+
self
.
height
+
max_pin_height
*
self
.
pin_height
,
self
.
custom_height
=
(
text_height
+
self
.
height
+
max_pin_height
*
self
.
pin_height
)
rect
=
QRect
(
0
,
-
text_height
,
self
.
custom_width
,
self
.
custom_height
)
rect
=
QRectF
(
rect
)
return
rect
...
...
@@ -1115,7 +1113,6 @@ class Toolchain(QWidget):
self
.
json_object
=
json_object
self
.
web_representation
=
self
.
json_object
.
get
(
"representation"
)
self
.
editor_gui
=
self
.
json_object
.
get
(
"editor_gui"
)
self
.
clear_space
()
...
...
@@ -1127,11 +1124,12 @@ class Toolchain(QWidget):
)
block
.
load
(
self
,
block_item
)
# Place blocks (x,y) if information is given
if
self
.
editor_gui
is
not
None
:
if
block
.
name
in
self
.
editor_gui
:
if
self
.
web_representation
[
"blocks"
]
is
not
None
:
# if block.name in self.web_representation:
if
block
.
name
in
self
.
web_representation
[
"blocks"
]:
block
.
setPos
(
self
.
editor_gui
[
block
.
name
][
"
x
"
],
self
.
editor_gui
[
block
.
name
][
"
y
"
],
self
.
web_representation
[
"blocks"
]
[
block
.
name
][
"
col
"
],
self
.
web_representation
[
"blocks"
]
[
block
.
name
][
"
row
"
],
)
block
.
position
=
block
.
scenePos
()
block
.
dataChanged
.
connect
(
self
.
dataChanged
)
...
...
@@ -1158,8 +1156,6 @@ class Toolchain(QWidget):
if
self
.
web_representation
is
not
None
:
data
[
"representation"
]
=
self
.
web_representation
data
[
"editor_gui"
]
=
{}
for
block_type
in
BlockType
:
block_type_list
=
[]
for
block
in
self
.
blocks
:
...
...
@@ -1174,9 +1170,11 @@ class Toolchain(QWidget):
block_data
[
"outputs"
]
=
block
.
outputs
block_type_list
.
append
(
block_data
)
data
[
"editor_gui"
][
block
.
name
]
=
{
"x"
:
block
.
position
.
x
(),
"y"
:
block
.
position
.
y
(),
data
[
"representation"
][
"blocks"
][
block
.
name
]
=
{
"col"
:
int
(
block
.
position
.
x
()),
"row"
:
int
(
block
.
position
.
y
()),
"width"
:
int
(
block
.
custom_width
),
"height"
:
int
(
block
.
custom_height
),
}
data
[
block_type
.
value
]
=
block_type_list
...
...
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