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
b317efa6
Commit
b317efa6
authored
Feb 21, 2020
by
Flavio TARSETTI
Browse files
[resources/widgets] refactored toolchain scene
parent
0122237f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
beat/editor/resources.py
View file @
b317efa6
This diff is collapsed.
Click to expand it.
beat/editor/widgets/toolchaineditor.py
View file @
b317efa6
...
...
@@ -74,7 +74,7 @@ from ..backend.assetmodel import AssetModel
from
..decorators
import
frozen
from
.editor
import
AbstractAssetEditor
from
.
drawing_space
import
DrawingSpac
e
from
.
toolchainscene
import
ToolchainScen
e
from
..backend.resourcemodels
import
AlgorithmResourceModel
from
..backend.resourcemodels
import
DatasetResourceModel
...
...
@@ -1430,8 +1430,8 @@ class Toolchain(QWidget):
if
_file
.
open
(
QFile
.
ReadOnly
|
QIODevice
.
Text
):
config_data
=
json
.
loads
(
_file
.
readAll
().
data
().
decode
(
"utf-8"
))
self
.
scene_config
=
config_data
[
"
drawing_spac
e_config"
]
self
.
scene
=
DrawingSpac
e
(
self
.
scene_config
)
self
.
scene_config
=
config_data
[
"
toolchainscen
e_config"
]
self
.
scene
=
ToolchainScen
e
(
self
.
scene_config
)
self
.
block_config
=
config_data
[
"block_config"
]
self
.
connection_config
=
config_data
[
"connection_config"
]
...
...
beat/editor/widgets/
drawing_spac
e.py
→
beat/editor/widgets/
toolchainscen
e.py
View file @
b317efa6
...
...
@@ -29,7 +29,7 @@ from PyQt5.QtGui import QColor
from
PyQt5.QtGui
import
QPen
class
DrawingSpac
e
(
QGraphicsScene
):
class
ToolchainScen
e
(
QGraphicsScene
):
"""Playground scene for block objects"""
...
...
@@ -37,8 +37,22 @@ class DrawingSpace(QGraphicsScene):
super
().
__init__
()
self
.
grid_size
=
configuration
[
"grid_size"
]
self
.
grid_color
=
configuration
[
"grid_color"
]
self
.
grid_size
=
configuration
.
get
(
"grid_size"
,
36
)
self
.
grid_color
=
configuration
.
get
(
"grid_color"
,
[
232
,
232
,
232
,
255
])
if
not
isinstance
(
self
.
grid_size
,
int
):
raise
TypeError
(
self
.
tr
(
"Grid size configuration has to be of type integer"
)
)
if
not
isinstance
(
self
.
grid_color
,
list
):
raise
TypeError
(
self
.
tr
(
"Grid color configuration has to be of type list"
))
if
(
not
all
(
isinstance
(
x
,
int
)
for
x
in
self
.
grid_color
)
or
len
(
self
.
grid_color
)
!=
4
):
raise
TypeError
(
self
.
tr
(
"Invalid grid element types or unmatching size"
))
def
drawBackground
(
self
,
painter
,
rect
):
"""Background grid"""
...
...
resources/json/toolchain_style_config.json
View file @
b317efa6
{
"
drawing_spac
e_config"
:{
"
toolchainscen
e_config"
:{
"scene_width"
:
2000
,
"scene_height"
:
2000
,
"grid_size"
:
36
,
...
...
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