Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
beat.editor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
beat
beat.editor
Commits
7a93bf28
Commit
7a93bf28
authored
Nov 10, 2019
by
Flavio TARSETTI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[widgets][toolchaineditor] generic block type creation capability
parent
71273670
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
21 deletions
+66
-21
beat/editor/widgets/analyzer.drawio
beat/editor/widgets/analyzer.drawio
+1
-0
beat/editor/widgets/analyzer_icon.png
beat/editor/widgets/analyzer_icon.png
+0
-0
beat/editor/widgets/block.drawio
beat/editor/widgets/block.drawio
+1
-0
beat/editor/widgets/block_icon.png
beat/editor/widgets/block_icon.png
+0
-0
beat/editor/widgets/dataset.drawio
beat/editor/widgets/dataset.drawio
+1
-0
beat/editor/widgets/dataset_icon.png
beat/editor/widgets/dataset_icon.png
+0
-0
beat/editor/widgets/toolchaineditor.py
beat/editor/widgets/toolchaineditor.py
+63
-21
No files found.
beat/editor/widgets/analyzer.drawio
0 → 100644
View file @
7a93bf28
<mxfile host="www.draw.io" modified="2019-11-08T15:52:54.936Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36" etag="1Ma9UdnNdw8-at8-L0FF" version="12.2.3" type="device" pages="1"><diagram id="rtFZ-Xy4-K91k_U5cjYo" name="Page-1">rZRBb4MgFIB/jcclUmqi19l2O2ynHpYdibwKGfoM4tT++mGFquu6rsk8GPje4wEfaEDTonvSrBKvyEEFq5B3Ad0Eq1VMqH0PoB/BmoYjyLXkIyIT2MsjOOjTGsmhXiQaRGVktYQZliVkZsGY1tgu0w6olrNWLIcLsM+YuqRvkhvhthWFE38GmQs/MwldpGA+2YFaMI7tDNFtQFONaMZW0aWgBnfeyzhudyV6XpiG0vxlwDpWYaOPvdBCZEwk7+nL5sFV+WSqcRt2izW9N6CxKTkMRUhAH1shDewrlg3R1h65ZcIUyoUPUqkUFerTWBrHScRjy2uj8QNmkfD02IhbAGgD3dWdkbMve88ACzC6tylugDfcL7vtdF5rh8TsqDxj7obk57qTRNtwHu9wSm87tVXsBYbbPlldjbf6ILvhDH4R+U39bpck/yWYRAvBNLoQTH4QTO4XbLvTB3GKzf4qdPsF</diagram></mxfile>
beat/editor/widgets/analyzer_icon.png
0 → 100644
View file @
7a93bf28
1.78 KB
beat/editor/widgets/block.drawio
0 → 100644
View file @
7a93bf28
<mxfile host="www.draw.io" modified="2019-11-08T15:51:32.410Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36" etag="FMHzNpQ6OiY4Fj2sp-DL" version="12.2.3" type="device" pages="1"><diagram id="rtFZ-Xy4-K91k_U5cjYo" name="Page-1">3ZRBb4MgFIB/jcclIpq019l2O2ynHpYdibwKGYpBnNpfP1Sosq7rlmw7jIOR7z0e8EEIcFp0d4pU7FFSEEEU0i7AmyCKVgib7wD6CcQ4nECuOJ0QmsGeH8FCl9ZwCrWXqKUUmlc+zGRZQqY9RpSSrZ92kMKftSI5nIF9RsQ5feJUM7utJJz5PfCcuZlRaCMFcckW1IxQ2S4Q3gY4VVLq6a/oUhCDO+dlGre7ED0tTEGpvzIgXomwUceeKcYywtbP6cPmxlZ5JaKxG7aL1b0zoGRTUhiKoADftoxr2FckG6KtOXLDmC6EDR+4EKkUUo1jcTY2w2ut5AssIuHYTMQuAJSG7uLO0MmXuWcgC9CqNyl2gDPc+912Pq/YIrY4KseIvSH5qe4s0fxYj99wGl13aqqYCwzXfZK6mm71gXfDGXwi8p363W69/inBSeIJxsmZYPSBYPRbgvG/E4z+SrDpzi/OGFs823j7Bg==</diagram></mxfile>
beat/editor/widgets/block_icon.png
0 → 100644
View file @
7a93bf28
2.01 KB
beat/editor/widgets/dataset.drawio
0 → 100644
View file @
7a93bf28
<mxfile host="www.draw.io" modified="2019-11-08T15:49:42.011Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36" etag="yBG1uE0d3HswN5iHmqiN" version="12.2.3" type="device" pages="1"><diagram id="rtFZ-Xy4-K91k_U5cjYo" name="Page-1">rZQ9b4MwEEB/DWMljINE1pLQDu2UoepowQVbNRgZUyC/viYcAYumaaQwIPudzx/vDB6Ni+5Fs4q/qwykF/hZ59GdFwQRofY9gH4EmzAaQa5FNiIyg4M4AUIfaSMyqJ2BRilpROXCVJUlpMZhTGvVusOOSrqrViyHFTikTK7ph8gMx2OF/sxfQeR8Wpn4GCnYNBhBzVmm2gWie4/GWikztoouBjm4m7yMecmV6GVjGkrzn4RNJP1Gn3quOU8Z337Gb7snnOWbyQYPjJs1/WRAq6bMYJiEePS55cLAoWLpEG1tyS3jppAYPgopYyWVPufSJEn2cWR5bbT6gkXEPz82ghsAbaC7ejJy8WXvGagCjO7tEEyYDPdut53rtUHEF6WaGMMbkl/mnSXaBnq8w2lw26mdxV5guO2T1dV4q4+iG2rwh8iV+u32UYLD0BFMw5Vg8otgcr9g250/iHNs8Veh+x8=</diagram></mxfile>
beat/editor/widgets/dataset_icon.png
0 → 100644
View file @
7a93bf28
1.76 KB
beat/editor/widgets/toolchaineditor.py
View file @
7a93bf28
...
...
@@ -40,13 +40,16 @@ from PyQt5.QtGui import QFont
from
PyQt5.QtGui
import
QFontMetrics
from
PyQt5.QtGui
import
QPainterPath
from
PyQt5.QtGui
import
QTransform
from
PyQt5.QtGui
import
QIcon
from
PyQt5.QtWidgets
import
Q
V
BoxLayout
from
PyQt5.QtWidgets
import
Q
H
BoxLayout
from
PyQt5.QtWidgets
import
QWidget
from
PyQt5.QtWidgets
import
QGraphicsView
from
PyQt5.QtWidgets
import
QGraphicsItem
from
PyQt5.QtWidgets
import
QGraphicsPathItem
from
PyQt5.QtWidgets
import
QGraphicsObject
from
PyQt5.QtWidgets
import
QToolBar
from
PyQt5.QtWidgets
import
QAction
from
..backend.asset
import
AssetType
from
..backend.assetmodel
import
AssetModel
...
...
@@ -369,27 +372,25 @@ class Block(QGraphicsObject):
dataChanged
=
pyqtSignal
()
blockMoved
=
pyqtSignal
()
def
__init__
(
self
,
toolchain
,
block_details
,
block_type
,
style
,
connection_style
):
def
__init__
(
self
,
block_type
,
style
,
connection_style
):
super
().
__init__
()
# Block information
self
.
toolchain
=
toolchain
self
.
type
=
block_type
self
.
name
=
""
self
.
name
=
block_details
[
"name"
]
if
block_type
==
BlockType
.
DATASETS
.
name
:
if
self
.
type
==
BlockType
.
DATASETS
.
name
:
self
.
inputs
=
None
else
:
self
.
inputs
=
block_details
[
"inputs"
]
if
block_type
==
BlockType
.
ANALYZERS
.
name
:
self
.
inputs
=
[]
if
self
.
type
==
BlockType
.
ANALYZERS
.
name
:
self
.
outputs
=
None
else
:
self
.
outputs
=
block_details
[
"outputs"
]
self
.
outputs
=
[]
self
.
synchronized_channel
=
None
if
"synchronized_channel"
in
block_details
:
self
.
synchronized_channel
=
block_details
[
"synchronized_channel"
]
else
:
self
.
synchronized_channel
=
None
self
.
type
=
block_type
self
.
style
=
style
self
.
connection_style
=
connection_style
...
...
@@ -399,6 +400,21 @@ class Block(QGraphicsObject):
self
.
pins
[
"outputs"
]
=
dict
()
self
.
set_style
(
style
)
def
load
(
self
,
toolchain
,
block_details
):
self
.
toolchain
=
toolchain
self
.
name
=
block_details
[
"name"
]
if
self
.
type
!=
BlockType
.
DATASETS
.
name
:
self
.
inputs
=
block_details
[
"inputs"
]
if
self
.
type
!=
BlockType
.
ANALYZERS
.
name
:
self
.
outputs
=
block_details
[
"outputs"
]
if
"synchronized_channel"
in
block_details
:
self
.
synchronized_channel
=
block_details
[
"synchronized_channel"
]
self
.
set_style
(
self
.
style
)
self
.
create_pins
()
def
create_pins
(
self
):
...
...
@@ -440,14 +456,14 @@ class Block(QGraphicsObject):
metrics
=
QFontMetrics
(
self
.
text_font
)
text_width
=
metrics
.
boundingRect
(
self
.
name
).
width
()
+
14
if
self
.
inputs
is
not
None
:
if
self
.
inputs
is
not
None
and
len
(
self
.
inputs
)
>
0
:
self
.
max_inputs_width
=
(
metrics
.
boundingRect
(
max
(
self
.
inputs
,
key
=
len
)).
width
()
+
14
)
else
:
self
.
max_inputs_width
=
14
if
self
.
outputs
is
not
None
:
if
self
.
outputs
is
not
None
and
len
(
self
.
outputs
)
>
0
:
self
.
max_outputs_width
=
(
metrics
.
boundingRect
(
max
(
self
.
outputs
,
key
=
len
)).
width
()
+
14
)
...
...
@@ -688,9 +704,38 @@ class Toolchain(QWidget):
self
.
view
=
ToolchainView
(
self
)
self
.
view
.
setScene
(
self
.
scene
)
layout
=
QVBoxLayout
(
self
)
self
.
toolbar
=
QToolBar
()
dataset_action
=
QAction
(
QIcon
(
"beat/editor/widgets/dataset_icon.png"
),
"&Dataset"
,
self
)
dataset_action
.
triggered
.
connect
(
lambda
:
self
.
add_block
(
BlockType
.
DATASETS
))
block_action
=
QAction
(
QIcon
(
"beat/editor/widgets/block_icon.png"
),
"&Block"
,
self
)
block_action
.
triggered
.
connect
(
lambda
:
self
.
add_block
(
BlockType
.
BLOCKS
))
analyzer_action
=
QAction
(
QIcon
(
"beat/editor/widgets/analyzer_icon.png"
),
"&Analyzer"
,
self
)
analyzer_action
.
triggered
.
connect
(
lambda
:
self
.
add_block
(
BlockType
.
ANALYZERS
))
self
.
toolbar
.
addAction
(
dataset_action
)
self
.
toolbar
.
addAction
(
block_action
)
self
.
toolbar
.
addAction
(
analyzer_action
)
self
.
toolbar
.
setOrientation
(
Qt
.
Vertical
)
layout
=
QHBoxLayout
(
self
)
layout
.
addWidget
(
self
.
toolbar
)
layout
.
addWidget
(
self
.
view
)
def
add_block
(
self
,
block_type
):
self
.
new_block
=
Block
(
block_type
.
name
,
self
.
block_config
,
self
.
connection_config
)
self
.
scene
.
addItem
(
self
.
new_block
)
def
clear_space
(
self
):
self
.
scene
.
clear
()
self
.
scene
.
items
().
clear
()
...
...
@@ -719,12 +764,9 @@ class Toolchain(QWidget):
for
block_type
in
BlockType
:
for
block_item
in
self
.
json_object
[
block_type
.
value
]:
block
=
Block
(
self
,
block_item
,
block_type
.
name
,
self
.
block_config
,
self
.
connection_config
,
block_type
.
name
,
self
.
block_config
,
self
.
connection_config
)
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
:
...
...
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