Repository: biolab/orange3

Issue:
Select Columns not remembering settings on workflow reload
When using Select Columns in a workflow, saving a workflow and reopening it the selection in Select Columns is forgotten. - Select Columns shows no features and Reset must be used before they are shown again (image below). 

![Screenshot from 2020-04-23 21-09-05](https://user-images.githubusercontent.com/47607471/80139575-f46beb00-85a6-11ea-86b3-271d2d0e0357.png)

I also get this error on workflow loading:

```Exception: | TypeError: '>' not supported between instances of 'list' and 'int'
-- | --
Module: | orangewidget.settings:869
Widget Name: | Select Columns
Widget Module: | Orange.widgets.data.owselectcolumns:360
Widget Scheme: | <?xml version='1.0' encoding='utf-8'?> <scheme description="" title="" version="2.0"> <nodes> <node id="0" name="CSV File Import" position="(322.0, 354.0)" project_name="Orange3" qualified_name="Orange.widgets.data.owcsvimport.OWCSVFileImport" title="CSV File Import" version="" /> <node id="1" name="Select Columns" position="(482.0, 372.0)" project_name="Orange3" qualified_name="Orange.widgets.data.owselectcolumns.OWSelectAttributes" title="Select Columns" version="" /> </nodes> <links> <link enabled="true" id="0" sink_channel="Data" sink_node_id="1" source_channel="Data" source_node_id="0" /> </links> <annotations /> <thumbnail /> <node_properties> <properties format="literal" node_id="0">{'_session_items': [('/home/karin/Documents/git/orange3/Orange/datasets/heart_disease.tab', {'encoding': 'utf-8', 'delimiter': '\t', 'quotechar': '"', 'doublequote': True, 'skipinitialspace': True, 'quoting': 0, 'columntypes': [{'start': 0, 'stop': 1, 'value': 'Auto'}, {'start': 1, 'stop': 3, 'value': 'Categorical'}, {'start': 3, 'stop': 4, 'value': 'Auto'}, {'start': 4, 'stop': 5, 'value': 'Text'}, {'start': 5, 'stop': 8, 'value': 'Auto'}, {'start': 8, 'stop': 9, 'value': 'Categorical'}, {'start': 9, 'stop': 14, 'value': 'Auto'}], 'rowspec': [{'start': 0, 'stop': 1, 'value': 'Header'}], 'decimal_separator': '.', 'group_separator': ''}), ('/home/karin/Documents/timeTrajectories/data/regulons/genes_averaged_orange_scale99percentileMax0.1.tsv', {'encoding': 'utf-8', 'delimiter': '\t', 'quotechar': '"', 'doublequote': True, 'skipinitialspace': True, 'quoting': 0, 'columntypes': [{'start': 0, 'stop': 12830, 'value': 'Auto'}, {'start': 12830, 'stop': 12832, 'value': 'Categorical'}], 'rowspec': [{'start': 0, 'stop': 1, 'value': 'Header'}], 'decimal_separator': '.', 'group_separator': ''})], 'controlAreaVisible': True, 'dialog_state': {'directory': '/home/karin/Documents/git/orange3/Orange/datasets', 'filter': 'Text - comma separated (*.csv, *)'}, 'savedWidgetGeometry': b'\x01\xd9\xd0\xcb\x00\x03\x00\x00\x00\x00\x00\x9e\x00\x00\x02x\x00\x00\x01\xe9\x00\x00\x03\xdf\x00\x00\x00\x9e\x00\x00\x02\x96\x00\x00\x01\xe9\x00\x00\x03\xdf\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x9e\x00\x00\x02\x96\x00\x00\x01\xe9\x00\x00\x03\xdf', '__version__': 1}</properties> <properties format="literal" node_id="1">{'auto_commit': True, 'controlAreaVisible': True, 'savedWidgetGeometry': b'\x01\xd9\xd0\xcb\x00\x03\x00\x00\x00\x00\x02\xd3\x00\x00\x00=\x00\x00\x05p\x00\x00\x04S\x00\x00\x02\xd3\x00\x00\x00[\x00\x00\x05p\x00\x00\x04S\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x02\xd3\x00\x00\x00[\x00\x00\x05p\x00\x00\x04S', 'use_input_features': False, '__version__': 1, 'context_settings': []}</properties> </node_properties> <session_state> <window_groups /> </session_state> </scheme>
Version: | 3.26.0.dev
Environment: | Python 3.6.8 on Linux 5.3.0-46-generic #38~18.04.1-Ubuntu SMP Tue Mar 31 04:17:56 UTC 2020 x86_64
Installed Packages: | AnyQt==0.0.10, Bottleneck==1.2.1, Brlapi==0.6.6, CacheControl==0.12.5, Genesis-PyAPI==1.2.1, Jinja2==2.10.3, Mako==1.0.7, MarkupSafe==1.1.1, Orange3-Bioinformatics==4.1.0a2.dev15+g0b11778, Orange3-ImageAnalytics==0.4.1, Orange3-Network==1.4.2, Orange3-Prototypes==0.12.0, Orange3-SingleCell==1.3.0, Orange3-Timeseries==0.3.3, Orange3==3.26.0.dev0+061bdb9, Pillow==7.0.0, PyNaCl==1.1.2, PyQt5-sip==4.19.18, PyQt5==5.13.0, PyQtWebEngine==5.13.0, PyYAML==5.1.2, Pygments==2.4.2, SecretStorage==3.1.1, Send2Trash==1.5.0, XlsxWriter==1.2.0, altair==3.2.0, anndata==0.7.1, apturl==0.5.2, asn1crypto==0.24.0, attrs==19.3.0, backcall==0.1.0, baycomp==1.0.2, beautifulsoup4==4.8.2, bleach==3.1.0, certifi==2018.1.18, cffi==1.14.0, chardet==3.0.4, click==7.1.1, command-not-found==0.3, commonmark==0.9.1, contextvars==2.4, cryptography==2.1.4, cupshelpers==1.0, cycler==0.10.0, decorator==4.4.1, defer==1.0.6, defusedxml==0.6.0, distro-info==0.18ubuntu0.18.04.1, docutils==0.15.2, entrypoints==0.3, et-xmlfile==1.0.1, fastdtw==0.3.2, future==0.18.2, h11==0.9.0, h2==3.2.0, h5py==2.10.0, hpack==3.0.0, hstspreload==2020.3.12, html5lib==0.999999999, httplib2==0.9.2, httpx==0.12.1, hyperframe==5.2.0, idna==2.6, immutables==0.11, importlib-metadata==0.23, ipykernel==5.1.3, ipython-genutils==0.2.0, ipython==7.9.0, ipywidgets==6.0.0, jdcal==1.4.1, jedi==0.15.1, jeepney==0.4.1, joblib==0.14.0, jsonschema==3.1.1, jupyter-client==5.3.4, jupyter-core==4.6.1, keyring==10.6.0, keyrings.alt==3.0, kiwisolver==1.1.0, language-selector==0.1, launchpadlib==1.10.6, lazr.restfulclient==0.13.5, lazr.uri==1.0.3, liac-arff==2.4.0, llvmlite==0.30.0, lockfile==0.12.2, loompy==3.0.6, louis==3.5.0, lowess==0.1.dev0, lxml==4.4.1, macaroonbakery==1.1.3, matplotlib==3.1.1, mistune==0.8.4, more-itertools==7.2.0, mpmath==1.1.0, msgpack==0.6.2, natsort==7.0.1, nbconvert==5.6.1, nbformat==4.4.0, ndf==0.1.4, netifaces==0.10.4, networkx==2.4, notebook==6.0.1, numba==0.46.0, numexpr==2.7.0, numpy-groupies==0+unknown, numpy==1.17.3, oauth==1.0.1, olefile==0.45.1, openTSNE==0.3.11, openpyxl==3.0.3, orange-canvas-core==0.1.11, orange-widget-base==4.6.0.dev0+c145824, packaging==20.3, pandas-datareader==0.7.4, pandas==0.25.1, pandocfilters==1.4.2, parso==0.5.1, patsy==0.5.1, pbr==5.4.5, pexpect==4.7.0, pickleshare==0.7.5, pip==20.0.2, pkg-resources==0.0.0, plotly==4.5.4, pluggy==0.13.1, point-annotator==2.0.0, progressbar2==3.50.1, prometheus-client==0.7.1, prompt-toolkit==2.0.9, protobuf==3.0.0, ptyprocess==0.6.0, py==1.8.1, pyRFC3339==1.0, pycairo==1.16.2, pyclipper==1.1.0.post1, pycparser==2.19, pycrypto==2.6.1, pycups==1.9.73, pygam==0.8.0, pygobject==3.26.1, pygraphviz==1.5, pymacaroons==0.13.0, pynndescent==0.3.3, pyparsing==2.4.2, pyqtgraph==0.10.0, pyreadr==0.2.6, pyrsistent==0.15.4, pytest==5.4.1, python-apt==1.6.5+ubuntu0.2, python-dateutil==2.8.0, python-debian==0.1.32, python-louvain==0.13, python-utils==2.4.0, pytz==2019.2, pyxdg==0.25, pyzmq==18.1.0, qtconsole==4.5.5, reportlab==3.4.0, requests-cache==0.5.2, requests-unixsocket==0.1.5, requests==2.22.0, retrying==1.3.3, rfc3986==1.3.2, rpy2==3.2.7, scikit-learn==0.22.2, scikit-multilearn==0.2.0, scipy==1.4.1, seaborn==0.9.0, serverfiles==0.3.0, setuptools-scm==3.5.0, setuptools==46.1.3, simplegeneric==0.8.1, simplejson==3.13.2, six==1.12.0, slumber==0.7.1, sniffio==1.1.0, soupsieve==2.0, statsmodels==0.10.1, system-service==0.3, systemd-python==234, tables==3.6.1, terminado==0.8.2, testpath==0.4.2, testresources==2.0.1, toolz==0.10.0, tornado==6.0.3, traitlets==4.3.2, tzlocal==2.0.0, ubuntu-drivers-common==0.0.0, ufw==0.36, unattended-upgrades==0.1, urllib3==1.25.3, usb-creator==0.3.3, vega-datasets==0.7.0, vega==2.6.0, virtualenv==15.1.0, wadllib==1.3.2, wcwidth==0.1.7, webencodings==0.5.1, wheel==0.34.2, widgetsnbextension==3.5.1, wrapt==1.11.2, xkit==0.0.0, xlrd==1.2.0, zipp==0.6.0, zope.interface==4.3.2
Machine ID: | d5e5beb4-b267-4ebb-ac95-faa0288a9cab
Stack Trace: | Traceback (most recent call last):  File "/home/karin/Documents/git/orange3venv/lib/python3.6/site-packages/orangecanvas/scheme/signalmanager.py", line 936, in __process_next    if self.__process_next_helper(use_max_active=True):  File "/home/karin/Documents/git/orange3venv/lib/python3.6/site-packages/orangecanvas/scheme/signalmanager.py", line 974, in __process_next_helper    self.process_node(selected_node)  File "/home/karin/Documents/git/orange3venv/lib/python3.6/site-packages/orangecanvas/scheme/signalmanager.py", line 605, in process_node    self.send_to_node(node, signals_in)  File "/home/karin/Documents/git/orange-widget-base/orangewidget/workflow/widgetsscheme.py", line 792, in send_to_node    self.process_signals_for_widget(node, widget, signals)  File "/home/karin/Documents/git/orange-widget-base/orangewidget/workflow/widgetsscheme.py", line 826, in process_signals_for_widget    handler(*args)  File "/home/karin/Documents/git/orange3/Orange/widgets/data/owselectcolumns.py", line 360, in set_data    self.openContext(data)  File "/home/karin/Documents/git/orange-widget-base/orangewidget/widget.py", line 979, in openContext    self.settingsHandler.open_context(self, *a)  File "/home/karin/Documents/git/orange3/Orange/widgets/settings.py", line 122, in open_context    super().open_context(widget, domain, *self.encode_domain(domain))  File "/home/karin/Documents/git/orange-widget-base/orangewidget/settings.py", line 816, in open_context    self.find_or_create_context(widget, *args)  File "/home/karin/Documents/git/orange-widget-base/orangewidget/settings.py", line 849, in find_or_create_context    best_score, best_context)  File "/home/karin/Documents/git/orange-widget-base/orangewidget/settings.py", line 869, in find_context    if score > best_score:  # NO_MATCH is not OK!TypeError: '>' not supported between instances of 'list' and 'int'

```
Recent master (3.26) on Linux.


Discussion:

Resolving patch:
diff --git a/Orange/widgets/data/owselectcolumns.py b/Orange/widgets/data/owselectcolumns.py
--- a/Orange/widgets/data/owselectcolumns.py
+++ b/Orange/widgets/data/owselectcolumns.py
@@ -124,8 +124,9 @@ def match(self, context, domain, attrs, metas):
         value = context.values["domain_role_hints"][0]
         assigned = [desc for desc, (role, _) in value.items()
                     if role != "available"]
-        return assigned and \
-               sum(all_vars.get(attr) == vtype for attr, vtype in assigned) \
+        if not assigned:
+            return self.NO_MATCH
+        return sum(all_vars.get(attr) == vtype for attr, vtype in assigned) \
                / len(assigned)
 
     def filter_value(self, setting, data, domain, attrs, metas):


Test patch: