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
71273670
Commit
71273670
authored
Nov 08, 2019
by
Flavio TARSETTI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[widgets][toolchaineditor] delete connection from end pin on re-draw
parent
08718bb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
beat/editor/widgets/toolchaineditor.py
beat/editor/widgets/toolchaineditor.py
+24
-4
No files found.
beat/editor/widgets/toolchaineditor.py
View file @
71273670
...
...
@@ -56,9 +56,11 @@ from .editor import AbstractAssetEditor
from
.drawing_space
import
DrawingSpace
class
BasePin
(
QGraphics
Item
):
class
BasePin
(
QGraphics
Object
):
"""Base class for pin graphics"""
dataChanged
=
pyqtSignal
()
def
__init__
(
self
,
parent
,
pin
,
block
,
pin_brush
,
pin_pen
):
super
().
__init__
(
parent
=
parent
)
...
...
@@ -98,6 +100,18 @@ class BasePin(QGraphicsItem):
def
mouseMoveEvent
(
self
,
event
):
"""Painting connection in progress"""
# Only one single connection allowed from input pin
if
isinstance
(
self
,
InputPin
):
# Check if connection exist and remove if it does
for
connection
in
self
.
block_object
.
toolchain
.
connections
:
if
(
connection
.
end_block
==
self
.
block_object
and
connection
.
end_pin
==
self
):
self
.
block_object
.
toolchain
.
connections
.
remove
(
connection
)
self
.
block_object
.
scene
().
removeItem
(
connection
)
self
.
dataChanged
.
emit
()
mouse_position
=
self
.
mapToScene
(
event
.
pos
())
self
.
new_connection
.
set_new_connection_pins_coordinates
(
self
,
mouse_position
)
...
...
@@ -143,6 +157,9 @@ class BasePin(QGraphicsItem):
connection
.
load
(
self
.
block_object
.
toolchain
,
connection_settings
,
channel_colors
)
self
.
dataChanged
.
emit
()
self
.
block_object
.
toolchain
.
connections
.
append
(
connection
)
self
.
block_object
.
toolchain
.
scene
.
addItem
(
connection
)
...
...
@@ -290,9 +307,8 @@ class Connection(QGraphicsPathItem):
# check if end block pin is free
toolchain
=
end
.
block_object
.
toolchain
for
connection
in
toolchain
.
connections
:
if
connection
.
end_block
==
end
.
block_object
:
if
connection
.
end_pin
==
end
:
return
False
if
connection
.
end_block
==
end
.
block_object
and
connection
.
end_pin
==
end
:
return
False
return
True
...
...
@@ -394,6 +410,8 @@ class Block(QGraphicsObject):
)
self
.
pins
[
"inputs"
][
pin_name
]
=
input_pin
input_pin
.
dataChanged
.
connect
(
self
.
dataChanged
)
if
self
.
outputs
is
not
None
:
for
pin_name
in
self
.
outputs
:
output_pin
=
OutputPin
(
...
...
@@ -401,6 +419,8 @@ class Block(QGraphicsObject):
)
self
.
pins
[
"outputs"
][
pin_name
]
=
output_pin
output_pin
.
dataChanged
.
connect
(
self
.
dataChanged
)
def
set_style
(
self
,
config
):
self
.
setAcceptHoverEvents
(
True
)
...
...
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