Skip to content

Commit

Permalink
Merge pull request #3091 from robertcv/fix_mergedata
Browse files Browse the repository at this point in the history
[ENH] MergeData: add autocommit button
  • Loading branch information
ajdapretnar authored Jun 29, 2018
2 parents 81b40d6 + a8bdfc5 commit cbd17e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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):
"""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))

0 comments on commit cbd17e1

Please sign in to comment.