@@ -212,7 +212,7 @@ def __init__(self):
212212 self .mainArea .layout ().addWidget (view )
213213 view .setModel (model )
214214 view .setColumnWidth (0 , 30 )
215- view .selectionModel ().selectionChanged .connect (self .commit )
215+ view .selectionModel ().selectionChanged .connect (self .on_select )
216216
217217 def _set_select_manual ():
218218 self .setSelectionMethod (OWRank .SelectManual )
@@ -331,7 +331,7 @@ def handleNewSignals(self):
331331 self .setStatusMessage ('Running' )
332332 self .updateScores ()
333333 self .setStatusMessage ('' )
334- self .commit ()
334+ self .on_select ()
335335
336336 @Inputs .scorer
337337 def set_learner (self , scorer , id ):
@@ -438,12 +438,18 @@ def updateScores(self):
438438 self .autoSelection ()
439439 self .Outputs .scores .send (self .create_scores_table (labels ))
440440
441+ def on_select (self ):
442+ # Save indices of attributes in the original, unsorted domain
443+ self .selected_rows = self .ranksModel .mapToSourceRows ([
444+ i .row () for i in self .ranksView .selectionModel ().selectedRows (0 )])
445+ self .commit ()
446+
441447 def setSelectionMethod (self , method ):
442448 if self .selectionMethod != method :
443449 self .selectionMethod = method
444450 self .selectButtons .button (method ).setChecked (True )
445451 self .autoSelection ()
446- self .commit ()
452+ self .on_select ()
447453
448454 def autoSelection (self ):
449455 selModel = self .ranksView .selectionModel ()
@@ -500,10 +506,6 @@ def send_report(self):
500506 self .report_items ("Output" , self .out_domain_desc )
501507
502508 def commit (self ):
503- # Save indices of attributes in the original, unsorted domain
504- self .selected_rows = self .ranksModel .mapToSourceRows ([
505- i .row () for i in self .ranksView .selectionModel ().selectedRows (0 )])
506-
507509 selected_attrs = []
508510 if self .data is not None :
509511 attributes = self .data .domain .attributes
@@ -512,8 +514,7 @@ def commit(self):
512514 self .selectButtons .button (self .selectionMethod ).setChecked (True )
513515 selected_attrs = [attributes [i ]
514516 for i in self .selected_rows ]
515-
516- if self .data is None or not selected_attrs :
517+ if not selected_attrs :
517518 self .Outputs .reduced_data .send (None )
518519 self .out_domain_desc = None
519520 else :
0 commit comments