Aleš Erjavec avatar Aleš Erjavec committed 7f7a315

Store the selected organism as a string (taxid).

Comments (0)

Files changed (1)


 class OWGeneInfo(OWWidget):
-    settingsList = ["organismIndex", "geneAttr", "useAttr", "autoCommit"]
+    settingsList = ["organismIndex", "geneAttr", "useAttr", "autoCommit",
+                    "taxid"]
     contextHandlers = {
         "": DomainContextHandler(
-            "", ["organismIndex", "geneAttr", "useAttr", "useAltSource"]
+            "", ["organismIndex", "geneAttr", "useAttr", "useAltSource",
+                 "taxid"]
         self.outputs = [("Selected Examples", ExampleTable)]
         self.organismIndex = 0
+        self.taxid = None
         self.geneAttr = 0
         self.useAttr = False
         self.autoCommit = False
         self.organismComboBox = OWGUI.comboBox(
             self.organismBox, self, "organismIndex",
-            callback=self.updateInfoItems,
+            callback=self._onSelectedOrganismChanged,
         # For now only support one alt source, with a checkbox
             [ for tax_id in self.organisms]
+        if self.taxid in self.organisms:
+            self.organismIndex = self.organisms.index(self.taxid)
         self.infoLabel.setText("No data on input\n")
         self.__initialized = True
         sys.excepthook(type(exc), exc.args, None)
         self.error(0, "Could not download the necessary files.")
+    def _onSelectedOrganismChanged(self):
+        self.taxid = self.organisms[self.organismIndex]
+        if is not None:
+            self.updateInfoItems()
     def setData(self, data=None):
         if not self.__initialized:
             taxid = data_hints.get_hint(, "taxid", "")
             if taxid in self.organisms:
                 self.organismIndex = self.organisms.index(taxid)
+                self.taxid = taxid
             self.useAttr = data_hints.get_hint(, "genesinrows",  self.useAttr)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.