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

[ENH] MergeData: add autocommit button #3091

Merged
merged 4 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Orange/widgets/data/owmergedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Outputs:
attr_combine_data = settings.Setting('', schema_only=True)
attr_combine_extra = settings.Setting('', schema_only=True)
merging = settings.Setting(0)
auto_apply = settings.Setting(True)

want_main_area = False
resizing_enabled = False
Expand Down Expand Up @@ -111,6 +112,9 @@ def add_option(label, pre_label, between_label,
self.model_unique_with_id, self.extra_model_unique_with_id)
self.set_merging()

gui.auto_commit(self.controlArea, self, "auto_apply", "&Apply",
box=False)

def set_merging(self):
# pylint: disable=invalid-sequence-index
# all boxes should be hidden before one is shown, otherwise widget's
Expand Down
14 changes: 14 additions & 0 deletions Orange/widgets/data/tests/test_owmergedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,3 +450,17 @@ def test_sparse(self):

output_sparse.X = output_sparse.X.toarray()
self.assertTablesEqual(output_dense, output_sparse)

def test_disable_auto_apply(self):
Copy link
Member

Choose a reason for hiding this comment

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

please also check that auto_apply works when enabled

"""Check if disable auto apply works as expected"""
self.widget.auto_apply = False
self.send_signal(self.widget.Inputs.data, self.dataA)
self.send_signal(self.widget.Inputs.extra_data, self.dataB)
self.assertIsNone(self.get_output(self.widget.Outputs.data))

def test_enable_auto_apply(self):
"""Check if enable auto apply works as expected"""
self.widget.auto_apply = True
self.send_signal(self.widget.Inputs.data, self.dataA)
self.send_signal(self.widget.Inputs.extra_data, self.dataB)
self.assertIsNotNone(self.get_output(self.widget.Outputs.data))