Add View Options (title and axis titles) to Distributions widget#7302
Add View Options (title and axis titles) to Distributions widget#7302SofianElmotiem wants to merge 3 commits into
Conversation
Implements biolab#7298. Adds custom plot title and custom x/y axis title support to the Distributions widget View Options dialog, consistent with Line Plot, Bar Plot and Violin Plot. Also includes a small fix for Create Class: the widget did not resize when rule rows were added/removed, and the rule list had no height cap.
| min(content_height, self.MAX_RULES_AREA_HEIGHT)) | ||
| self.adjustSize() | ||
|
|
||
| if getattr(self, "_scroll_to_bottom_pending", False): |
There was a problem hiding this comment.
self._scroll_to_bottom_pending should be defined within __init__ and addressed as:
if self._scroll_to_bottom_pending:
self._scroll_to_bottom_pending = False
...
|
|
||
| want_main_area = False | ||
| buttons_area_orientation = Qt.Vertical | ||
| #: Max pixel height of the rules area before it scrolls instead of |
| @@ -331,6 +343,8 @@ def __init__(self): | |||
| # TODO: Resizing upon changing the number of rules does not work | |||
| self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) | |||
|
|
|||
There was a problem hiding this comment.
Remove the extra blank lines.
| @@ -331,6 +343,8 @@ def __init__(self): | |||
| # TODO: Resizing upon changing the number of rules does not work | |||
| def _refit_rules_area(self): | ||
| """Size the rules scroll area to its contents, but never taller than | ||
| MAX_RULES_AREA_HEIGHT (beyond that it scrolls, so the Apply button | ||
| stays on screen), then re-fit the window to its new contents.""" |
There was a problem hiding this comment.
Remove the docstring. It's not needed for the protected function, besides the name of the function is representative enough.
| content_height = self._rules_widget.sizeHint().height() | ||
| needs_scroll = content_height > self.MAX_RULES_AREA_HEIGHT | ||
| self._rules_scroll.setVerticalScrollBarPolicy( | ||
| Qt.ScrollBarAlwaysOn if needs_scroll else Qt.ScrollBarAlwaysOff) |
There was a problem hiding this comment.
This line is not needed. The setFixedHeight will suffice.
- complete the MAX_RULES_AREA_HEIGHT comment - remove stale TODO and extra blank lines - drop docstring from the protected _refit_rules_area - remove the redundant scrollbar-policy line; setFixedHeight already makes the scroll area show its bar only when content overflows
|
Pushed fixes for all the review comments above (import spacing, _scroll_to_bottom_pending init, comment, docstring, redundant scrollbar line). Also noticed the failing checks (lint, Latest py3.14 on all platforms, most Released jobs) are failing the same way on master directly, so it looks unrelated to this PR ,happy to investigate further if I'm missing something though. |
Implements #7298.
Adds custom plot title and custom x/y axis title support to the Distributions widget View Options dialog, consistent with Line Plot, Bar Plot and Violin Plot. Empty fields fall back to the existing automatic behaviour (variable name / "Frequency"), and the new settings are saved with the workflow like any other visual setting.
Also includes a small fix for Create Class: the widget did not resize when rule rows were added or removed, and the rule list had no height cap.
This was done as a student project; happy to adjust based on review feedback.