Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Merge requests
!78
Add scheduler GUI
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add scheduler GUI
scheduler-gui
into
master
Overview
0
Commits
69
Pipelines
12
Changes
36
Merged
Oscar Gustafsson
requested to merge
scheduler-gui
into
master
2 years ago
Overview
0
Commits
69
Pipelines
12
Changes
1
Expand
0
0
Merge request reports
Compare
version 5
version 11
4c271a61
2 years ago
version 10
90d91a14
2 years ago
version 9
4b0e1c0f
2 years ago
version 8
439637c5
2 years ago
version 7
7407ef25
2 years ago
version 6
abe9e211
2 years ago
version 5
6504e635
2 years ago
version 4
c77555aa
2 years ago
version 3
0117c82a
2 years ago
version 2
a518bcc2
2 years ago
version 1
af2d2fd8
2 years ago
master (base)
and
version 6
latest version
1af7bf4f
69 commits,
2 years ago
version 11
4c271a61
68 commits,
2 years ago
version 10
90d91a14
67 commits,
2 years ago
version 9
4b0e1c0f
66 commits,
2 years ago
version 8
439637c5
65 commits,
2 years ago
version 7
7407ef25
64 commits,
2 years ago
version 6
abe9e211
63 commits,
2 years ago
version 5
6504e635
62 commits,
2 years ago
version 4
c77555aa
61 commits,
2 years ago
version 3
0117c82a
60 commits,
2 years ago
version 2
a518bcc2
59 commits,
2 years ago
version 1
af2d2fd8
58 commits,
2 years ago
Show latest version
1 file
+
54
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
b_asic/scheduler-gui/graphics_signal.py
0 → 100644
+
54
−
0
Options
from
typing
import
Optional
from
qtpy.QtWidgets
import
QGraphicsItem
,
QGraphicsPathItem
from
qtpy.QtGui
import
QPainterPath
,
QPen
from
qtpy.QtCore
import
Qt
,
QPointF
# B-ASIC
from
b_asic.signal
import
Signal
from
graphics_component_item
import
GraphicsComponentItem
class
GraphicsSignal
(
QGraphicsPathItem
):
_path
:
Optional
[
QPainterPath
]
=
None
_src_operation
:
GraphicsComponentItem
_dest_operation
:
GraphicsComponentItem
_signal
:
Signal
def
__init__
(
self
,
src_operation
:
GraphicsComponentItem
,
dest_operation
:
GraphicsComponentItem
,
signal
:
Signal
,
pen
:
Optional
[
QPen
]
=
None
,
parent
:
Optional
[
QGraphicsItem
]
=
None
):
super
().
__init__
(
parent
=
parent
)
self
.
_src_operation
=
src_operation
self
.
_dest_operation
=
dest_operation
self
.
_signal
=
signal
if
pen
is
None
:
pen
=
QPen
(
Qt
.
black
)
pen
.
setWidthF
(
0.03
)
self
.
setPen
(
pen
)
self
.
update_path
()
def
update_path
(
self
):
"""
Create a new path after moving connected operations.
"""
source_point
=
self
.
_src_operation
.
get_port_location
(
f
"
out
{
self
.
_signal
.
source
.
index
}
"
)
dest_point
=
self
.
_dest_operation
.
get_port_location
(
f
"
in
{
self
.
_signal
.
destination
.
index
}
"
)
path
=
QPainterPath
()
path
.
moveTo
(
source_point
)
source_x
=
source_point
.
x
()
source_y
=
source_point
.
y
()
dest_x
=
dest_point
.
x
()
dest_y
=
dest_point
.
y
()
if
abs
(
source_x
-
dest_x
)
<=
0.1
:
ctrl_point1
=
QPointF
(
source_x
+
0.5
,
source_y
)
ctrl_point2
=
QPointF
(
source_x
-
0.5
,
dest_y
)
else
:
mid_x
=
(
source_x
+
dest_x
)
/
2
ctrl_point1
=
QPointF
(
mid_x
,
source_y
)
ctrl_point2
=
QPointF
(
mid_x
,
dest_y
)
path
.
cubicTo
(
ctrl_point1
,
ctrl_point2
,
dest_point
)
self
.
setPath
(
path
)
Loading