Repository: biolab/orange3

Issue:
ApplyDomain widget: 'Retain all data' checkbox is now redundant
After #3526 was implemented in parallel with other work on Apply Domain, the "Retain all data" checkbox and its action can now be removed. Currently, the result is a sert of duplicated columns (in meta).

Example workflow:
[apply_domain_iris.ows.zip](https://github.com/biolab/orange3/files/3162413/apply_domain_iris.ows.zip)
  
![screen](https://user-images.githubusercontent.com/5073833/57458315-6b628380-7271-11e9-9170-b54c0c7c0964.png)



Discussion:

Resolving patch:
diff --git a/Orange/widgets/data/owtransform.py b/Orange/widgets/data/owtransform.py
--- a/Orange/widgets/data/owtransform.py
+++ b/Orange/widgets/data/owtransform.py
@@ -1,11 +1,8 @@
 from typing import Optional
 
-import numpy as np
-
 from Orange.data import Table, Domain
 from Orange.widgets import gui
 from Orange.widgets.report.report import describe_data
-from Orange.widgets.settings import Setting
 from Orange.widgets.utils.sql import check_sql_input
 from Orange.widgets.utils.widgetpreview import WidgetPreview
 from Orange.widgets.widget import OWWidget, Input, Output, Msg
@@ -18,8 +15,6 @@ class OWTransform(OWWidget):
     priority = 2110
     keywords = ["transform"]
 
-    retain_all_data = Setting(False)
-
     class Inputs:
         data = Input("Data", Table, default=True)
         template_data = Input("Template Data", Table)
@@ -46,10 +41,6 @@ def __init__(self):
         self.set_input_label_text()
         self.set_template_label_text()
 
-        box = gui.widgetBox(self.controlArea, "Output")
-        gui.checkBox(box, self, "retain_all_data", "Retain all data",
-                     callback=self.apply)
-
     def set_input_label_text(self):
         text = "No data on input."
         if self.data:
@@ -98,23 +89,11 @@ def apply(self):
                 self.Error.error(ex)
 
         data = transformed_data
-        if data and self.retain_all_data:
-            data = self.merged_data(data)
         self.transformed_info = describe_data(data)
         self.Outputs.transformed_data.send(data)
         self.set_template_label_text()
         self.set_output_label_text(data)
 
-    def merged_data(self, t_data):
-        domain = self.data.domain
-        t_domain = t_data.domain
-        metas = domain.metas + t_domain.attributes + t_domain.metas
-        domain = Domain(domain.attributes, domain.class_vars, metas)
-        data = self.data.transform(domain)
-        metas = np.hstack((t_data.X, t_data.metas))
-        data.metas[:, -metas.shape[1]:] = metas
-        return data
-
     def send_report(self):
         if self.data:
             self.report_data("Data", self.data)


Test patch:
diff --git a/Orange/widgets/data/tests/test_owtransform.py b/Orange/widgets/data/tests/test_owtransform.py
--- a/Orange/widgets/data/tests/test_owtransform.py
+++ b/Orange/widgets/data/tests/test_owtransform.py
@@ -5,7 +5,7 @@
 from numpy import testing as npt
 
 from Orange.data import Table
-from Orange.preprocess import Discretize, Continuize
+from Orange.preprocess import Discretize
 from Orange.widgets.data.owtransform import OWTransform
 from Orange.widgets.tests.base import WidgetTest
 from Orange.widgets.unsupervised.owpca import OWPCA
@@ -84,17 +84,6 @@ def test_input_pca_output(self):
         output = self.get_output(self.widget.Outputs.transformed_data)
         npt.assert_array_equal(pca_out.X[::10], output.X)
 
-    def test_retain_all_data(self):
-        data = Table("zoo")
-        cont_data = Continuize()(data)
-        self.send_signal(self.widget.Inputs.data, data)
-        self.send_signal(self.widget.Inputs.template_data, cont_data)
-        self.widget.controls.retain_all_data.click()
-        output = self.get_output(self.widget.Outputs.transformed_data)
-        self.assertIsInstance(output, Table)
-        self.assertEqual(output.X.shape, (len(data), 16))
-        self.assertEqual(output.metas.shape, (len(data), 38))
-
     def test_error_transforming(self):
         data = self.data[::10]
         data.transform = Mock(side_effect=Exception())