Skip to content
Snippets Groups Projects

Add scheduler GUI

Merged Oscar Gustafsson requested to merge scheduler-gui into master
2 files
+ 110
9
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 102
0
 
# 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