Skip to content

Commit c0dbd7a

Browse files
committed
wip refactor 1
1 parent cc6ed22 commit c0dbd7a

2 files changed

Lines changed: 6 additions & 18 deletions

File tree

bec_widgets/widgets/progress/progress_backend.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,6 @@ def on_queue_update(self, msg_content: dict, metadata: dict):
282282
self.scan_number = active_request_block.scan_number
283283
self.source_changed.emit(self.current_snapshot(value=0, max_value=100, done=False))
284284

285-
report_instructions = active_request_block.report_instructions
286-
if not report_instructions:
287-
return
288-
289-
instruction = report_instructions[0]
290-
if "scan_progress" in instruction:
291-
self.set_progress_source(ProgressSource.SCAN_PROGRESS)
292-
elif "device_progress" in instruction:
293-
if not instruction["device_progress"]:
294-
return
295-
self.set_progress_source(
296-
ProgressSource.DEVICE_PROGRESS, device=instruction["device_progress"][0]
297-
)
298-
299285
def _extract_active_queue_info(self, msg_content: dict):
300286
if "queue" not in msg_content:
301287
return None

tests/unit_tests/test_scan_progress_bar.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,11 @@ def queue_msg(scan_id: str, scan_number: int):
542542
assert scan_progressbar._active_scan_id == "scan-2"
543543

544544

545-
def test_progressbar_queue_update_with_device(scan_progressbar, scan_message):
545+
def test_progressbar_queue_update_with_device_progress_uses_scan_progress(
546+
scan_progressbar, scan_message
547+
):
546548
"""
547-
Test that a queue update with a device changes the progress source to DEVICE_PROGRESS.
549+
Device-backed scan progress is normalized by scan_bundler and emitted as scan_progress.
548550
"""
549551
request_block = messages.RequestBlock(
550552
msg=scan_message,
@@ -580,8 +582,8 @@ def test_progressbar_queue_update_with_device(scan_progressbar, scan_message):
580582
msg.content, msg.metadata, _override_slot_params={"verify_sender": False}
581583
)
582584

583-
assert scan_progressbar._progress_source == ProgressSource.DEVICE_PROGRESS
584-
assert scan_progressbar._progress_device == "samx"
585+
assert scan_progressbar._progress_source == ProgressSource.SCAN_PROGRESS
586+
assert scan_progressbar._progress_device is None
585587
assert scan_progressbar.task is not None
586588
assert scan_progressbar.scan_number == 1
587589

0 commit comments

Comments
 (0)