From a5eed061aa0cb5af4970b42be44fb0690d0ac3e1 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson <oscar.gustafsson@gmail.com> Date: Tue, 7 Feb 2023 11:08:35 +0100 Subject: [PATCH] Fix line length and module init --- b_asic/GUI/__init__.py | 14 +++----------- b_asic/scheduler_gui/__init__.py | 15 ++++----------- b_asic/scheduler_gui/logger.py | 19 +++++++++++++------ b_asic/scheduler_gui/main_window.py | 3 ++- b_asic/scheduler_gui/operation_item.py | 9 ++++++--- b_asic/scheduler_gui/scheduler_event.py | 12 +++++++----- b_asic/scheduler_gui/scheduler_item.py | 9 ++++++--- 7 files changed, 41 insertions(+), 40 deletions(-) diff --git a/b_asic/GUI/__init__.py b/b_asic/GUI/__init__.py index cabf3d0d..d4303b0f 100644 --- a/b_asic/GUI/__init__.py +++ b/b_asic/GUI/__init__.py @@ -2,14 +2,6 @@ Graphical user interface for B-ASIC. """ -from b_asic.GUI.about_window import * -from b_asic.GUI.arrow import * -from b_asic.GUI.drag_button import * -from b_asic.GUI.gui_interface import * -from b_asic.GUI.main_window import * -from b_asic.GUI.port_button import * -from b_asic.GUI.properties_window import * -from b_asic.GUI.select_sfg_window import * -from b_asic.GUI.show_pc_window import * -from b_asic.GUI.simulate_sfg_window import * -from b_asic.GUI.utils import * +from b_asic.GUI.main_window import MainWindow, start_gui + +__all__ = ['MainWindow', 'start_gui'] diff --git a/b_asic/scheduler_gui/__init__.py b/b_asic/scheduler_gui/__init__.py index 9aa32805..60f4de4c 100644 --- a/b_asic/scheduler_gui/__init__.py +++ b/b_asic/scheduler_gui/__init__.py @@ -1,15 +1,8 @@ -"""B-ASIC Scheduler-gui Module. +""" +B-ASIC Scheduler-gui Module. Graphical user interface for B-ASIC scheduler. """ +from b_asic.scheduler_gui.main_window import MainWindow, start_gui -__author__ = "Andreas Bolin" -# __all__ = ['main_window', 'graphics_graph', 'component_item', 'graphics_axes', 'graphics_timeline_item'] -from b_asic.scheduler_gui.axes_item import * -from b_asic.scheduler_gui.logger import * -from b_asic.scheduler_gui.main_window import * -from b_asic.scheduler_gui.operation_item import * -from b_asic.scheduler_gui.scheduler_event import * -from b_asic.scheduler_gui.scheduler_item import * -from b_asic.scheduler_gui.signal_item import * -from b_asic.scheduler_gui.timeline_item import * +__all__ = ['MainWindow', 'start_gui'] diff --git a/b_asic/scheduler_gui/logger.py b/b_asic/scheduler_gui/logger.py index c85792a4..1746ae6c 100644 --- a/b_asic/scheduler_gui/logger.py +++ b/b_asic/scheduler_gui/logger.py @@ -58,14 +58,21 @@ from typing import Type, Union def getLogger( filename: str = "scheduler-gui.log", loglevel: str = "INFO" ) -> Logger: - """This function creates console- and filehandler and from those, creates a logger object. + """ + This function creates console- and filehandler and from those, creates a logger + object. + + Parameters + ========== - Args: - filename (str, optional): Output filename. Defaults to 'scheduler-gui.log'. - loglevel (str, optional): The minimum level that the logger will log. Defaults to 'INFO'. + filename : str optional + Output filename. Defaults to 'scheduler-gui.log'. + loglevel : str, optional + The minimum level that the logger will log. Defaults to 'INFO'. - Returns: - Logger: 'logging.Logger' object. + Returns + ======= + Logger : 'logging.Logger' object. """ # logger = logging.getLogger(name) diff --git a/b_asic/scheduler_gui/main_window.py b/b_asic/scheduler_gui/main_window.py index 3e7457c9..ed8fca68 100644 --- a/b_asic/scheduler_gui/main_window.py +++ b/b_asic/scheduler_gui/main_window.py @@ -346,7 +346,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): Takes in a boolean and hide or show the info table accordingly with 'checked'. """ - # Note: splitter handler index 0 is a hidden splitter handle far most left, use index 1 + # Note: splitter handler index 0 is a hidden splitter handle far most left, + # use index 1 # settings = QSettings() _, max_ = self.splitter.getRange(1) # tuple(min, max) diff --git a/b_asic/scheduler_gui/operation_item.py b/b_asic/scheduler_gui/operation_item.py index f728fe37..5fc8cb22 100644 --- a/b_asic/scheduler_gui/operation_item.py +++ b/b_asic/scheduler_gui/operation_item.py @@ -3,7 +3,8 @@ """ B-ASIC Scheduler-gui Graphics Component Item Module. -Contains the scheduler-gui OperationItem class for drawing and maintain a component in a graph. +Contains the scheduler-gui OperationItem class for drawing and maintain a component +in a graph. """ from typing import Dict, List, Optional, Union @@ -60,7 +61,8 @@ class OperationItem(QGraphicsItemGroup): parent: Optional[QGraphicsItem] = None, ): """ - Construct a OperationItem. *parent* is passed to QGraphicsItemGroup's constructor. + Construct a OperationItem. *parent* is passed to QGraphicsItemGroup's + constructor. """ super().__init__(parent=parent) self._operation = operation @@ -167,7 +169,8 @@ class OperationItem(QGraphicsItemGroup): Qt.GlobalColor.black ) # used by component outline latency_outline_pen.setWidthF(2 / self._scale) - # latency_outline_pen.setCapStyle(Qt.RoundCap) # Qt.FlatCap, Qt.SquareCap (default), Qt.RoundCap + # latency_outline_pen.setCapStyle(Qt.RoundCap) + # Qt.FlatCap, Qt.SquareCap (default), Qt.RoundCap latency_outline_pen.setJoinStyle( Qt.RoundJoin ) # Qt.MiterJoin, Qt.BevelJoin (default), Qt.RoundJoin, Qt.SvgMiterJoin diff --git a/b_asic/scheduler_gui/scheduler_event.py b/b_asic/scheduler_gui/scheduler_event.py index ea5131ee..36b99f5f 100644 --- a/b_asic/scheduler_gui/scheduler_event.py +++ b/b_asic/scheduler_gui/scheduler_event.py @@ -3,7 +3,8 @@ """ B-ASIC Scheduler-gui Graphics Graph Event Module. -Contains the scheduler-gui SchedulerEvent class containing event filters and handlers for SchedulerItem objects. +Contains the scheduler-gui SchedulerEvent class containing event filters and +handlers for SchedulerItem objects. """ from typing import List, Optional, overload @@ -121,18 +122,19 @@ class SchedulerEvent: # PyQt5 if isinstance(item, OperationItem): # one component switch = { # QEvent.FocusIn: self.operation_focusInEvent, - # QEvent.GraphicsSceneContextMenu: self.operation_contextMenuEvent, + # QEvent.GraphicsSceneContextMenu: self.operation_contextMenuEvent, # QEvent.GraphicsSceneDragEnter: self.operation_dragEnterEvent, # QEvent.GraphicsSceneDragMove: self.operation_dragMoveEvent, # QEvent.GraphicsSceneDragLeave: self.operation_dragLeaveEvent, # QEvent.GraphicsSceneDrop: self.operation_dropEvent, - # QEvent.GraphicsSceneHoverEnter: self.operation_hoverEnterEvent, + # QEvent.GraphicsSceneHoverEnter: self.operation_hoverEnterEvent, # QEvent.GraphicsSceneHoverMove: self.operation_hoverMoveEvent, - # QEvent.GraphicsSceneHoverLeave: self.operation_hoverLeaveEvent, + # QEvent.GraphicsSceneHoverLeave: self.operation_hoverLeaveEvent, QEvent.GraphicsSceneMouseMove: self.operation_mouseMoveEvent, QEvent.GraphicsSceneMousePress: self.operation_mousePressEvent, QEvent.GraphicsSceneMouseRelease: self.operation_mouseReleaseEvent, - # QEvent.GraphicsSceneMouseDoubleClick: self.operation_mouseDoubleClickEvent, + # QEvent.GraphicsSceneMouseDoubleClick: + # self.operation_mouseDoubleClickEvent, # QEvent.GraphicsSceneWheel: self.operation_wheelEvent } handler = switch.get(event.type()) diff --git a/b_asic/scheduler_gui/scheduler_item.py b/b_asic/scheduler_gui/scheduler_item.py index 5ff8fa10..78f41f68 100644 --- a/b_asic/scheduler_gui/scheduler_item.py +++ b/b_asic/scheduler_gui/scheduler_item.py @@ -57,7 +57,8 @@ class SchedulerItem(SchedulerEvent, QGraphicsItemGroup): # PySide2 / PyQt5 self, schedule: Schedule, parent: Optional[QGraphicsItem] = None ): """ - Construct a SchedulerItem. *parent* is passed to QGraphicsItemGroup's constructor. + Construct a SchedulerItem. *parent* is passed to QGraphicsItemGroup's + constructor. """ # QGraphicsItemGroup.__init__(self, self) # SchedulerEvent.__init__(self) @@ -151,7 +152,8 @@ class SchedulerItem(SchedulerEvent, QGraphicsItemGroup): # PySide2 / PyQt5 def set_item_inactive(self, item: OperationItem) -> None: """ - Set an item as inactive, i.e., draw it and connecting signals in standard colors. + Set an item as inactive, i.e., draw it and connecting signals in standard + colors. Parameters ---------- @@ -174,7 +176,8 @@ class SchedulerItem(SchedulerEvent, QGraphicsItemGroup): # PySide2 / PyQt5 def is_valid_delta_time(self, delta_time: int) -> bool: """ - Takes in a delta time and returns True if the schedule time can be changed by *delta_time*. False otherwise. + Takes in a delta time and returns True if the schedule time can be changed by + *delta_time*. False otherwise. """ # TODO: implement # item = self.scene().mouseGrabberItem() -- GitLab