@@ -117,6 +117,7 @@ class Outputs:
117117 annotated_data = Output (ANNOTATED_DATA_SIGNAL_NAME , Table )
118118 features = Output ("Features" , Table , dynamic = False )
119119
120+ settings_version = 2
120121 settingsHandler = DomainContextHandler ()
121122
122123 auto_send_selection = Setting (True )
@@ -401,8 +402,9 @@ def apply_selection(self):
401402 """Apply selection saved in workflow."""
402403 if self .data is not None and self .selection is not None :
403404 self .graph .selection = np .zeros (len (self .data ), dtype = np .uint8 )
404- self .selection = [x for x in self .selection if x < len (self .data )]
405- self .graph .selection [self .selection ] = 1
405+ self .selection = [x for x in self .selection if x [0 ] < len (self .data )]
406+ selection_array = np .array (self .selection ).T
407+ self .graph .selection [selection_array [0 ]] = selection_array [1 ]
406408 self .graph .update_colors (keep_colors = True )
407409
408410 @Inputs .features
@@ -477,7 +479,7 @@ def send_data(self):
477479
478480 # Store current selection in a setting that is stored in workflow
479481 if selection is not None and len (selection ):
480- self .selection = list (selection )
482+ self .selection = list (zip ( selection , graph . selection [ selection ]) )
481483 else :
482484 self .selection = None
483485
@@ -520,6 +522,13 @@ def onDeleteWidget(self):
520522 self .graph .plot_widget .getViewBox ().deleteLater ()
521523 self .graph .plot_widget .clear ()
522524
525+ @classmethod
526+ def migrate_settings (cls , settings , version ):
527+ if "selection" in settings \
528+ and settings ["selection" ] \
529+ and not isinstance (settings ["selection" ][0 ], tuple ):
530+ settings ["selection" ] = [(a , 1 ) for a in settings ["selection" ]]
531+
523532
524533def main (argv = None ):
525534 import sys
0 commit comments