Skip to content

Commit

Permalink
Fixed a bug that didn't disable snake axes checkbox during __init__ i…
Browse files Browse the repository at this point in the history
…n grid scan window.
  • Loading branch information
yannachen committed Jul 2, 2024
1 parent 13de054 commit 8ee72f1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/firefly/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ def setup_window_actions(self):
WindowClass=PlanMainWindow,
),
}
# Disabled the grid scan window until this issue is fixed
# https://github.com/spc-group/haven/issues/231
self.actions.plans['grid_scan'].setEnabled(False)
# Action for showing the run browser window
self.actions.run_browser = WindowAction(
name="show_run_browser_action",
Expand Down
14 changes: 12 additions & 2 deletions src/firefly/plans/grid_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def __init__(self, parent=None, args=None, macros=None, ui_filename=None, **kwar

def customize_ui(self):
super().customize_ui()
self.update_snakes()
# add title layout
self.title_region = TitleRegion()
self.ui.title_layout.addLayout(self.title_region.layout)
Expand All @@ -112,7 +113,15 @@ async def update_devices_slot(self, registry):
@asyncSlot(int)
async def update_regions_slot(self, new_region_num: int):
await super().update_regions(new_region_num)
# disable snake for the last region and enable the previous regions
self.update_snakes()

def update_snakes(self):
"""Update the snake checkboxes.
The last region is not snakable, so that checkbox gets
disabled. The rest get enabled.
"""
if len(self.regions) > 0:
self.regions[-1].snake_checkbox.setEnabled(False)
for region_i in self.regions[:-1]:
Expand Down Expand Up @@ -150,9 +159,10 @@ def queue_plan(self, *args, **kwargs):
)

# Submit the item to the queueserver
log.info("Added line scan() plan to queue.")
log.info(f"Added grid_scan() plan to queue ({repeat_scan_num} scans).")
# repeat scans
for i in range(repeat_scan_num):
print("EMITTING")
self.queue_item_submitted.emit(item)

def ui_filename(self):
Expand Down
3 changes: 2 additions & 1 deletion src/firefly/queue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ async def add_queue_item(self, item):
try:
result = await self.api.item_add(item=item)
self.check_result(result)
except (RuntimeError, comm_base.RequestFailedError):
except (RuntimeError, comm_base.RequestFailedError) as ex:
# Request failed, so force a UI update
await self.check_queue_status(force=True)
raise
else:
await self.check_queue_status(force=False)

Expand Down

0 comments on commit 8ee72f1

Please sign in to comment.