-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add View Options (title and axis titles) to Distributions widget #7302
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
Open
SofianElmotiem
wants to merge
3
commits into
biolab:master
Choose a base branch
from
DFU398:upstream-view-options
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,9 @@ | |
|
|
||
| import numpy as np | ||
|
|
||
| from AnyQt.QtWidgets import QGridLayout, QLabel, QLineEdit, QSizePolicy, QWidget | ||
| from AnyQt.QtCore import Qt | ||
| from AnyQt.QtWidgets import QFrame, QGridLayout, QLabel, QLineEdit, \ | ||
| QSizePolicy, QWidget, QScrollArea | ||
| from AnyQt.QtCore import Qt, QTimer | ||
|
|
||
| from Orange.data import StringVariable, DiscreteVariable, Domain | ||
| from Orange.data.table import Table | ||
|
|
@@ -227,6 +228,9 @@ class Outputs: | |
|
|
||
| want_main_area = False | ||
| buttons_area_orientation = Qt.Vertical | ||
| #: Max pixel height of the rules area before it scrolls instead of | ||
| #: growing the widget further | ||
| MAX_RULES_AREA_HEIGHT = 360 | ||
|
|
||
| settingsHandler = DomainContextHandler() | ||
| attribute = ContextSetting(None) | ||
|
|
@@ -269,6 +273,9 @@ def __init__(self): | |
| self.remove_buttons = [] | ||
| #: list of list of QLabel: pairs of labels with counts | ||
| self.counts = [] | ||
| #: bool: set by add_row, tells _refit_rules_area to scroll down | ||
| # once the new row's height has been applied | ||
| self._scroll_to_bottom_pending = False | ||
|
|
||
| gui.lineEdit( | ||
| self.controlArea, self, "class_name", | ||
|
|
@@ -301,9 +308,15 @@ def __init__(self): | |
| rules_box.addWidget(QLabel("Count"), 0, 3, 1, 2) | ||
| self.update_rules() | ||
|
|
||
| widg = QWidget(patternbox) | ||
| self._rules_widget = widg = QWidget() | ||
| widg.setLayout(rules_box) | ||
| patternbox.layout().addWidget(widg) | ||
|
|
||
| self._rules_scroll = scroll = QScrollArea() | ||
| scroll.setWidget(widg) | ||
| scroll.setWidgetResizable(True) | ||
| scroll.setFrameShape(QFrame.NoFrame) | ||
| scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) | ||
| patternbox.layout().addWidget(scroll) | ||
|
|
||
| box = gui.hBox(patternbox) | ||
| gui.rubber(box) | ||
|
|
@@ -328,7 +341,6 @@ def __init__(self): | |
|
|
||
| gui.button(self.buttonsArea, self, "Apply", callback=self.apply) | ||
|
|
||
| # TODO: Resizing upon changing the number of rules does not work | ||
| self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the extra blank lines. |
||
| @property | ||
|
|
@@ -427,9 +439,27 @@ def _fix_tab_order(): | |
| _remove_line() | ||
| _fix_tab_order() | ||
|
|
||
| QTimer.singleShot(0, self._refit_rules_area) | ||
|
|
||
| def _refit_rules_area(self): | ||
| content_height = self._rules_widget.sizeHint().height() | ||
| self._rules_scroll.setFixedHeight( | ||
| min(content_height, self.MAX_RULES_AREA_HEIGHT)) | ||
| self.adjustSize() | ||
|
|
||
| if self._scroll_to_bottom_pending: | ||
| self._scroll_to_bottom_pending = False | ||
| QTimer.singleShot(0, self._scroll_rules_to_bottom) | ||
|
|
||
| def _scroll_rules_to_bottom(self): | ||
| """Scroll the rules area down so a newly added row is visible.""" | ||
| bar = self._rules_scroll.verticalScrollBar() | ||
| bar.setValue(bar.maximum()) | ||
|
|
||
| def add_row(self): | ||
| """Append a new row at the end.""" | ||
| self.active_rules.append(["", ""]) | ||
| self._scroll_to_bottom_pending = True | ||
| self.adjust_n_rule_rows() | ||
| self.update_counts() | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is incomplete.