feat(scan_status_item): double-click on the scan pill docks the scan queue

This commit is contained in:
wyzula_j authored and Jan Wyzula committed 2026-11-24 10:52:16 +01:00
1 parent ed679df799
commit 2661cdca3f
4 files changed
+15 -11

No files matched your search

@@ -170,7 +170,8 @@ class ScanStatusItem(StatusPillItem):
and saved per user.
"""
DOCK_WIDGET = "ScanProgressBar"
DOCK_WIDGET = "BECQueue" # the running scan and the waiting ones
DOCK_HINT = "Double-click to add the scan queue to the current dock area"
def __init__(
self,
@@ -215,7 +215,8 @@ class BECMainWindow(BECWidget, QMainWindow):
################################################################################
# Progress‑bar helpers
def _add_scan_progress_bar(self):
# Scan pill: live progress, Stop and the waiting count; the full ScanProgressBar on hover
# Scan pill: progress, Stop, waiting count; a click shows the ScanProgressBar, a double-click
# docks the queue
self._scan_status_item = ScanStatusItem(
self, rpc_exposed=False, rpc_passthrough_children=False
)
+4 -4
View File
@@ -404,7 +404,7 @@ def test_guided_tour_can_start_and_stop(app_with_spies, qtbot):
def test_status_pill_opens_its_widget_in_the_dock_area_view(
qtbot, mocked_client, monkeypatch, tmp_path
):
from bec_widgets.widgets.progress.scan_progressbar.scan_progressbar import ScanProgressBar
from bec_widgets.widgets.services.bec_queue.bec_queue import BECQueue
monkeypatch.setenv("BECWIDGETS_PROFILE_DIR", str(tmp_path))
app = create_widget(qtbot, BECMainApp, client=mocked_client)
@@ -415,10 +415,10 @@ def test_status_pill_opens_its_widget_in_the_dock_area_view(
assert not item.card.hint.isHidden()
switched = []
monkeypatch.setattr(app, "set_current", lambda view_id: switched.append(view_id))
before = [w for w in dock_area.widget_list() if isinstance(w, ScanProgressBar)]
before = [w for w in dock_area.widget_list() if isinstance(w, BECQueue)]
qtbot.mouseDClick(item.pill, Qt.MouseButton.LeftButton)
after = [w for w in dock_area.widget_list() if isinstance(w, ScanProgressBar)]
after = [w for w in dock_area.widget_list() if isinstance(w, BECQueue)]
assert len(after) == len(before) + 1
assert switched == ["dock_area"]
qtbot.mouseDClick(item.pill, Qt.MouseButton.LeftButton)
assert [w for w in dock_area.widget_list() if isinstance(w, ScanProgressBar)] == after
assert [w for w in dock_area.widget_list() if isinstance(w, BECQueue)] == after
+7 -5
View File
@@ -404,21 +404,23 @@ def test_status_bar_holds_several_pills_each_with_its_own_fill(bec_main_window,
def test_open_in_dock_area_adds_one_dock_then_raises_it(bec_main_window, qtbot):
from bec_widgets.widgets.containers.dock_area.dock_area import BECDockArea
from bec_widgets.widgets.progress.scan_progressbar.scan_progressbar import ScanProgressBar
from bec_widgets.widgets.services.bec_queue.bec_queue import BECQueue
item = bec_main_window._scan_status_item
assert item.DOCK_WIDGET == "ScanProgressBar"
assert item.DOCK_WIDGET == "BECQueue" # the scan pill docks the queue
item._prepare_card()
assert item.card.hint.isHidden() # no dock area as central widget yet
assert bec_main_window.open_in_dock_area("ScanProgressBar") is None
assert bec_main_window.open_in_dock_area("BECQueue") is None
dock_area = BECDockArea(parent=bec_main_window, client=bec_main_window.client)
bec_main_window.setCentralWidget(dock_area)
item._prepare_card()
assert not item.card.hint.isHidden()
assert item.card.hint.text() == "Double-click to add the scan queue to the current dock area"
assert item.pill.toolTip().endswith(item.card.hint.text())
def docked():
return [w for w in dock_area.widget_list() if isinstance(w, ScanProgressBar)]
return [w for w in dock_area.widget_list() if isinstance(w, BECQueue)]
with qtbot.waitSignal(item.dock_requested):
qtbot.mouseDClick(item.pill, Qt.MouseButton.LeftButton)
@@ -427,4 +429,4 @@ def test_open_in_dock_area_adds_one_dock_then_raises_it(bec_main_window, qtbot):
# a second double-click raises the docked one instead of adding another
qtbot.mouseDClick(item.pill, Qt.MouseButton.LeftButton)
assert len(docked()) == 1
assert bec_main_window.open_in_dock_area("ScanProgressBar") is first
assert bec_main_window.open_in_dock_area("BECQueue") is first