Skip to content

Conversation

@Alpaca233
Copy link
Collaborator

@Alpaca233 Alpaca233 commented Apr 3, 2025

  • show spot detection plot
  • show error message on spot detection failure
  • save threshold properties without initialization

@Alpaca233 Alpaca233 marked this pull request as ready for review April 3, 2025 16:04
@Alpaca233 Alpaca233 marked this pull request as draft April 3, 2025 23:15
@Alpaca233 Alpaca233 changed the title show spot detection plot Update LaserAutofocusSettingWidget Apr 4, 2025
@Alpaca233 Alpaca233 changed the title Update LaserAutofocusSettingWidget update LaserAutofocusSettingWidget Apr 4, 2025
@Alpaca233 Alpaca233 marked this pull request as ready for review April 4, 2025 03:41
def update_threshold_settings(self):
updates = {
"laser_af_averaging_n": int(self.spinboxes["laser_af_averaging_n"].value()),
"displacement_success_window_um": self.spinboxes["displacement_success_window_um"].value(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do any data validation on these? Or is it safe to trust that the spinboxes will do the validation for us?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the spinboxes will do the validation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if user enter 0 or negative value?

for i in range(1, self.imageDisplayTabs.count()):
widget = self.imageDisplayTabs.widget(i)
self.imageDisplayTabs.setTabEnabled(i, not self.performance_mode)
if self.imageDisplayTabs.tabText(i) != "Laser-Based Focus":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the bare string here is fragile - if someone changes the name of the tab, then this breaks. A safer and easier to maintain way to do this is to pull the tab name out into a class variable. For instance (details missing - but this'll give you an idea):

class HighContentScreeningGui(QMainWindow):
    LASER_BASED_FOCUS_TAB_NAME = "Laser-Based Focus"

    def setupImageDisplayTabs(self):
                    self.imageDisplayTabs.addTab(laserfocus_dockArea, HighContentScreeningGui.LASER_BASED_FOCUS_TAB_NAME)


    def toggleNapariTabs(self):
        # ...
        if self.imageDisplayTabs.tabText(i) != HighContentScreeningGui.LASER_BASED_FOCUS_TAB_NAME:
           # ...

Alternatively, and even better, we wouldn't use the tab name (since that is really just for human interaction, and can change too easily. For instance - if someone adds a feature that changes the tab name based on context, this will still break).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good identifier for the tabs? I think index may also change.

@hongquanli hongquanli merged commit 2a5c1c0 into Cephla-Lab:master Apr 14, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants