Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plan window improvement #311

Merged
merged 13 commits into from
Jan 7, 2025
Prev Previous commit
Next Next commit
move change relative checkbox background into parent class
Cathyhjj committed Jan 7, 2025
commit 841cd071e17faa5e1f32b287c5c52e5f56bea36b
15 changes: 0 additions & 15 deletions src/firefly/plans/grid_scan.py
Original file line number Diff line number Diff line change
@@ -149,21 +149,6 @@ def customize_ui(self):
# Connect scan points change to update total time
for region in self.regions:
region.scan_pts_spin_box.valueChanged.connect(self.update_total_time)
self.ui.relative_scan_checkbox.stateChanged.connect(self.change_background)

def change_background(self, state):
"""
Change the background color of the relative scan checkbox based on its state.
"""
if state: # Checked
self.ui.relative_scan_checkbox.setStyleSheet(
"background-color: rgb(255, 85, 127);"
)

else: # Unchecked
self.ui.relative_scan_checkbox.setStyleSheet(
"background-color: rgb(0, 170, 255);"
)

def time_per_scan(self, detector_time):
total_num_pnts = np.prod(
15 changes: 0 additions & 15 deletions src/firefly/plans/line_scan.py
Original file line number Diff line number Diff line change
@@ -92,7 +92,6 @@ def customize_ui(self):
self.update_total_time
)
self.ui.spinBox_repeat_scan_num.valueChanged.connect(self.update_total_time)
self.ui.relative_scan_checkbox.stateChanged.connect(self.change_background)

# Connect scan_pts_spin_box value change to regions
self.ui.scan_pts_spin_box.valueChanged.connect(self.update_regions_step_size)
@@ -101,20 +100,6 @@ def update_regions_step_size(self, value):
for region in self.regions:
region.update_step_signal.emit(value)

def change_background(self, state):
"""
Change the background color of the relative scan checkbox based on its state.
"""
if state: # Checked
self.ui.relative_scan_checkbox.setStyleSheet(
"background-color: rgb(255, 85, 127);"
)

else: # Unchecked
self.ui.relative_scan_checkbox.setStyleSheet(
"background-color: rgb(0, 170, 255);"
)

def queue_plan(self, *args, **kwargs):
"""Execute this plan on the queueserver."""
detectors, motor_args, repeat_scan_num = self.get_scan_parameters()
18 changes: 17 additions & 1 deletion src/firefly/plans/regions_display.py
Original file line number Diff line number Diff line change
@@ -56,14 +56,30 @@ def customize_ui(self):

# Disable the line edits in spin box (use up/down buttons instead)
self.ui.num_motor_spin_box.lineEdit().setReadOnly(True)

# Create the initial (blank) regions
self.regions = []
self.ui.num_motor_spin_box.setValue(self.default_num_regions)
self.add_regions(self.default_num_regions)
# Set up the mechanism for changing region number
self.ui.num_motor_spin_box.valueChanged.connect(self.update_regions_slot)
self.ui.run_button.clicked.connect(self.queue_plan)
# Color highlights for relative checkbox
if hasattr(self, "relative_scan_checkbox"):
self.ui.relative_scan_checkbox.stateChanged.connect(self.change_background)

def change_background(self, state):
"""
Change the background color of the relative scan checkbox based on its state.
"""
if state: # Checked
self.ui.relative_scan_checkbox.setStyleSheet(
"background-color: rgb(255, 85, 127);"
)

else: # Unchecked
self.ui.relative_scan_checkbox.setStyleSheet(
"background-color: rgb(0, 170, 255);"
)

@asyncSlot(object)
async def update_devices(self, registry):