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
!106
Move add_ports logic to drag_button
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Move add_ports logic to drag_button
addportrefactor
into
master
Overview
0
Commits
1
Pipelines
5
Changes
2
Merged
Oscar Gustafsson
requested to merge
addportrefactor
into
master
2 years ago
Overview
0
Commits
1
Pipelines
5
Changes
2
Expand
0
0
Merge request reports
Compare
version 4
version 4
da2f3879
2 years ago
version 3
e929962b
2 years ago
version 2
f64350dc
2 years ago
version 1
07c94da9
2 years ago
master (base)
and
latest version
latest version
4c588606
1 commit,
2 years ago
version 4
da2f3879
1 commit,
2 years ago
version 3
e929962b
1 commit,
2 years ago
version 2
f64350dc
1 commit,
2 years ago
version 1
07c94da9
1 commit,
2 years ago
Show latest version
2 files
+
15
−
19
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
b_asic/GUI/drag_button.py
+
6
−
6
Options
@@ -56,6 +56,8 @@ class DragButton(QPushButton):
self
.
_mouse_press_pos
=
None
self
.
_mouse_move_pos
=
None
self
.
_flipped
=
False
self
.
_properties_window
=
None
self
.
label
=
None
super
().
__init__
(
parent
)
def
contextMenuEvent
(
self
,
event
):
@@ -193,9 +195,7 @@ class DragButton(QPushButton):
for
signal
,
ports
in
self
.
_window
.
signalPortDict
.
items
():
if
any
(
map
(
lambda
port
:
set
(
port
).
intersection
(
set
(
self
.
_window
.
portDict
[
self
])
),
lambda
port
:
set
(
port
).
intersection
(
set
(
self
.
ports
)),
ports
,
)
):
@@ -234,15 +234,15 @@ class DragButton(QPushButton):
del
self
.
_window
.
operationDragDict
[
self
.
operation
]
def
add_ports
(
self
):
def
_determine_port_distance
(
height
,
ports
):
def
_determine_port_distance
(
op
height
,
ports
):
"""
Determine the distance between each port on the side of an operation.
The method returns the distance that each port should have from 0.
"""
return
(
[(
height
-
PORTHEIGHT
)
//
2
]
[(
op
height
-
PORTHEIGHT
)
//
2
]
if
ports
==
1
else
[(
PORTHEIGHT
+
GAP
)
*
i
for
i
in
range
(
ports
)]
else
[(
PORTHEIGHT
+
GAP
)
*
no
for
no
in
range
(
ports
)]
)
op
=
self
.
operation
Loading