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
aab2f316
Commit
aab2f316
authored
3 years ago
by
Andreas Bolin
Browse files
Options
Downloads
Patches
Plain Diff
workspace dump
parent
b4a524e8
Branches
Branches containing commit
No related tags found
1 merge request
!78
Add scheduler GUI
Pipeline
#73174
passed
3 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/scheduler-gui/graphics_graph_event.py
+82
-38
82 additions, 38 deletions
b_asic/scheduler-gui/graphics_graph_event.py
b_asic/scheduler-gui/graphics_graph_item.py
+48
-48
48 additions, 48 deletions
b_asic/scheduler-gui/graphics_graph_item.py
with
130 additions
and
86 deletions
b_asic/scheduler-gui/graphics_graph_event.py
+
82
−
38
View file @
aab2f316
...
@@ -44,10 +44,12 @@ from graphics_component_item import GraphicsComponentItem
...
@@ -44,10 +44,12 @@ from graphics_component_item import GraphicsComponentItem
# class GraphicsGraphEvent(ABC):
# class GraphicsGraphEvent(ABC):
class
GraphicsGraphEvent
(
QGraphicsItem
):
class
GraphicsGraphEvent
(
QGraphicsItem
):
"""
Event filter and handlers for GraphicsGraphItem
"""
"""
Event filter and handlers for GraphicsGraphItem
"""
# _component_group: list[GraphicsComponentItem]
# _components: list[GraphicsComponentItem]
_current_pos
:
QPointF
def
__init__
(
self
,
parent
:
QGraphicsItem
=
None
):
def
__init__
(
self
,
parent
:
QGraphicsItem
=
None
):
super
().
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
_current_pos
:
QPointF
()
# self.setAcceptedMouseButtons(Qt.LeftButton)
# self.setAcceptedMouseButtons(Qt.LeftButton)
# self.setFlag(QGraphicsItem.ItemIsMovable)
# self.setFlag(QGraphicsItem.ItemIsMovable)
# self.setFlag(QGraphicsItem.ItemIsSelectable)
# self.setFlag(QGraphicsItem.ItemIsSelectable)
...
@@ -69,48 +71,53 @@ class GraphicsGraphEvent(QGraphicsItem):
...
@@ -69,48 +71,53 @@ class GraphicsGraphEvent(QGraphicsItem):
"""
Installs an event filter for
'
item
'
on
'
self
'
, causing
"""
Installs an event filter for
'
item
'
on
'
self
'
, causing
all events for
'
item
'
to first pass through
'
self
'
s
all events for
'
item
'
to first pass through
'
self
'
s
sceneEventFilter() function.
"""
sceneEventFilter() function.
"""
for
item
in
self
.
_component
_group
:
for
item
in
self
.
_component
s
:
item
.
installSceneEventFilter
(
self
)
item
.
installSceneEventFilter
(
self
)
self
.
setFiltersChildEvents
(
True
)
# default false
self
.
setFiltersChildEvents
(
True
)
# default false
def
removeSceneEventFilters
(
self
)
->
None
:
def
removeSceneEventFilters
(
self
)
->
None
:
"""
Removes an event filter on
'
item
'
from
'
self
'
.
"""
"""
Removes an event filter on
'
item
'
from
'
self
'
.
"""
for
item
in
self
.
_component
_group
:
for
item
in
self
.
_component
s
:
item
.
removeSceneEventFilter
(
self
)
item
.
removeSceneEventFilter
(
self
)
self
.
setFiltersChildEvents
(
False
)
self
.
setFiltersChildEvents
(
False
)
# def sceneEventFilter(self, item: QGraphicsItem, event: QEvent) -> bool:
def
sceneEventFilter
(
self
,
item
:
QGraphicsItem
,
event
:
QEvent
)
->
bool
:
def
sceneEventFilter
(
self
,
item
:
QGraphicsItem
,
event
:
QEvent
)
->
bool
:
"""
Returns true if the event was filtered (i.e. stopped), otherwise false.
"""
"""
Returns true if the event was filtered (i.e. stopped), otherwise false.
type_
=
event
.
type
()
If false is returned, the event is forwarded to the appropriate child in
if
type_
!=
QEvent
.
GraphicsSceneHoverMove
:
print
(
f
'
Graph -->
\t
{
type
(
item
).
__name__
}
\t
{
type_
}
'
)
the event chain.
"""
print
(
__name__
)
# type_ = type(event)
# if type_ != QEvent.GraphicsSceneHoverMove: print(f'Graph -->\t{type(item).__name__}\t{type_}')
# if event.button():
# if event.button():
# # print(f'Graph -->\t{type_}\t{item}')
# # print(f'Graph -->\t{type_}\t{item}')
# print(f'-------->\t{event.button()}')
# print(f'-------->\t{event.button()}')
if
type
(
item
)
==
GraphicsComponentItem
:
if
type
(
item
)
==
GraphicsComponentItem
:
switch
=
{
switch
=
{
QEvent
.
FocusIn
:
self
.
graph
_focusInEvent
(
item
,
QFocusEvent
(
event
)
)
,
QEvent
.
FocusIn
:
self
.
comp
_focusInEvent
(
item
,
event
),
QEvent
.
GraphicsSceneContextMenu
:
self
.
graph
_contextMenuEvent
(
item
,
QGraphicsSceneContextMenuEvent
(
event
)
),
QEvent
.
GraphicsSceneContextMenu
:
self
.
comp
_contextMenuEvent
(
item
,
event
),
QEvent
.
GraphicsSceneDragEnter
:
self
.
graph
_dragEnterEvent
(
item
,
QGraphicsSceneDragDropEvent
(
event
)
),
QEvent
.
GraphicsSceneDragEnter
:
self
.
comp
_dragEnterEvent
(
item
,
event
),
QEvent
.
GraphicsSceneDragMove
:
self
.
graph
_dragMoveEvent
(
item
,
QGraphicsSceneDragDropEvent
(
event
)
),
QEvent
.
GraphicsSceneDragMove
:
self
.
comp
_dragMoveEvent
(
item
,
event
),
QEvent
.
GraphicsSceneDragLeave
:
self
.
graph
_dragLeaveEvent
(
item
,
QGraphicsSceneDragDropEvent
(
event
)
),
QEvent
.
GraphicsSceneDragLeave
:
self
.
comp
_dragLeaveEvent
(
item
,
event
),
QEvent
.
GraphicsSceneDrop
:
self
.
graph
_dropEvent
(
item
,
QGraphicsSceneDragDropEvent
(
event
)
),
QEvent
.
GraphicsSceneDrop
:
self
.
comp
_dropEvent
(
item
,
event
),
QEvent
.
GraphicsSceneHoverEnter
:
self
.
graph
_hoverEnterEvent
(
item
,
QGraphicsSceneHoverEvent
(
event
)
)
,
QEvent
.
GraphicsSceneHoverEnter
:
self
.
comp
_hoverEnterEvent
(
item
,
event
),
QEvent
.
GraphicsSceneHoverMove
:
self
.
graph
_hoverMoveEvent
(
item
,
QGraphicsSceneHoverEvent
(
event
)
)
,
QEvent
.
GraphicsSceneHoverMove
:
self
.
comp
_hoverMoveEvent
(
item
,
event
),
QEvent
.
GraphicsSceneHoverLeave
:
self
.
graph
_hoverLeaveEvent
(
item
,
QGraphicsSceneHoverEvent
(
event
)
)
,
QEvent
.
GraphicsSceneHoverLeave
:
self
.
comp
_hoverLeaveEvent
(
item
,
event
),
QEvent
.
GraphicsSceneMouseMove
:
self
.
graph
_mouseMoveEvent
(
item
,
QGraphicsSceneMouseEvent
(
event
)
)
,
QEvent
.
GraphicsSceneMouseMove
:
self
.
comp
_mouseMoveEvent
(
item
,
event
),
QEvent
.
GraphicsSceneMousePress
:
self
.
graph
_mousePressEvent
(
item
,
QGraphicsSceneMouseEvent
(
event
)
)
,
QEvent
.
GraphicsSceneMousePress
:
self
.
comp
_mousePressEvent
(
item
,
event
),
QEvent
.
GraphicsSceneMouseRelease
:
self
.
graph
_mouseReleaseEvent
(
item
,
QGraphicsSceneMouseEvent
(
event
)
)
,
QEvent
.
GraphicsSceneMouseRelease
:
self
.
comp
_mouseReleaseEvent
(
item
,
event
),
QEvent
.
GraphicsSceneMouseDoubleClick
:
self
.
graph
_mouseDoubleClickEvent
(
item
,
QGraphicsSceneMouseEvent
(
event
)
)
,
QEvent
.
GraphicsSceneMouseDoubleClick
:
self
.
comp
_mouseDoubleClickEvent
(
item
,
event
),
QEvent
.
GraphicsSceneWheel
:
self
.
graph
_wheelEvent
(
item
,
QGraphicsSceneWheelEvent
(
event
)
)
QEvent
.
GraphicsSceneWheel
:
self
.
comp
_wheelEvent
(
item
,
event
)
}
}
# return switch.get(event.type(), self.log(item, event); False)
# return switch.get(event.type(), self.log(item, event); False)
print
(
event
.
type
())
print
(
f
'
{
event
.
type
()
}
contains:
{
event
.
type
()
in
switch
}
'
)
return
switch
.
get
(
event
.
type
(),
False
)
return
switch
.
get
(
event
.
type
(),
False
)
else
:
#
else:
print
(
f
'
Graph -->
\t
{
type
(
item
).
__name__
}
\t
{
type_
}
'
)
#
print(f'Graph -->\t{type(item).__name__}\t{type_}')
return
False
# returns False if event is ignored and pass through event to its child
return
False
# returns False if event is ignored and pass through event to its child
...
@@ -124,17 +131,54 @@ class GraphicsGraphEvent(QGraphicsItem):
...
@@ -124,17 +131,54 @@ class GraphicsGraphEvent(QGraphicsItem):
########################
########################
#### Event Handlers ####
#### Event Handlers ####
########################
########################
def
graph_focusInEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QFocusEvent
)
->
bool
:
...
def
comp_focusInEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QFocusEvent
)
->
bool
:
def
graph_contextMenuEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneContextMenuEvent
)
->
bool
:
...
print
(
f
'
comp_focusInEvent() -->
\t
{
type
(
item
).
__name__
}
\t
{
event
.
type
()
}
'
)
def
graph_dragEnterEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneDragDropEvent
)
->
bool
:
...
def
comp_contextMenuEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneContextMenuEvent
)
->
bool
:
...
def
graph_dragMoveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneDragDropEvent
)
->
bool
:
...
def
comp_dragEnterEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneDragDropEvent
)
->
bool
:
...
def
graph_dragLeaveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneDragDropEvent
)
->
bool
:
...
def
comp_dragMoveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneDragDropEvent
)
->
bool
:
...
def
graph_dropEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneDragDropEvent
)
->
bool
:
...
def
comp_dragLeaveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneDragDropEvent
)
->
bool
:
...
def
graph_hoverEnterEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneHoverEvent
)
->
bool
:
...
def
comp_dropEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneDragDropEvent
)
->
bool
:
...
def
graph_hoverMoveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneHoverEvent
)
->
bool
:
...
def
comp_hoverEnterEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneHoverEvent
)
->
bool
:
...
def
graph_hoverLeaveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneHoverEvent
)
->
bool
:
...
def
comp_hoverMoveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneHoverEvent
)
->
bool
:
...
def
graph_mouseMoveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneMouseEvent
)
->
bool
:
...
def
comp_hoverLeaveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneHoverEvent
)
->
bool
:
...
def
graph_mousePressEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneMouseEvent
)
->
bool
:
...
def
graph_mouseReleaseEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneMouseEvent
)
->
bool
:
...
def
comp_mouseMoveEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneMouseEvent
)
->
bool
:
def
graph_mouseDoubleClickEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneMouseEvent
)
->
bool
:
...
"""
Set the position of the graphical element in the graphic scene,
def
graph_wheelEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneWheelEvent
)
->
bool
:
...
translate coordinates of the cursor within the graphic element
\ No newline at end of file
in the coordinate system of the parent object
"""
print
(
f
'
comp_mouseMoveEvent() -->
\t
{
type
(
item
).
__name__
}
\t
{
event
.
type
()
}
'
)
# # Qt.DragMoveCursor
# # button = event.button()
# self
# dx = (item.mapToParent(event.pos()) - self._current_pos).x()
# if dx > 5.05:
# # TODO: send signal
# item.setX(item.x() + 10.0)
# self._current_pos.setX(self._current_pos.x() + 10.0)
# elif dx < -5.05:
# # TODO: send signal
# item.setX(item.x() - 10-0)
# self._current_pos.setX(self._current_pos.x() - 10.0)
return
True
def
comp_mousePressEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneMouseEvent
)
->
bool
:
"""
Changes the cursor to ClosedHandCursor when grabbing an object
"""
print
(
f
'
comp_mousePressEvent() -->
\t
{
type
(
item
).
__name__
}
\t
{
event
.
type
()
}
'
)
# print('GraphicsComponentEvent.mousePressEvent()')
# print(f'button: {event.button()}')
# self._current_pos = item.mapToParent(event.pos())
# item.setCursor(QCursor(Qt.ClosedHandCursor))
# event.accept()
return
True
def
comp_mouseReleaseEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneMouseEvent
)
->
bool
:
"""
Changes the cursor to OpenHandCursor when releasing an object
"""
print
(
f
'
comp_mouseReleaseEvent() -->
\t
{
type
(
item
).
__name__
}
\t
{
event
.
type
()
}
'
)
# print('GraphicsComponentEvent.mouseReleaseEvent()')
# item.setCursor(QCursor(Qt.OpenHandCursor))
# event.accept()
return
True
def
comp_mouseDoubleClickEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneMouseEvent
)
->
bool
:
...
def
comp_wheelEvent
(
self
,
item
:
QGraphicsItem
,
event
:
QGraphicsSceneWheelEvent
)
->
bool
:
...
\ No newline at end of file
This diff is collapsed.
Click to expand it.
b_asic/scheduler-gui/graphics_graph_item.py
+
48
−
48
View file @
aab2f316
...
@@ -39,11 +39,11 @@ from graphics_axis_item import GraphicsAxisItem
...
@@ -39,11 +39,11 @@ from graphics_axis_item import GraphicsAxisItem
from
graphics_graph_event
import
GraphicsGraphEvent
from
graphics_graph_event
import
GraphicsGraphEvent
class
GraphicsGraphItem
(
QGraphicsItemGroup
):
class
GraphicsGraphItem
(
QGraphicsItemGroup
,
GraphicsGraphEvent
):
_schedule
:
Schedule
_schedule
:
Schedule
_axis
:
GraphicsAxisItem
_axis
:
GraphicsAxisItem
_component
_group
:
list
[
GraphicsComponentItem
]
_component
s
:
list
[
GraphicsComponentItem
]
_components_height
:
float
_components_height
:
float
_x_axis_indent
:
float
_x_axis_indent
:
float
...
@@ -61,10 +61,10 @@ class GraphicsGraphItem(QGraphicsItemGroup):
...
@@ -61,10 +61,10 @@ class GraphicsGraphItem(QGraphicsItemGroup):
self
.
_schedule
=
deepcopy
(
schedule
)
self
.
_schedule
=
deepcopy
(
schedule
)
self
.
_axis
=
None
self
.
_axis
=
None
# self._component
_group
= QGraphicsItemGroup()
# self._component
s
= QGraphicsItemGroup()
self
.
_component
_group
=
[]
self
.
_component
s
=
[]
# self._component
_group
.setHandlesChildEvents(False)
# self._component
s
.setHandlesChildEvents(False)
# self._component
_group
.setAcceptedMouseButtons(Qt.NoButton)
# self._component
s
.setAcceptedMouseButtons(Qt.NoButton)
self
.
_components_height
=
0.0
self
.
_components_height
=
0.0
self
.
_x_axis_indent
=
2.0
self
.
_x_axis_indent
=
2.0
...
@@ -74,10 +74,10 @@ class GraphicsGraphItem(QGraphicsItemGroup):
...
@@ -74,10 +74,10 @@ class GraphicsGraphItem(QGraphicsItemGroup):
self
.
_components_height
+=
spacing
self
.
_components_height
+=
spacing
component
=
GraphicsComponentItem
()
component
=
GraphicsComponentItem
()
component
.
setPos
(
self
.
_x_axis_indent
,
self
.
_components_height
)
component
.
setPos
(
self
.
_x_axis_indent
,
self
.
_components_height
)
self
.
_component
_group
.
append
(
component
)
self
.
_component
s
.
append
(
component
)
# self._component
_group
.addToGroup(component)
# self._component
s
.addToGroup(component)
self
.
_components_height
+=
component
.
height
self
.
_components_height
+=
component
.
height
# self._component
_group
.setPos(self._x_axis_indent, spacing)
# self._component
s
.setPos(self._x_axis_indent, spacing)
self
.
_components_height
+=
spacing
self
.
_components_height
+=
spacing
# build axis
# build axis
...
@@ -85,51 +85,51 @@ class GraphicsGraphItem(QGraphicsItemGroup):
...
@@ -85,51 +85,51 @@ class GraphicsGraphItem(QGraphicsItemGroup):
# add axis and components
# add axis and components
self
.
addToGroup
(
self
.
_axis
)
self
.
addToGroup
(
self
.
_axis
)
for
component
in
self
.
_component
_group
:
for
component
in
self
.
_component
s
:
self
.
addToGroup
(
component
)
self
.
addToGroup
(
component
)
# self.addToGroup(self._component
_group
)
# self.addToGroup(self._component
s
)
def
installSceneEventFilters
(
self
)
->
None
:
#
def installSceneEventFilters(self) -> None:
for
item
in
self
.
_component
_group
:
#
for item in self._component
s
:
item
.
installSceneEventFilter
(
self
)
#
item.installSceneEventFilter(self)
# for item in self._component
_group
.childItems():
#
# for item in self._component
s
.childItems():
# item.installSceneEventFilter(self)
#
# item.installSceneEventFilter(self)
self
.
setFiltersChildEvents
(
True
)
# default false
#
self.setFiltersChildEvents(True) # default false
def
sceneEventFilter
(
self
,
item
:
QGraphicsItem
,
event
:
QEvent
)
->
bool
:
#
def sceneEventFilter(self, item: QGraphicsItem, event: QEvent) -> bool:
"""
Returns true if the event was filtered (i.e. stopped), otherwise false.
"""
#
"""Returns true if the event was filtered (i.e. stopped), otherwise false."""
type_
=
event
.
type
()
#
type_ = event.type()
if
type_
!=
QEvent
.
GraphicsSceneHoverMove
:
print
(
f
'
Graph -->
\t
{
type
(
item
).
__name__
}
\t
{
type_
}
'
)
#
if type_ != QEvent.GraphicsSceneHoverMove: print(f'Graph -->\t{type(item).__name__}\t{type_}')
print
(
__name__
)
#
print(__name__)
# if event.button():
#
# if event.button():
# # print(f'Graph -->\t{type_}\t{item}')
#
# # print(f'Graph -->\t{type_}\t{item}')
# print(f'-------->\t{event.button()}')
#
# print(f'-------->\t{event.button()}')
if
type
(
item
)
==
GraphicsComponentItem
:
#
if type(item) == GraphicsComponentItem:
switch
=
{
#
switch = {
QEvent
.
FocusIn
:
self
.
graph_focusInEvent
(
item
,
Qt
.
QFocusEvent
(
event
)),
#
QEvent.FocusIn: self.graph_focusInEvent(item, Qt.QFocusEvent(event)),
QEvent
.
GraphicsSceneContextMenu
:
self
.
graph_contextMenuEvent
(
item
,
Qt
.
QGraphicsSceneContextMenuEvent
(
event
)),
#
QEvent.GraphicsSceneContextMenu: self.graph_contextMenuEvent(item, Qt.QGraphicsSceneContextMenuEvent(event)),
QEvent
.
GraphicsSceneDragEnter
:
self
.
graph_dragEnterEvent
(
item
,
Qt
.
QGraphicsSceneDragDropEvent
(
event
)),
#
QEvent.GraphicsSceneDragEnter: self.graph_dragEnterEvent(item, Qt.QGraphicsSceneDragDropEvent(event)),
QEvent
.
GraphicsSceneDragMove
:
self
.
graph_dragMoveEvent
(
item
,
Qt
.
QGraphicsSceneDragDropEvent
(
event
)),
#
QEvent.GraphicsSceneDragMove: self.graph_dragMoveEvent(item, Qt.QGraphicsSceneDragDropEvent(event)),
QEvent
.
GraphicsSceneDragLeave
:
self
.
graph_dragLeaveEvent
(
item
,
Qt
.
QGraphicsSceneDragDropEvent
(
event
)),
#
QEvent.GraphicsSceneDragLeave: self.graph_dragLeaveEvent(item, Qt.QGraphicsSceneDragDropEvent(event)),
QEvent
.
GraphicsSceneDrop
:
self
.
graph_dropEvent
(
item
,
Qt
.
QGraphicsSceneDragDropEvent
(
event
)),
#
QEvent.GraphicsSceneDrop: self.graph_dropEvent(item, Qt.QGraphicsSceneDragDropEvent(event)),
QEvent
.
GraphicsSceneHoverEnter
:
self
.
graph_hoverEnterEvent
(
item
,
Qt
.
QGraphicsSceneHoverEvent
(
event
)),
#
QEvent.GraphicsSceneHoverEnter: self.graph_hoverEnterEvent(item, Qt.QGraphicsSceneHoverEvent(event)),
QEvent
.
GraphicsSceneHoverMove
:
self
.
graph_hoverMoveEvent
(
item
,
Qt
.
QGraphicsSceneHoverEvent
(
event
)),
#
QEvent.GraphicsSceneHoverMove: self.graph_hoverMoveEvent(item, Qt.QGraphicsSceneHoverEvent(event)),
QEvent
.
GraphicsSceneHoverLeave
:
self
.
graph_hoverLeaveEvent
(
item
,
Qt
.
QGraphicsSceneHoverEvent
(
event
)),
#
QEvent.GraphicsSceneHoverLeave: self.graph_hoverLeaveEvent(item, Qt.QGraphicsSceneHoverEvent(event)),
QEvent
.
GraphicsSceneMouseMove
:
self
.
graph_mouseMoveEvent
(
item
,
Qt
.
QGraphicsSceneMouseEvent
(
event
)),
#
QEvent.GraphicsSceneMouseMove: self.graph_mouseMoveEvent(item, Qt.QGraphicsSceneMouseEvent(event)),
QEvent
.
GraphicsSceneMousePress
:
self
.
graph_mousePressEvent
(
item
,
Qt
.
QGraphicsSceneMouseEvent
(
event
)),
#
QEvent.GraphicsSceneMousePress: self.graph_mousePressEvent(item, Qt.QGraphicsSceneMouseEvent(event)),
QEvent
.
GraphicsSceneMouseRelease
:
self
.
graph_mouseReleaseEvent
(
item
,
Qt
.
QGraphicsSceneMouseEvent
(
event
)),
#
QEvent.GraphicsSceneMouseRelease: self.graph_mouseReleaseEvent(item, Qt.QGraphicsSceneMouseEvent(event)),
QEvent
.
GraphicsSceneMouseDoubleClick
:
self
.
graph_mouseDoubleClickEvent
(
item
,
Qt
.
QGraphicsSceneMouseEvent
(
event
)),
#
QEvent.GraphicsSceneMouseDoubleClick: self.graph_mouseDoubleClickEvent(item, Qt.QGraphicsSceneMouseEvent(event)),
QEvent
.
GraphicsSceneWheel
:
self
.
graph_wheelEvent
(
item
,
Qt
.
QGraphicsSceneWheelEvent
(
event
))
#
QEvent.GraphicsSceneWheel: self.graph_wheelEvent(item, Qt.QGraphicsSceneWheelEvent(event))
}
#
}
return
switch
.
get
(
event
.
type
(),
self
.
log
(
item
,
event
);
False
)
#
return switch.get(event.type(), self.log(item, event); False)
return
switch
.
get
(
event
.
type
(),
False
)
#
return switch.get(event.type(), False)
else
:
#
else:
print
(
f
'
Graph -->
\t
{
type
(
item
).
__name__
}
\t
{
type_
}
'
)
#
print(f'Graph -->\t{type(item).__name__}\t{type_}')
return
False
# returns False if event is ignored and passed through to its child
#
return False # returns False if event is ignored and passed through to its child
# # def sceneEvent(self, event: QEvent) -> bool:
# # def sceneEvent(self, event: QEvent) -> bool:
# # print(f'sceneEvent() --> {event.type()}')
# # print(f'sceneEvent() --> {event.type()}')
...
@@ -154,6 +154,6 @@ class GraphicsGraphItem(QGraphicsItemGroup):
...
@@ -154,6 +154,6 @@ class GraphicsGraphItem(QGraphicsItemGroup):
@property
@property
def
items
(
self
)
->
list
[
GraphicsComponentItem
]:
def
items
(
self
)
->
list
[
GraphicsComponentItem
]:
return
self
.
_component
_group
.
childItems
()
return
self
.
_component
s
.
childItems
()
\ No newline at end of file
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