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
2
Merged
Oscar Gustafsson
requested to merge
scheduler-gui
into
master
2 years ago
Overview
0
Commits
69
Pipelines
12
Changes
2
Expand
0
0
Merge request reports
Viewing commit
97dc434e
Prev
Next
Show latest version
2 files
+
110
−
9
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
97dc434e
workspace dump
· 97dc434e
Andreas Bolin
authored
2 years ago
b_asic/scheduler-gui/graphics_scene.py
0 → 100644
+
102
−
0
Options
# This Python file uses the following encoding: utf-8
"""
B-ASIC Scheduler-gui GraphicsScene Module.
Contains the GraphicsScene class for drawing items on.
"""
import
os
import
sys
from
typing
import
Any
from
pprint
import
pprint
from
typing
import
Any
,
AnyStr
,
Generic
,
Protocol
,
TypeVar
,
Union
,
Optional
,
overload
from
typing_extensions
import
Self
,
Final
,
Literal
,
LiteralString
,
TypeAlias
,
final
import
qtpy
from
qtpy
import
QtCore
from
qtpy
import
QtGui
from
qtpy
import
QtWidgets
# QGraphics and QPainter imports
from
qtpy.QtCore
import
(
QObject
,
QRect
,
QRectF
,
QPoint
,
QSize
,
QByteArray
)
from
qtpy.QtGui
import
(
QPaintEvent
,
QPainter
,
QPainterPath
,
QColor
,
QBrush
,
QPen
,
QFont
,
QPolygon
,
QIcon
,
QPixmap
,
QLinearGradient
)
from
qtpy.QtWidgets
import
(
QGraphicsView
,
QGraphicsScene
,
QGraphicsWidget
,
QGraphicsLayout
,
QGraphicsLinearLayout
,
QGraphicsGridLayout
,
QGraphicsLayoutItem
,
QGraphicsAnchorLayout
,
QGraphicsItem
,
QGraphicsItemGroup
)
# B-ASIC
import
logger
from
b_asic.schedule
import
Schedule
@final
class
GraphicsScene
(
QGraphicsScene
):
"""
GraphicsScene subclass of QGraphicsScene acts as a scene to place items on
"""
_id
:
Final
[
int
]
_schedule
:
Final
[
Schedule
]
# @overload
# def __init__(self, parent:Optional[QObject]=...) -> None:
# ...
# @overload
# def __init__(self, sceneRect:QRectF, parent:Optional[QObject]=...) -> None:
# ...
# @overload
# def __init__(self, x:float, y:float, width:float, height:float, parent:Optional[QObject]=...) -> None:
# ...
# @overload
# def __init__(self, parent: QObject, id: int, schedule: Optional[Schedule] = None, *args, **kwargs) -> None: ...
# @overload
# def __init__(self, id: int, schedule: Optional[Schedule] = None, *args, **kwargs) -> None:
# super(Self, self).__init__(parent, *args, **kwargs)
# self._id = id
# @overload
# def __init__(self, parent: QObject, id: int, *args, **kwargs):
# super(GraphicsScene, self).__init__(parent, *args, **kwargs)
# self.__init__(id, *args, **kwargs)
# def __init__(self, id: int, schedule: Schedule = None, parent: Optional[QObject]):
# super(GraphicsScene, self).__init__(parent)
# self._id = id
# self._schedule
def
__init__
(
self
,
id
:
int
,
schedule
:
Optional
[
"
Schedule
"
]
=
None
,
parent
:
Optional
[
"
QObject
"
]
=
None
):
# def __init__(self, id: int[, schedule: Schedule]):# = None, parent: Optional[QObject] = None):
super
(
GraphicsScene
,
self
).
__init__
(
parent
)
self
.
_id
=
id
self
.
_schedule
=
schedule
print
()
print
(
'
parent:
'
,
parent
)
print
(
'
type(parent):
'
,
type
(
parent
))
print
()
print
(
'
schedule:
'
,
schedule
)
print
(
'
type(schedule):
'
,
type
(
schedule
))
print
(
'
self._schedule:
'
,
self
.
_schedule
)
print
(
'
type(self._schedule):
'
,
type
(
self
.
_schedule
))
# def __init__(self, id: int):
# super(GraphicsScene, self).__init__()
# self._id = id
@property
def
id
(
self
):
return
self
.
_id
@property
def
schedule
(
self
):
return
self
.
_schedule
@schedule.setter
def
schedule
(
self
,
schedule
:
Schedule
):
self
.
_schedule
=
schedule
print
(
'
GraphicsScene.__mro__:
'
)
pprint
(
GraphicsScene
.
__mro__
)
Loading