Skip to content

Commit

Permalink
owrank: Add migrate_settings
Browse files Browse the repository at this point in the history
Fix an error when restoring from a workflow that was saved before
widget supported ranking features on data with no class.
  • Loading branch information
ales-erjavec committed Dec 2, 2016
1 parent e069705 commit fb6bc5b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Orange/widgets/data/owrank.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class OWRank(OWWidget):
# Header state for discrete/continuous/no_class scores
headerState = Setting([None, None, None])

settings_version = 1
settingsHandler = DomainContextHandler()
selected_rows = ContextSetting([])

Expand Down Expand Up @@ -688,6 +689,19 @@ def create_scores_table(self, labels):
new_table.name = "Feature Scores"
return new_table

@classmethod
def migrate_settings(cls, settings, version):
super().migrate_settings(settings, version)
if not version:
# Before fc5caa1e1d716607f1f5c4e0b0be265c23280fa0
# headerState had length 2
headerState = settings.get("headerState", None)
if headerState is not None and \
isinstance(headerState, tuple) and \
len(headerState) < 3:
headerState = (list(headerState) + [None] * 3)[:3]
settings["headerState"] = headerState


class ScoreValueItem(QStandardItem):
"""A StandardItem subclass for python objects.
Expand Down

0 comments on commit fb6bc5b

Please sign in to comment.