mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-10-31 08:41:27 +01:00
chore: drop scan base-class filter and require BEC 4.0
This commit is contained in:
1 parent
5fa0807f97
commit
703513b175
3 files changed
+37
-6
No files matched your search
@@ -61,7 +61,6 @@ class ScanControl(BECWidget, QWidget):
|
||||
PLUGIN = True
|
||||
ICON_NAME = "tune"
|
||||
ARG_BOX_POSITION: int = 2
|
||||
SUPPORTED_SCAN_BASE_CLASSES = {"ScanBase", "SyncFlyScanBase", "AsyncFlyScanBase", "ScanBaseV4"}
|
||||
RECENT_SCAN_HISTORY_COUNT = 50
|
||||
MAX_HISTORY_LOOKBACK = 500
|
||||
LAST_SCAN_FETCH_TIMEOUT_MS = 30_000
|
||||
@@ -264,8 +263,7 @@ class ScanControl(BECWidget, QWidget):
|
||||
return [
|
||||
scan_name
|
||||
for scan_name, scan_info in getattr(self, "available_scans", {}).items()
|
||||
if scan_info.get("base_class") in self.SUPPORTED_SCAN_BASE_CLASSES
|
||||
and self._scan_info_adapter.has_scan_ui_config(scan_info)
|
||||
if self._scan_info_adapter.has_scan_ui_config(scan_info)
|
||||
and not scan_name.startswith("_")
|
||||
]
|
||||
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ dependencies = [
|
||||
"PyJWT~=2.9",
|
||||
"PySide6==6.11.1",
|
||||
"PySide6-QtAds==5.0.0",
|
||||
"bec_ipython_client>=3.134", # needed for jupyter console
|
||||
"bec_lib>=3.134",
|
||||
"bec_ipython_client>=4.0", # needed for jupyter console
|
||||
"bec_lib>=4.0",
|
||||
"bec_qthemes~=1.0, >=1.3.7",
|
||||
"black>=26,<27", # needed for bw-generate-cli
|
||||
"copier~=9.7",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
|
||||
from copy import deepcopy
|
||||
from threading import Event, get_ident
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import MagicMock, call, patch
|
||||
@@ -380,6 +381,39 @@ def test_allowed_scans_override_support_filter(scan_control):
|
||||
assert items == ["not_supported_scan_class", "line_scan"]
|
||||
|
||||
|
||||
def test_scan_discovery_and_selection_without_base_class(qtbot, mocked_client):
|
||||
scans = deepcopy(available_scans_message.resource)
|
||||
for scan_info in scans.values():
|
||||
scan_info.pop("base_class", None)
|
||||
scans["_hidden_scan"] = deepcopy(scans["line_scan"])
|
||||
scans["unsupported_input_scan"] = deepcopy(scans["line_scan"])
|
||||
scans["unsupported_input_scan"]["gui_config"]["arg_group"]["inputs"][0]["type"] = {
|
||||
"Generic": {"origin": "list", "args": ["float"]}
|
||||
}
|
||||
mocked_client.connector.set_and_publish(
|
||||
MessageEndpoints.available_scans(), AvailableResourceMessage(resource=scans)
|
||||
)
|
||||
|
||||
widget = ScanControl(client=mocked_client)
|
||||
qtbot.addWidget(widget)
|
||||
|
||||
assert widget.allowed_scans == ["line_scan", "grid_scan"]
|
||||
assert widget.current_scan == "line_scan"
|
||||
assert len(widget.arg_box.widgets) == 3
|
||||
|
||||
widget.comboBox_scan_selection.setCurrentText("grid_scan")
|
||||
|
||||
assert widget.current_scan == "grid_scan"
|
||||
assert len(widget.arg_box.widgets) == 8
|
||||
|
||||
# Explicit filters still override hidden-name and UI support checks and keep order.
|
||||
widget.allowed_scans = ["_hidden_scan", "line_scan", "not_supported_scan_class", "missing"]
|
||||
assert [
|
||||
widget.comboBox_scan_selection.itemText(index)
|
||||
for index in range(widget.comboBox_scan_selection.count())
|
||||
] == ["_hidden_scan", "line_scan", "not_supported_scan_class"]
|
||||
|
||||
|
||||
def test_filter_change_saves_current_scan_parameters(scan_control):
|
||||
assert scan_control.current_scan == "line_scan"
|
||||
|
||||
@@ -579,7 +613,6 @@ def test_scan_selector_settings_properties_are_profile_safe(scan_control):
|
||||
def test_scan_control_uses_gui_visibility_and_signature(qtbot, mocked_client):
|
||||
scan_info = {
|
||||
"class": "AnnotatedScan",
|
||||
"base_class": "ScanBase",
|
||||
"arg_input": {
|
||||
"device": "DeviceBase",
|
||||
"start": {
|
||||
|
||||
Reference in new issue
Block a user