diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5da3c2d78a9017e2f1862a6c8f6cce2630684e9c..3c1b52502551d0dd71afa6d759ad14a43ff0076e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,12 @@ before_script: - apt-get install --yes build-essential cmake libfmt-dev pybind11-dev graphviz python3-pyqt5 xvfb xdg-utils lcov - python -m pip install --upgrade pip - python --version - - pip install pytest pytest-cov sphinx furo numpydoc pytest-xvfb pytest-qt setuptools_scm sphinx-qt-documentation pytest-xdist pytest-mpl + - pip install -r requirements.txt + - pip install -r requirements_doc.txt + - pip install -r requirements_test.txt + - pip install $QT_API + - export PYTEST_QT_API=$QT_API + - export QT_API=$QT_API # - export CXXFLAGS='--coverage' - pip install -ve . # Move file, but should be handled by installation @@ -17,7 +22,7 @@ before_script: .run-test: stage: test script: - - pytest --cov=b_asic --cov-report=xml:cov.xml --cov-report=term --color=yes test --mpl + - pytest --cov=b_asic --cov-report=xml:cov.xml --cov-report=term --color=yes test --mpl --timeout=20 --durations=10 # - lcov --capture --directory . --output-file coverage.info # - lcov --output-file coverage.info --extract coverage.info $PWD/src/'*' $PWD/b_asic/'*' # - lcov --list coverage.info @@ -30,19 +35,60 @@ before_script: coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/ -run-test-3.8: +run-test-3.8-pyside2: + variables: + QT_API: pyside2 image: python:3.8 extends: ".run-test" -run-test-3.9: +run-test-3.8-pyqt5: + variables: + QT_API: pyqt5 + image: python:3.8 + extends: ".run-test" + +run-test-3.9-pyside2: + variables: + QT_API: pyside2 + image: python:3.9 + extends: ".run-test" + +run-test-3.9-pyqt5: + variables: + QT_API: pyqt5 image: python:3.9 extends: ".run-test" -run-test-3.10: +run-test-3.10-pyside2: + variables: + QT_API: pyside2 image: python:3.10 extends: ".run-test" +run-test-3.10-pyqt5: + variables: + QT_API: pyqt5 + image: python:3.10 + extends: ".run-test" + +# Seemingly works with Qt6, but tests stall on closing scheduler GUI due to modal dialog(?) +#run-test-3.10-pyside6: +# variables: +# QT_API: pyside6 +# image: python:3.10 +# extends: ".run-test" +# allow_failure: true +# +#run-test-3.10-pyqt6: +# variables: +# QT_API: pyqt6 +# image: python:3.10 +# extends: ".run-test" +# allow_failure: true + run-doc-test: + variables: + QT_API: pyside2 image: python:3.10 stage: test script: @@ -53,6 +99,8 @@ run-doc-test: # extends: ".run-test" pages: + variables: + QT_API: pyqt5 stage: deploy image: python:3.10 script: diff --git a/b_asic/GUI/drag_button.py b/b_asic/GUI/drag_button.py index a07f0e79b81864b3542e023cebb0379c527ae2df..9652b8a3d56df2ca397215e778bc9791b17380a8 100644 --- a/b_asic/GUI/drag_button.py +++ b/b_asic/GUI/drag_button.py @@ -83,8 +83,9 @@ class DragButton(QPushButton): def mousePressEvent(self, event): if event.button() == Qt.MouseButton.LeftButton: self._m_press = True - self._mouse_press_pos = event.pos() - self._mouse_move_pos = event.pos() + pos = event.pos() + self._mouse_press_pos = pos + self._mouse_move_pos = pos super().mousePressEvent(event) diff --git a/b_asic/GUI/main_window.py b/b_asic/GUI/main_window.py index 0a9cc98258b9d6304ea0a4e3d5837921c32782d5..942bcd5b2eab169464158a91c828ebcd2da4fdec 100644 --- a/b_asic/GUI/main_window.py +++ b/b_asic/GUI/main_window.py @@ -16,6 +16,7 @@ from qtpy.QtWidgets import ( QAction, QApplication, QFileDialog, + QGraphicsItem, QGraphicsScene, QGraphicsTextItem, QGraphicsView, @@ -527,7 +528,7 @@ class MainWindow(QMainWindow): attr_button_scene.moveBy( int(self.scene.width() / 4), int(self.scene.height() / 4) ) - attr_button_scene.setFlag(attr_button_scene.ItemIsSelectable, True) + attr_button_scene.setFlag(QGraphicsItem.ItemIsSelectable, True) operation_label = QGraphicsTextItem(op.name, attr_button_scene) if not self.is_show_names: operation_label.setOpacity(0) diff --git a/b_asic/scheduler_gui/axes_item.py b/b_asic/scheduler_gui/axes_item.py index 39bb40a034e42a2f0bfcd36f2648d4f3768c705b..adea4568f3cecae757f6ca2d20eb173198653b20 100644 --- a/b_asic/scheduler_gui/axes_item.py +++ b/b_asic/scheduler_gui/axes_item.py @@ -9,7 +9,7 @@ from math import pi, sin from typing import List, Optional, Union # QGraphics and QPainter imports -from qtpy.QtCore import QPoint, QPointF, Qt +from qtpy.QtCore import QPointF, Qt from qtpy.QtGui import QBrush, QPen, QPolygonF from qtpy.QtWidgets import ( QGraphicsItem, @@ -318,7 +318,7 @@ class AxesItem(QGraphicsItemGroup): self._append_x_tick() pos = self._x_ledger[-1].pos() self._x_ledger[-1].setPos( - pos + QPoint(self._width, 0) + pos + QPointF(self._width, 0) ) # move timeline # y-axis diff --git a/b_asic/scheduler_gui/main_window.ui b/b_asic/scheduler_gui/main_window.ui index ca6fcd2c851ef5d8f8777156c6e38ecd5b2fbc7e..38ac4579de59f9a08b50802562500aab0b5a8d4a 100644 --- a/b_asic/scheduler_gui/main_window.ui +++ b/b_asic/scheduler_gui/main_window.ui @@ -57,7 +57,7 @@ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> </property> <property name="renderHints"> - <set>QPainter::HighQualityAntialiasing|QPainter::TextAntialiasing</set> + <set>QPainter::Antialiasing|QPainter::TextAntialiasing</set> </property> <property name="viewportUpdateMode"> <enum>QGraphicsView::FullViewportUpdate</enum> @@ -126,7 +126,6 @@ </property> <property name="font"> <font> - <weight>75</weight> <bold>true</bold> </font> </property> @@ -158,7 +157,6 @@ </property> <property name="font"> <font> - <weight>75</weight> <bold>true</bold> </font> </property> diff --git a/b_asic/scheduler_gui/ui_main_window.py b/b_asic/scheduler_gui/ui_main_window.py index f197afcdaf82b2c4cd17bfbe4d09fbfdc68da4f8..3364516c1306edb1c3cb1d0c4405d015c11f0f06 100644 --- a/b_asic/scheduler_gui/ui_main_window.py +++ b/b_asic/scheduler_gui/ui_main_window.py @@ -55,8 +55,7 @@ class Ui_MainWindow(object): QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop ) self.view.setRenderHints( - QtGui.QPainter.HighQualityAntialiasing - | QtGui.QPainter.TextAntialiasing + QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing ) self.view.setViewportUpdateMode( QtWidgets.QGraphicsView.FullViewportUpdate @@ -89,7 +88,6 @@ class Ui_MainWindow(object): item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setBold(True) - font.setWeight(75) item.setFont(font) brush = QtGui.QBrush(QtGui.QColor(160, 160, 164)) brush.setStyle(QtCore.Qt.SolidPattern) @@ -108,7 +106,6 @@ class Ui_MainWindow(object): item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setBold(True) - font.setWeight(75) item.setFont(font) brush = QtGui.QBrush(QtGui.QColor(160, 160, 164)) brush.setStyle(QtCore.Qt.SolidPattern) diff --git a/pyproject.toml b/pyproject.toml index 32b7026b95ee88bf1b6bc6c47a2fe68b2b4e2773..261237dc8fb5fe3154dc13db82fc6a0c824156ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ requires-python = ">=3.8" dependencies = [ "numpy", "pybind11>=2.3.0", - "pyside2", + # "pyside2", "qtpy", "graphviz>=0.19", "matplotlib", @@ -22,7 +22,7 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", +# "Programming Language :: Python :: 3.11", "Programming Language :: C++", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", @@ -56,7 +56,7 @@ skip-string-normalization = true preview = true line-length = 79 exclude = [ - "test/test_gui" + "test/test_gui", "b_asic/scheduler_gui/ui_main_window.py" ] [tool.isort] @@ -64,7 +64,7 @@ profile = "black" line_length = 79 src_paths = ["b_asic", "test"] skip = [ - "test/test_gui" + "test/test_gui", "b_asic/scheduler_gui/ui_main_window.py" ] diff --git a/requirements.txt b/requirements.txt index cba8d8860740c8cc71720b2c8640c6b4d47ca4e2..795bffa62efb30943cc75423f7d9a9d7efe047a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,7 @@ -setuptools_scm +setuptools_scm[toml]>=6.2 +numpy +pybind11>=2.3.0 +# pyside2 +qtpy +graphviz>=0.19 +matplotlib diff --git a/requirements_test.txt b/requirements_test.txt index 64543e503881b8b3e3d227bc2af1c259e8403256..bd51fe8943cd07d3c7e8f7b1cc98a0597d55fec0 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -2,5 +2,6 @@ pytest pytest-cov pytest-qt pytest-mpl +pytest-timeout pytest-xvfb pytest-xdist