Commits

Aleš Erjavec  committed 8870b3c

Remove already entered names from the completion model.

  • Participants
  • Parent commits b956702

Comments (0)

Files changed (1)

File _bioinformatics/widgets/OWSelectGenes.py

         # Input variables that could contain names
         self.variables = VariableListModel()
         # All gene names from the input (in self.geneIndex column)
-        self.geneNames = set([])
+        self.geneNames = []
         # Output changed flag
         self._changedFlag = False
 
         completer.setCompletionMode(QCompleter.PopupCompletion)
         completer.setCaseSensitivity(Qt.CaseInsensitive)
         completer.popup().setAlternatingRowColors(True)
+        completer.setModel(QStringListModel([], self))
+
         self.entryField.setCompleter(completer)
 
         self.hightlighter = NameHighlight(self.entryField.document())
             names = []
 
         self.geneNames = names
-        self._completerModel = QStringListModel(names)
-        self.entryField.completer().setModel(self._completerModel)
+        self.entryField.completer().model().setStringList(sorted(set(names)))
         self.hightlighter.setNames(names)
 
     def _onGeneIndexChanged(self):
         names = self.entryField.list()
         selection = set(names).intersection(self.geneNames)
         curr_selection = set(self.selection).intersection(self.geneNames)
+
         if selection != curr_selection:
             self.selection = names
             self.invalidateOutput()
 
+            names = set(self.geneNames) - set(names)
+            self.entryField.completer().model().setStringList(sorted(names))
+
 
 def is_string(feature):
     return isinstance(feature, Orange.feature.String)