From 4b0e1c0fe64e53ee6f3048858f15f78f1efa606d Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson <oscar.gustafsson@gmail.com> Date: Fri, 2 Sep 2022 17:28:05 +0200 Subject: [PATCH] Fix imports and start test of scheduler GUI --- b_asic/scheduler_gui/graphics_axes_item.py | 2 +- b_asic/scheduler_gui/graphics_graph_event.py | 6 +++--- b_asic/scheduler_gui/graphics_graph_item.py | 8 ++++---- b_asic/scheduler_gui/graphics_signal.py | 2 +- b_asic/scheduler_gui/main_window.py | 6 +++--- test/test_scheduler_gui.py | 13 +++++++++++++ 6 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 test/test_scheduler_gui.py diff --git a/b_asic/scheduler_gui/graphics_axes_item.py b/b_asic/scheduler_gui/graphics_axes_item.py index eb534745..8b1e47e5 100644 --- a/b_asic/scheduler_gui/graphics_axes_item.py +++ b/b_asic/scheduler_gui/graphics_axes_item.py @@ -16,7 +16,7 @@ from qtpy.QtWidgets import ( QGraphicsSimpleTextItem, QGraphicsPolygonItem) # B-ASIC -from graphics_timeline_item import GraphicsTimelineItem +from b_asic.scheduler_gui.graphics_timeline_item import GraphicsTimelineItem diff --git a/b_asic/scheduler_gui/graphics_graph_event.py b/b_asic/scheduler_gui/graphics_graph_event.py index b3ee0ef1..cfbaf05b 100644 --- a/b_asic/scheduler_gui/graphics_graph_event.py +++ b/b_asic/scheduler_gui/graphics_graph_event.py @@ -14,9 +14,9 @@ from qtpy.QtWidgets import ( QGraphicsItem, QGraphicsSceneMouseEvent, QGraphicsSceneHoverEvent, QGraphicsSceneContextMenuEvent, QGraphicsSceneDragDropEvent, QGraphicsSceneWheelEvent) -from graphics_component_item import GraphicsComponentItem -from graphics_axes_item import GraphicsAxesItem -from graphics_timeline_item import GraphicsTimelineItem +from b_asic.scheduler_gui.graphics_component_item import GraphicsComponentItem +from b_asic.scheduler_gui.graphics_axes_item import GraphicsAxesItem +from b_asic.scheduler_gui.graphics_timeline_item import GraphicsTimelineItem diff --git a/b_asic/scheduler_gui/graphics_graph_item.py b/b_asic/scheduler_gui/graphics_graph_item.py index bb072dd6..0ee861bb 100644 --- a/b_asic/scheduler_gui/graphics_graph_item.py +++ b/b_asic/scheduler_gui/graphics_graph_item.py @@ -17,10 +17,10 @@ from qtpy.QtCore import Qt # B-ASIC from b_asic.schedule import Schedule -from graphics_component_item import GraphicsComponentItem -from graphics_axes_item import GraphicsAxesItem -from graphics_graph_event import GraphicsGraphEvent -from graphics_signal import GraphicsSignal +from b_asic.scheduler_gui.graphics_component_item import GraphicsComponentItem +from b_asic.scheduler_gui.graphics_axes_item import GraphicsAxesItem +from b_asic.scheduler_gui.graphics_graph_event import GraphicsGraphEvent +from b_asic.scheduler_gui.graphics_signal import GraphicsSignal class GraphicsGraphItem(GraphicsGraphEvent, QGraphicsItemGroup): # PySide2 / PyQt5 diff --git a/b_asic/scheduler_gui/graphics_signal.py b/b_asic/scheduler_gui/graphics_signal.py index ac44f0fb..9326729f 100644 --- a/b_asic/scheduler_gui/graphics_signal.py +++ b/b_asic/scheduler_gui/graphics_signal.py @@ -6,7 +6,7 @@ from qtpy.QtCore import Qt, QPointF # B-ASIC from b_asic.signal import Signal -from graphics_component_item import GraphicsComponentItem +from b_asic.scheduler_gui.graphics_component_item import GraphicsComponentItem class GraphicsSignal(QGraphicsPathItem): _path: Optional[QPainterPath] = None diff --git a/b_asic/scheduler_gui/main_window.py b/b_asic/scheduler_gui/main_window.py index 69959a4f..328305bc 100644 --- a/b_asic/scheduler_gui/main_window.py +++ b/b_asic/scheduler_gui/main_window.py @@ -30,9 +30,9 @@ from qtpy.QtWidgets import QGraphicsScene, QGraphicsItemGroup import logger from b_asic.schedule import Schedule from b_asic.graph_component import GraphComponent -from graphics_graph_item import GraphicsGraphItem -from graphics_axes_item import GraphicsAxesItem -from graphics_component_item import GraphicsComponentItem +from b_asic.scheduler_gui.graphics_graph_item import GraphicsGraphItem +from b_asic.scheduler_gui.graphics_axes_item import GraphicsAxesItem +from b_asic.scheduler_gui.graphics_component_item import GraphicsComponentItem # if sys.version_info >= (3, 9): # List = list diff --git a/test/test_scheduler_gui.py b/test/test_scheduler_gui.py new file mode 100644 index 00000000..0085fc7f --- /dev/null +++ b/test/test_scheduler_gui.py @@ -0,0 +1,13 @@ +import pytest + +try: + import b_asic.scheduler_gui.main_window as GUI +except ImportError: + pytestmark = pytest.mark.skip('Qt not setup') + + +def test_start(qtbot): + widget = GUI.MainWindow() + qtbot.addWidget(widget) + + widget.exit_app() -- GitLab