Scheduler GUI¶
Module contents¶
B-ASIC Scheduler-gui Module.
Graphical user interface for B-ASIC scheduler.
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.
- 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_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.
- Parameters:
- graph_idGraphID
GraphID of operation to fill information table with.
- 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.
- load_preferences()¶
Load the last saved preferences from settings.
- open_preferences_dialog()¶
Open the preferences dialog to customize fonts, colors, and settings.
- save_as() None ¶
Save current schedule asking for file name.
SLOT() for SIGNAL(menu_save_as.triggered)
- 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.
- 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
- 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 height of y-axis.
- Parameters:
- heightfloat >= 0
New height of y-axis.
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
- 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.
scheduler_gui.preferences_dialog module¶
- class b_asic.scheduler_gui.preferences_dialog.PreferencesDialog(parent)¶
Bases:
QWidget
- bold_font_clicked()¶
Toggle the font style to bold if not already bold, otherwise unbold.
- color_button_clicked(color_type: ColorDataType) None ¶
Open a color dialog to select a color based on the specified color type.
- Parameters:
- color_typeColorDataType
The ColorDataType to be changed.
- create_color_button(color: ColorDataType) ColorButton ¶
Create a colored button to be used to modify a certain color.
- Parameters:
- colorColorDataType
The ColorDataType assigned to the butten to be created.
- font_color_clicked()¶
Select a font color and update preferences.
- italic_font_clicked()¶
Toggle the font style to italic if not already italic, otherwise remove italic.
- reset_all_clicked()¶
Reset both the color and the font settings.
- reset_color_clicked()¶
Reset the color settings.
- reset_font_clicked()¶
Reset the font settings.
- set_font_size_clicked()¶
Set the font size to the specified size and update the font.
- set_latency_color_by_type_name(modify_all: bool) None ¶
Set latency color based on operation type names.
- Parameters:
- modify_allbool
Indicates if the color of all type names to be modified.
- update_font()¶
Update font preferences based on current Font settings.
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.
- TextSignal¶
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_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.
- total_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.
- 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 ¶
- 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.
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:
- schedule
Schedule
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.
- schedule
- 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.
- property components: list[OperationItem]¶
- is_component_valid_pos(item: OperationItem, pos: float) bool ¶
Take in a component position and return True if the new position is valid.
- Parameters:
- item
b_asic.scheduler_gui.operation_item.OperationItem
The component.
- posfloat
The x-position to check.
- item
- 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.
- set_item_active(item: OperationItem) None ¶
Set item as active.
This means draw it and connecting signals in special colors.
- Parameters:
- item
b_asic.scheduler_gui.operation_item.OperationItem
The item to set as active.
- item
- set_item_inactive(item: OperationItem) None ¶
Set item as inactive.
This means draw it and connecting signals in standard colors.
- Parameters:
- item
b_asic.scheduler_gui.operation_item.OperationItem
The item to set as active.
- item
- set_new_start_time(item: OperationItem) None ¶
Set new start time for item.
- Parameters:
- item
b_asic.scheduler_gui.operation_item.OperationItem
The item to set as active.
- item
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_operation
OperationItem
The operation that the signal is drawn from.
- dest_operation
OperationItem
The operation that the signal is drawn to.
- signal
Signal
The signal on the SFG level.
- parentQGraphicsItem, optional
The parent QGraphicsItem passed to QGraphicsPathItem.
- src_operation
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.
Helper module¶
scheduler_gui.compile module¶
B-ASIC Scheduler-gui Resource and Form Compiler Module.
Compile Qt6 resource and form files. Requires PySide6 or PyQt6 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.