Repository: biolab/orange3

Issue:
Lift Curve should remember the choice of target class
**Current state**
Lift curve does not remember anything and resets the interface after any change of the input.

**Requested Change**
Make target class a context-dependent setting.

**Example**
Switch between Telecom customer churn or Hearth disease data sets in the following workflow, set the target class to Yes (churn) and 1 (heart disease).

![image](https://user-images.githubusercontent.com/726604/67083514-93003500-f19b-11e9-96b9-bd3f617f68c8.png)



Discussion:

Resolving patch:
diff --git a/Orange/widgets/evaluate/owliftcurve.py b/Orange/widgets/evaluate/owliftcurve.py
--- a/Orange/widgets/evaluate/owliftcurve.py
+++ b/Orange/widgets/evaluate/owliftcurve.py
@@ -16,6 +16,8 @@
 
 import Orange
 from Orange.widgets import widget, gui, settings
+from Orange.widgets.evaluate.contexthandlers import \
+    EvaluationResultsContextHandler
 from Orange.widgets.evaluate.utils import check_results_adequacy
 from Orange.widgets.utils import colorpalette, colorbrewer
 from Orange.widgets.evaluate.owrocanalysis import convex_hull
@@ -64,8 +66,9 @@ class OWLiftCurve(widget.OWWidget):
     class Inputs:
         evaluation_results = Input("Evaluation Results", Orange.evaluation.Results)
 
-    target_index = settings.Setting(0)
-    selected_classifiers = settings.Setting([])
+    settingsHandler = EvaluationResultsContextHandler()
+    target_index = settings.ContextSetting(0)
+    selected_classifiers = settings.ContextSetting([])
 
     display_convex_hull = settings.Setting(False)
     display_cost_func = settings.Setting(True)
@@ -133,10 +136,13 @@ def __init__(self):
     @Inputs.evaluation_results
     def set_results(self, results):
         """Set the input evaluation results."""
+        self.closeContext()
         self.clear()
         self.results = check_results_adequacy(results, self.Error)
         if self.results is not None:
             self._initialize(results)
+            self.openContext(self.results.domain.class_var,
+                             self.classifier_names)
             self._setup_plot()
 
     def clear(self):
diff --git a/Orange/widgets/evaluate/owrocanalysis.py b/Orange/widgets/evaluate/owrocanalysis.py
--- a/Orange/widgets/evaluate/owrocanalysis.py
+++ b/Orange/widgets/evaluate/owrocanalysis.py
@@ -17,6 +17,8 @@
 
 import Orange
 from Orange.widgets import widget, gui, settings
+from Orange.widgets.evaluate.contexthandlers import \
+    EvaluationResultsContextHandler
 from Orange.widgets.evaluate.utils import \
     check_results_adequacy, results_for_preview
 from Orange.widgets.utils import colorpalette, colorbrewer
@@ -303,8 +305,9 @@ class OWROCAnalysis(widget.OWWidget):
     class Inputs:
         evaluation_results = Input("Evaluation Results", Orange.evaluation.Results)
 
-    target_index = settings.Setting(0)
-    selected_classifiers = []
+    settingsHandler = EvaluationResultsContextHandler()
+    target_index = settings.ContextSetting(0)
+    selected_classifiers = settings.ContextSetting([])
 
     display_perf_line = settings.Setting(True)
     display_def_threshold = settings.Setting(True)
@@ -423,10 +426,13 @@ def __init__(self):
     @Inputs.evaluation_results
     def set_results(self, results):
         """Set the input evaluation results."""
+        self.closeContext()
         self.clear()
         self.results = check_results_adequacy(results, self.Error)
         if self.results is not None:
             self._initialize(self.results)
+            self.openContext(self.results.domain.class_var,
+                             self.classifier_names)
             self._setup_plot()
         else:
             self.warning()


Test patch: