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
97dc434e
Commit
97dc434e
authored
2 years ago
by
Andreas Bolin
Browse files
Options
Downloads
Patches
Plain Diff
workspace dump
parent
aec7f034
No related branches found
No related tags found
1 merge request
!78
Add scheduler GUI
Pipeline
#72856
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/scheduler-gui/graphics_scene.py
+102
-0
102 additions, 0 deletions
b_asic/scheduler-gui/graphics_scene.py
b_asic/scheduler-gui/main_window.py
+8
-9
8 additions, 9 deletions
b_asic/scheduler-gui/main_window.py
with
110 additions
and
9 deletions
b_asic/scheduler-gui/graphics_scene.py
0 → 100644
+
102
−
0
View file @
97dc434e
# 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__
)
This diff is collapsed.
Click to expand it.
b_asic/scheduler-gui/main_window.py
+
8
−
9
View file @
97dc434e
...
...
@@ -19,31 +19,30 @@ from pprint import pprint
#from diagram import *
from
importlib.machinery
import
SourceFileLoader
import
inspect
from
numpy
import
uint
# Qt/qtpy
import
qtpy
from
qtpy
import
uic
,
QtCore
,
QtGui
,
QtWidgets
from
qtpy.QtCore
import
QCoreApplication
,
Qt
,
Slot
,
QSettings
,
QStandardPaths
#QtCore QSize, QPoint
from
qtpy.QtGui
import
QCloseEvent
from
qtpy.QtWidgets
import
(
QApplication
,
QMainWindow
,
QMessageBox
,
QFileDialog
,
QInputDialog
,
QCheckBox
,
QAbstractButton
)
# QGraphics and QPainter imports
from
qtpy.QtCore
import
(
QRect
,
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
)
from
qtpy.QtGui
import
(
QPaintEvent
,
QPainter
,
QPainterPath
,
QColor
,
QBrush
,
QPen
,
QFont
,
QPolygon
,
QIcon
,
QPixmap
,
QLinearGradient
)
from
qtpy.QtCore
import
(
QRect
,
QPoint
,
QSize
,
QByteArray
)
# B-ASIC
import
logger
from
b_asic.schedule
import
Schedule
from
graphics_scene
import
GraphicsScene
log
=
logger
.
getLogger
()
...
...
@@ -103,7 +102,6 @@ QCoreApplication.setApplicationName('B-ASIC Scheduler')
class
MainWindow
(
QMainWindow
,
Ui_MainWindow
):
"""
Schedule of an SFG with scheduled Operations.
"""
_schedules
:
dict
_schedule_id
:
int
...
...
@@ -151,12 +149,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def
_init_graphics_view
(
self
)
->
None
:
"""
Initialize the QGraphics framework
"""
self
.
graphic_scene
=
Q
GraphicsScene
(
self
)
self
.
graphic_scene
=
GraphicsScene
(
0
,
parent
=
self
)
self
.
graphic_view
.
setScene
(
self
.
graphic_scene
)
self
.
graphic_view
.
setRenderHint
(
QPainter
.
Antialiasing
)
self
.
graphic_view
.
setGeometry
(
20
,
20
,
self
.
width
(),
self
.
height
())
self
.
graphic_view
.
setDragMode
(
QGraphicsView
.
RubberBandDrag
)
###############
...
...
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