[fix] NumberSlider height for itself and the linked_field#3405
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts the vertical sizing of the FastEM “Overview acquisition” settings area to better accommodate NumberSlider controls and their linked text fields, aiming to prevent clipping/misalignment in the UI.
Changes:
- Increase the
pnl_overview_acqpanel height from100to102in the XRC resource and its generated Python representation. - Update the
SettingsPanelinstantiation size to match the new panel height. - Modify
NumberSlidersizing logic so the linked text field height follows the slider height, and update the slider’s minimum height calculation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/odemis/gui/xmlh/resources/panel_tab_fastem_setup.xrc |
Bumps the XRC-defined size for pnl_overview_acq to increase available vertical space. |
src/odemis/gui/main_xrc.py |
Mirrors the same panel size change in the generated XRC Python resource content. |
src/odemis/gui/cont/acquisition/fastem_acq.py |
Updates SettingsPanel(..., size=...) to align with the new panel height. |
src/odemis/gui/comp/slider.py |
Changes NumberSlider min-height logic and linked-field resizing behavior. |
You can also share your feedback on Copilot code review. Take the survey.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe changes update the 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| # Make sure we give enough vertical space to the text field | ||
| self.SetMinSize((-1, self.linked_field.BestSize[1])) | ||
| self.SetMinSize((-1, max(self.linked_field.GetCharHeight(), self.handle_height))) |
There was a problem hiding this comment.
That's the core of this change. Apparently, BestSize returns a too large value with wxPython 4.2.1 on Ubuntu 24.04. Note that the wxPython 4.2.5 from pypi doesn't have this issue. So I think it'd be worthy to explain in a comment or at least in the commit text.
Something like "This [blabla] doesn't work [...], so we guess the best size based on the char height".
BTW, I've tried GetCharHeight() + 2 and that seems to give a bit more "room to breath" without being too high.
There was a problem hiding this comment.
Just using GetCharHeight() for FASTEM
Using GetCharHeight() + 2 for FASTEM
@tepals do we need the +2 visually? then I have to add a few more pixels to the overview acq panel size as the Load button is cropped
There was a problem hiding this comment.
Thanks, for few more pixels to the overview acq panel size comment, I will open a separate PR to automatically calculate the size for all FASTEM to make it future proof.
| # horizontal line of the slider | ||
| height = self.GetHeight() + 4 | ||
| self.linked_field.SetSize((self.linked_field.Size[0], height)) | ||
| self.linked_field.SetSize((self.linked_field.Size[0], self.GetHeight())) |
There was a problem hiding this comment.
I don't think that's really necessary, on my tests, it just moved the box up and down. Let's leave it as-is, to reduce chances of unexpected regressions on other platforms?
BTW, if you change the line, you can use -1 as first param, and drop the tuple, like that:
self.linked_field.SetSize(-1, self.GetHeight())
d3e83ff to
af47bbf
Compare
af47bbf to
76aa0c3
Compare
76aa0c3 to
c4363d4
Compare


No description provided.