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
Commits
a555ea21
Commit
a555ea21
authored
4 years ago
by
Jacob Wahlman
Committed by
Adam Jakobsson
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Resize GUI Window"
parent
a99172b8
No related branches found
Branches containing commit
No related tags found
2 merge requests
!67
WIP: B-ASIC version 1.0.0 hotfix
,
!65
B-ASIC version 1.0.0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/GUI/drag_button.py
+9
-15
9 additions, 15 deletions
b_asic/GUI/drag_button.py
b_asic/GUI/main_window.py
+17
-7
17 additions, 7 deletions
b_asic/GUI/main_window.py
b_asic/GUI/port_button.py
+2
-3
2 additions, 3 deletions
b_asic/GUI/port_button.py
with
28 additions
and
25 deletions
b_asic/GUI/drag_button.py
+
9
−
15
View file @
a555ea21
...
...
@@ -26,6 +26,8 @@ class DragButton(QPushButton):
self
.
operation_path_name
=
operation_path_name
self
.
clicked
=
0
self
.
pressed
=
False
self
.
_mouse_press_pos
=
None
self
.
_mouse_move_pos
=
None
super
(
DragButton
,
self
).
__init__
(
self
.
_window
)
def
contextMenuEvent
(
self
,
event
):
...
...
@@ -35,20 +37,18 @@ class DragButton(QPushButton):
properties
.
triggered
.
connect
(
self
.
show_properties_window
)
menu
.
exec_
(
self
.
cursor
().
pos
())
def
show_properties_window
(
self
):
self
.
properties_window
=
PropertiesWindow
(
self
,
self
.
_
_
window
)
def
show_properties_window
(
self
,
event
):
self
.
properties_window
=
PropertiesWindow
(
self
,
self
.
_window
)
self
.
properties_window
.
show
()
def
add_label
(
self
,
label
):
self
.
label
=
label
def
mousePressEvent
(
self
,
event
):
self
.
_mouse_press_pos
=
None
self
.
_mouse_move_pos
=
None
if
event
.
button
()
==
Qt
.
LeftButton
:
self
.
_mouse_press_pos
=
event
.
globalP
os
()
self
.
_mouse_move_pos
=
event
.
globalP
os
()
self
.
_mouse_press_pos
=
event
.
p
os
()
self
.
_mouse_move_pos
=
event
.
p
os
()
for
signal
in
self
.
_window
.
signalList
:
signal
.
update
()
...
...
@@ -77,20 +77,14 @@ class DragButton(QPushButton):
def
mouseMoveEvent
(
self
,
event
):
if
event
.
buttons
()
==
Qt
.
LeftButton
:
cur_pos
=
self
.
mapToGlobal
(
self
.
pos
())
global_pos
=
event
.
globalPos
()
diff
=
global_pos
-
self
.
_mouse_move_pos
new_pos
=
self
.
mapFromGlobal
(
cur_pos
+
diff
)
self
.
move
(
new_pos
)
self
.
_mouse_move_pos
=
global_pos
self
.
move
(
self
.
mapToParent
(
event
.
pos
()
-
self
.
_mouse_press_pos
))
self
.
_window
.
update
()
super
(
DragButton
,
self
).
mouseMoveEvent
(
event
)
def
mouseReleaseEvent
(
self
,
event
):
if
self
.
_mouse_press_pos
is
not
None
:
moved
=
event
.
globalP
os
()
-
self
.
_mouse_press_pos
moved
=
event
.
p
os
()
-
self
.
_mouse_press_pos
if
moved
.
manhattanLength
()
>
3
:
event
.
ignore
()
return
...
...
This diff is collapsed.
Click to expand it.
b_asic/GUI/main_window.py
+
17
−
7
View file @
a555ea21
...
...
@@ -26,6 +26,10 @@ QGraphicsProxyWidget
from
PyQt5.QtCore
import
Qt
,
QSize
from
PyQt5.QtGui
import
QIcon
,
QFont
,
QPainter
,
QPen
,
QBrush
,
QKeySequence
MIN_WIDTH_SCENE
=
600
MIN_HEIGHT_SCENE
=
520
@decorate_class
(
handle_error
)
class
MainWindow
(
QMainWindow
):
def
__init__
(
self
):
...
...
@@ -68,19 +72,25 @@ class MainWindow(QMainWindow):
self
.
create_graphics_view
()
def
create_graphics_view
(
self
):
self
.
scene
=
QGraphicsScene
()
self
.
scene
=
QGraphicsScene
(
self
)
self
.
graphic_view
=
QGraphicsView
(
self
.
scene
,
self
)
self
.
graphic_view
.
setRenderHint
(
QPainter
.
Antialiasing
)
self
.
graphic_view
.
setGeometry
(
250
,
4
0
,
600
,
520
)
self
.
graphic_view
.
setGeometry
(
self
.
ui
.
operation_box
.
width
()
,
0
,
self
.
width
(),
self
.
height
()
)
self
.
graphic_view
.
setDragMode
(
QGraphicsView
.
ScrollHandDrag
)
def
resizeEvent
(
self
,
event
):
self
.
ui
.
operation_box
.
setGeometry
(
10
,
10
,
self
.
ui
.
operation_box
.
width
(),
self
.
height
())
self
.
graphic_view
.
setGeometry
(
self
.
ui
.
operation_box
.
width
()
+
20
,
0
,
self
.
width
()
-
self
.
ui
.
operation_box
.
width
()
-
20
,
self
.
height
())
super
(
MainWindow
,
self
).
resizeEvent
(
event
)
def
wheelEvent
(
self
,
event
):
old_zoom
=
self
.
zoom
self
.
zoom
+=
event
.
angleDelta
().
y
()
/
2500
self
.
graphic_view
.
scale
(
self
.
zoom
,
self
.
zoom
)
self
.
zoom
=
old_zoom
if
event
.
modifiers
()
==
Qt
.
ControlModifier
:
old_zoom
=
self
.
zoom
self
.
zoom
+=
event
.
angleDelta
().
y
()
/
2500
self
.
graphic_view
.
scale
(
self
.
zoom
,
self
.
zoom
)
self
.
zoom
=
old_zoom
def
view_operation_names
(
self
):
def
view_operation_names
(
self
,
event
):
if
self
.
check_show_names
.
isChecked
():
self
.
is_show_names
=
True
else
:
...
...
This diff is collapsed.
Click to expand it.
b_asic/GUI/port_button.py
+
2
−
3
View file @
a555ea21
...
...
@@ -20,7 +20,6 @@ class PortButton(QPushButton):
menu
.
exec_
(
self
.
cursor
().
pos
())
def
mousePressEvent
(
self
,
event
):
if
event
.
button
()
==
Qt
.
LeftButton
:
self
.
clicked
+=
1
if
self
.
clicked
==
1
:
...
...
@@ -29,11 +28,11 @@ class PortButton(QPushButton):
self
.
window
.
pressed_ports
.
append
(
self
)
elif
self
.
clicked
==
2
:
self
.
setStyleSheet
(
"
background-color: white
"
)
self
.
pressed
=
False
self
.
pressed
=
False
self
.
clicked
=
0
self
.
window
.
pressed_ports
.
remove
(
self
)
super
(
PortButton
,
self
).
mousePressEvent
(
event
)
def
mouseReleaseEvent
(
self
,
event
):
super
(
PortButton
,
self
).
mouseReleaseEvent
(
event
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment