Scheduler GUI

Module contents

B-ASIC Scheduler-gui Module.

Graphical user interface for B-ASIC scheduler.

b_asic.scheduler_gui.start_scheduler(schedule: Schedule | None = None) Schedule | None

Start scheduler GUI.

Parameters:
scheduleSchedule, optional

The schedule to start the editor with.

Returns:
Schedule

The edited schedule.

Submodules

scheduler_gui.main_window module

B-ASIC Scheduler-GUI Module.

Contains the scheduler_gui MainWindow class for scheduling operations in an SFG.

Start main-window with start_gui().

class b_asic.scheduler_gui.main_window.ScheduleMainWindow

Bases: QMainWindow, Ui_MainWindow

Schedule of an SFG with scheduled Operations.

close_schedule() None

Close current schedule.

SLOT() for SIGNAL(menu_close_schedule.triggered)

exit_app() None

Exit application.

hide_exit_dialog(checked: bool) None

Update state of exit dialog setting.

SLOT(bool) for SIGNAL(menu_exit_dialog.triggered) Takes in a boolean and stores ‘checked’ in ‘hide_exit_dialog’ item in settings.

info_table_clear() None

Clear the info table.

info_table_clear_component() None

Clear the component part of the info table.

info_table_clear_schedule() None

Clear the schedule part of the info table.

info_table_fill_schedule(schedule: Schedule) None

Fill the ‘Schedule’ part of the info table.

Parameters:
scheduleSchedule

The Schedule to get information from.

info_table_update_component(graph_id: GraphID) None

Fill the ‘Operation’ part of the info table.

SLOT(str) for SIGNAL(_graph._signals.component_selected) Takes in an operator-id, first clears the ‘Operator’ part of the info table and then fill in the table with new values from the operator associated with graph_id.

info_table_update_schedule() None

Update the ‘Schedule’ part of the info table.

SLOT() for SIGNAL(_graph._signals.schedule_time_changed) Updates the ‘Schedule’ part of the info table.

open(schedule: Schedule) None

Take a Schedule and create a SchedulerItem object.

open_schedule() None

Open a schedule.

SLOT() for SIGNAL(menu_open.triggered)

save() None

Save current schedule.

SLOT() for SIGNAL(menu_save.triggered)

save_as() None

Save current schedule asking for file name.

SLOT() for SIGNAL(menu_save_as.triggered)

property schedule: Schedule | None

The current schedule.

show_info_table(checked: bool) None

Show or hide the info table.

SLOT(bool) for SIGNAL(menu_node_info.triggered) Takes in a boolean and hide or show the info table accordingly with checked.

shrink_scene_to_min_size(rect: QRectF) None

Make scene minimum size.

SLOT(QRectF) for SIGNAL(_scene.sceneRectChanged) Takes in a QRectF (unused) and shrink the scene bounding rectangle to its minimum size, when the bounding rectangle signals a change in geometry.

update_statusbar(msg: str) None

Write msg to the statusbar with temporarily policy.

Parameters:
msgstr

The message to write.

wheelEvent(event) None

Zoom in or out using mouse wheel if control is pressed.

b_asic.scheduler_gui.main_window.start_scheduler(schedule: Schedule) Schedule
b_asic.scheduler_gui.main_window.start_scheduler(schedule: None) Schedule | None
b_asic.scheduler_gui.main_window.start_scheduler() Schedule | None

Start scheduler GUI.

Parameters:
scheduleSchedule, optional

The schedule to start the editor with.

Returns:
Schedule

The edited schedule.

scheduler_gui.axes_item module

B-ASIC Scheduler-gui Axes Item Module.

Contains the scheduler-gui AxesItem class for drawing and maintaining the axes in a graph.

class b_asic.scheduler_gui.axes_item.AxesItem(width: int, height: float, width_indent: float = 0.2, height_indent: float = 0.2, width_padding: float = 0.6, height_padding: float = 0.5, parent: QGraphicsItem | None = None)

Bases: QGraphicsItemGroup

clear() None

Set all children’s parent to None and delete the axes.

property event_items: List[QGraphicsItem]

Return a list of objects that receives events.

property height: float

Get or set the current y-axis height.

Setting the height to a new value will update the axes automatically.

set_height(height: float) None
set_width(width: int) None
property width: int

Get or set the current x-axis width.

Setting the width to a new value will update the axes automatically.

scheduler_gui.operation_item module

B-ASIC Scheduler-GUI Operation Item Module.

Contains the scheduler_gui OperationItem class for drawing and maintain an operation in the schedule.

class b_asic.scheduler_gui.operation_item.OperationItem(operation: Operation, parent: SchedulerItem, height: float = 0.75)

Bases: QGraphicsItemGroup

clear() None

Set all children’s parent to None and delete the axis.

property event_items: List[QGraphicsItem]

List of objects that receives events.

get_port_location(key: str) QPointF

Return the location specified by key.

Parameters:
keystr

The port key.

Returns:
The location as a QPointF.
property graph_id: GraphID

GraphID of the operation that the item corresponds to.

property height: float

Get or set the current component height.

Setting the height to a new value will update the component automatically.

property name: str

Name of the operation that the item corresponds to.

property operation: Operation

The operation that the item corresponds to.

set_active() None

Set the item as active, i.e., draw it in special colors.

set_inactive() None

Set the item as inactive, i.e., draw it in standard colors.

set_port_active(key: str)
set_port_inactive(key: str, warning: bool = False)
set_show_port_numbers(port_number: bool = True)

scheduler_gui.scheduler_event module

B-ASIC Scheduler-GUI Graphics Scheduler Event Module.

Contains the scheduler_ui SchedulerEvent class containing event filters and handlers for SchedulerItem objects.

class b_asic.scheduler_gui.scheduler_event.SchedulerEvent(parent: QGraphicsItem | None = None)

Bases: object

Event filter and handlers for SchedulerItem.

Parameters:
parentQGraphicsItem, optional

The parent QGraphicsItem.

class Signals

Bases: QObject

A class representing signals.

component_moved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

component_selected

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

execution_time_plot

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

redraw_all

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

reopen

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

schedule_time_changed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

change_schedule_time(delta_time: int) None
installSceneEventFilters(filterItems: QGraphicsItem) None
installSceneEventFilters(filterItems: List[QGraphicsItem]) None

Install an event filter for filterItems on ‘self’.

This causes all events for filterItems to first pass through sceneEventFilter(). filterItems can be one object or a list of objects.

is_component_valid_pos(item: OperationItem, pos: float) bool
is_valid_delta_time(delta_time: int) bool
operation_mouseMoveEvent(event: QGraphicsSceneMouseEvent) None

Set the position of the graphical element in the graphic scene.

This translates coordinates of the cursor within the graphic element in the coordinate system of the parent object.

operation_mousePressEvent(event: QGraphicsSceneMouseEvent) None

Change the cursor to ClosedHandCursor or open context menu.

This is used when grabbing an object and stores the current position in item’s parent coordinates. event will by default be accepted, and this item is then the mouse grabber. This allows the item to receive future move, release and double-click events.

operation_mouseReleaseEvent(event: QGraphicsSceneMouseEvent) None

Change the cursor to OpenHandCursor when releasing an object.

removeSceneEventFilters(filterItems: QGraphicsItem) None
removeSceneEventFilters(filterItems: List[QGraphicsItem]) None

Remove an event filter on filterItems from self.

filterItems can be one object or a list of objects.

sceneEventFilter(item: QGraphicsItem, event: QEvent) bool

Return True if the event was filtered (i.e. stopped), otherwise False.

If False is returned, the event is forwarded to the appropriate child in the event chain.

set_item_active(item: OperationItem) None
set_item_inactive(item: OperationItem) None
timeline_mouseMoveEvent(event: QGraphicsSceneMouseEvent) None

Set the position of the graphical element in the graphic scene.

This translates coordinates of the cursor within the graphic element in the coordinate system of the parent object. The object can only move horizontally in x-axis scale steps.

timeline_mousePressEvent(event: QGraphicsSceneMouseEvent) None

Store the current position in item’s parent coordinates.

event will by default be accepted, and this item is then the mouse grabber. This allows the item to receive future move, release and double-click events.

timeline_mouseReleaseEvent(event: QGraphicsSceneMouseEvent) None

Update the schedule time.

scheduler_gui.scheduler_item module

B-ASIC Scheduler-GUI Scheduler Item Module.

Contains the scheduler_gui SchedulerItem class for drawing and maintaining a schedule.

class b_asic.scheduler_gui.scheduler_item.SchedulerItem(schedule: Schedule, warnings: bool = True, show_port_numbers: bool = False, parent: QGraphicsItem | None = None)

Bases: SchedulerEvent, QGraphicsItemGroup

A class to represent a schedule in a QGraphicsScene.

This class is a subclass of QGraphicsItemGroup and contains the objects, axes from AxesItem, as well as components from OperationItem. It also inherits from SchedulerEvent, which acts as a filter for events to OperationItem objects.

Parameters:
scheduleSchedule

The Schedule to draw.

warningsbool, default: True

Whether to draw processes with execution time longer than schedule time in a different color.

show_port_numbersbool, default: False

Whether to show port numbers on the operations.

parentQGraphicsItem, optional

The parent. Passed to the constructor of QGraphicsItemGroup.

property axes: AxesItem | None
change_schedule_time(delta_time: int) None

Change the schedule time by delta_time and redraw the graph.

Parameters:
delta_timeint

The time difference to change the schedule time with.

clear() None

Set all children’s parent to ‘None’ and delete the children objects.

property components: List[OperationItem]
property event_items: List[QGraphicsItem]

Return a list of objects that receives events.

is_component_valid_pos(item: OperationItem, pos: float) bool

Take in a component position and return True if the new position is valid.

Parameters:
itemb_asic.scheduler_gui.operation_item.OperationItem

The component.

posfloat

The x-position to check.

is_valid_delta_time(delta_time: int) bool

Return True if the schedule time can be changed by delta_time.

Parameters:
delta_timeint

The time difference to check for.

property schedule: Schedule

The schedule.

set_item_active(item: OperationItem) None

Set item as active.

This means draw it and connecting signals in special colors.

Parameters:
itemb_asic.scheduler_gui.operation_item.OperationItem

The item to set as active.

set_item_inactive(item: OperationItem) None

Set item as inactive.

This means draw it and connecting signals in standard colors.

Parameters:
itemb_asic.scheduler_gui.operation_item.OperationItem

The item to set as active.

set_new_start_time(item: OperationItem) None

Set new start time for item.

Parameters:
itemb_asic.scheduler_gui.operation_item.OperationItem

The item to set as active.

set_port_numbers(port_numbers: bool = True)

Set if port numbers are shown.

Parameters:
port_numbersbool, default: True

Whether to show port numbers on the operations.

set_warnings(warnings: bool = True)

Set warnings for long execution times.

Parameters:
warningsbool, default: True

Whether to draw processes with execution time longer than schedule time in a different color.

scheduler_gui.signal_item module

B-ASIC Scheduler-GUI Signal Item Module.

Contains the scheduler_gui SignalItem class for drawing and maintaining a signal in the schedule.

class b_asic.scheduler_gui.signal_item.SignalItem(src_operation: OperationItem, dest_operation: OperationItem, signal: Signal, parent: SchedulerItem)

Bases: QGraphicsPathItem

Class representing a signal in the scheduler GUI.

Parameters:
src_operationOperationItem

The operation that the signal is drawn from.

dest_operationOperationItem

The operation that the signal is drawn to.

signalSignal

The signal on the SFG level.

parentQGraphicsItem, optional

The parent QGraphicsItem passed to QGraphicsPathItem.

set_active() None

Set the signal color to represent that a connected operation is selected.

set_inactive() None

Set the signal color to the default color.

update_path() None

Create a new path after moving connected operations.

scheduler_gui.timeline_item module

B-ASIC Scheduler-GUI Timeline Item Module.

Contains the scheduler_gui TimelineItem class for drawing and maintain the timeline in a schedule.

class b_asic.scheduler_gui.timeline_item.TimelineItem(line: QLineF, parent: QGraphicsItem | None = None)
class b_asic.scheduler_gui.timeline_item.TimelineItem(parent: QGraphicsItem | None = None)
class b_asic.scheduler_gui.timeline_item.TimelineItem(x1: float, y1: float, x2: float, y2: float, parent: QGraphicsItem | None = None)

Bases: QGraphicsLineItem

A class to represent the timeline in AxesItem.

property event_items: List[QGraphicsItem]

Return a list of objects that receives events.

hide_label() None

Hide the label.

set_text(number: int) None

Set the label text to number.

Parameters:
numberint

The label number.

set_text_scale(scale: float) None

Set the text scale.

Parameters:
scalefloat

The text scale.

show_label() None

Show the label.

Helper module

scheduler_gui.compile module

B-ASIC Scheduler-gui Resource and Form Compiler Module.

Compile Qt5 resource and form files. Requires PySide2 or PyQt5 to be installed. If no arguments is given, the compiler search for and compiles all form (.ui) files.

b_asic.scheduler_gui.compile.compile_all() None

Compile all .qrc and .ui files.

The compiler will search for resource (.qrc) files and form (.ui) files and compile accordingly.

b_asic.scheduler_gui.compile.compile_rc(*filenames: str) None

Compile resource file(s) given by filenames.

If no arguments are given, the compiler will search for resource (.qrc) files and compile accordingly.

Parameters:
*filenamesstr

One or more file names.

b_asic.scheduler_gui.compile.compile_ui(*filenames: str) None

Compile form file(s) given by filenames.

If no arguments are given, the compiler will search for form (.ui) files and compile accordingly.

Parameters:
*filenamesstr

One or more file names.

b_asic.scheduler_gui.compile.replace_qt_bindings(filename: str) None

Replace qt-binding API in filename from PySide2/6 or PyQt5/6 to qtpy.

Parameters:
filenamestr

The name of the file to replace bindings in.