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
Merged

Plan window improvement #311

merged 13 commits into from
Jan 7, 2025

Conversation

Cathyhjj
Copy link
Collaborator

@Cathyhjj Cathyhjj commented Nov 21, 2024

Things to do before merging:

  • add tests
  • write docs
  • update iconfig_testing.toml
  • flake8, black, and isort

@Cathyhjj Cathyhjj requested a review from canismarko November 21, 2024 18:37
@Cathyhjj
Copy link
Collaborator Author

Cathyhjj commented Dec 15, 2024

do not review this PR yet, I wanted to add #329 in this PR too, @canismarko

@canismarko
Copy link
Contributor

This numpy error is fixed in another PR: a823595

The rest of the tests pass so I'll just review it as is.

self.ui.spinBox_repeat_scan_num.valueChanged.connect(self.update_total_time)
# 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):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this method be moved to the RegionsDisplay class so we don't need to write it twice? It looks identical between the line scan and grid scan versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea!

@@ -12,6 +13,7 @@


class LineScanRegion(regions_display.RegionBase):
update_step_signal = Signal(int)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this signal for? It looks like LineScanDisplay.update_regions_step_size() emits this signal, but all it does is connect directly to LineScanRegion.update_step_size(). Could LineScanDisplay.update_regions_step_size() call directly LineScanRegion.update_step_size()?

If we really need a signal, can it be renamed to describe what actually happened? Signals typically represent some changed state in the application (e.g. "checked", "textChanged" etc) instead of an action to take (that's a slot).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, fixed, see the changed codes

# Connect scan_pts_spin_box value change to regions
self.ui.scan_pts_spin_box.valueChanged.connect(self.update_regions_step_size)

def update_regions_step_size(self, value):
Copy link
Contributor

Choose a reason for hiding this comment

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

"value" is a bit vague. How about step_size or something like that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed

assert region_0.step_size_line_edit.text() == "N/A"

# Test edge case: num_points = 1 for Region 1
region_1.scan_pts_spin_box.setValue(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Good call testing for these edge cases!

Copy link
Contributor

@canismarko canismarko left a comment

Choose a reason for hiding this comment

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

Looks good, feel free to merge when ready.

@Cathyhjj Cathyhjj merged commit 2407ebc into main Jan 7, 2025
1 check failed
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.

2 participants