Skip to content

Add View Options (title and axis titles) to Distributions widget#7302

Open
SofianElmotiem wants to merge 3 commits into
biolab:masterfrom
DFU398:upstream-view-options
Open

Add View Options (title and axis titles) to Distributions widget#7302
SofianElmotiem wants to merge 3 commits into
biolab:masterfrom
DFU398:upstream-view-options

Conversation

@SofianElmotiem

Copy link
Copy Markdown

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.

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.
@CLAassistant

CLAassistant commented Jun 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread Orange/widgets/data/owcreateclass.py Outdated
min(content_height, self.MAX_RULES_AREA_HEIGHT))
self.adjustSize()

if getattr(self, "_scroll_to_bottom_pending", False):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
    ...

Comment thread Orange/widgets/data/owcreateclass.py Outdated

want_main_area = False
buttons_area_orientation = Qt.Vertical
#: Max pixel height of the rules area before it scrolls instead of

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The comment is incomplete.

@@ -331,6 +343,8 @@ def __init__(self):
# TODO: Resizing upon changing the number of rules does not work
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove the extra blank lines.

Comment thread Orange/widgets/data/owcreateclass.py Outdated
@@ -331,6 +343,8 @@ def __init__(self):
# TODO: Resizing upon changing the number of rules does not work

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removed the comment.

Comment thread Orange/widgets/data/owcreateclass.py Outdated
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."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove the docstring. It's not needed for the protected function, besides the name of the function is representative enough.

Comment thread Orange/widgets/data/owcreateclass.py Outdated
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
@SofianElmotiem

Copy link
Copy Markdown
Author

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.

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