mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
refactor: migration to qtpy
This commit is contained in:
@ -2,7 +2,7 @@ import os
|
||||
import yaml
|
||||
|
||||
import pytest
|
||||
from PyQt5.QtWidgets import QTabWidget, QTableWidgetItem
|
||||
from qtpy.QtWidgets import QTabWidget, QTableWidgetItem
|
||||
|
||||
from bec_widgets.widgets import ConfigDialog
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import numpy as np
|
||||
import pyqtgraph as pg
|
||||
from PyQt5.QtCore import QPointF
|
||||
from qtpy.QtCore import QPointF
|
||||
|
||||
from bec_widgets.qt_utils import Crosshair
|
||||
|
||||
|
@ -3,7 +3,7 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pyqtgraph as pg
|
||||
import pytest
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from qtpy.QtWidgets import QMessageBox
|
||||
|
||||
from bec_widgets.examples.extreme.extreme import PlotApp, ErrorHandler
|
||||
|
||||
|
@ -4,7 +4,7 @@ from unittest.mock import MagicMock
|
||||
|
||||
import msgpack
|
||||
import pytest
|
||||
from PyQt5.QtWidgets import QLineEdit
|
||||
from qtpy.QtWidgets import QLineEdit
|
||||
|
||||
from bec_widgets.widgets import ScanControl
|
||||
from bec_widgets.qt_utils.widget_io import WidgetIO
|
||||
|
@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
from PyQt5.QtWidgets import (
|
||||
from qtpy.QtWidgets import (
|
||||
QWidget,
|
||||
QVBoxLayout,
|
||||
QLineEdit,
|
||||
|
@ -3,7 +3,7 @@ import tempfile
|
||||
from unittest.mock import patch
|
||||
import pytest
|
||||
import yaml
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
||||
from qtpy.QtWidgets import QWidget, QVBoxLayout, QPushButton
|
||||
|
||||
from bec_widgets.qt_utils.yaml_dialog import load_yaml, save_yaml
|
||||
|
||||
@ -38,7 +38,7 @@ def test_load_yaml(qtbot, example_widget):
|
||||
example_widget.import_button.clicked.connect(load_yaml_wrapper)
|
||||
|
||||
# Mock user selecting the file in the dialog
|
||||
with patch("PyQt5.QtWidgets.QFileDialog.getOpenFileName", return_value=(temp_file.name, "")):
|
||||
with patch("qtpy.QtWidgets.QFileDialog.getOpenFileName", return_value=(temp_file.name, "")):
|
||||
example_widget.import_button.click()
|
||||
|
||||
assert example_widget.config == {"name": "test", "value": 42}
|
||||
@ -59,7 +59,7 @@ def test_save_yaml(qtbot, example_widget):
|
||||
example_widget.export_button.clicked.connect(save_yaml_wrapper)
|
||||
|
||||
# Mock user selecting the file in the dialog
|
||||
with patch("PyQt5.QtWidgets.QFileDialog.getSaveFileName", return_value=(temp_file_path, "")):
|
||||
with patch("qtpy.QtWidgets.QFileDialog.getSaveFileName", return_value=(temp_file_path, "")):
|
||||
example_widget.export_button.click()
|
||||
|
||||
# Check if the data was saved correctly
|
||||
|
Reference in New Issue
Block a user