Changeset 435:f58d156af5ee in orange-bioinformatics


Ignore:
Timestamp:
07/25/08 12:01:47 (6 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
287643ba253c40050e9827658dfe1c76d588eba0
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • widgets/OWDicty.py

    r434 r435  
    99 
    1010import sys 
    11          
     11 
     12class MyTreeWidgetItem(QTreeWidgetItem): 
     13    def __contains__(self, text): 
     14        return any(text.upper() in str(self.text(i)).upper() for i in range(self.columnCount()))     
     15     
    1216class OWDicty(OWWidget): 
    1317    settingsList = ["serverToken", "platform", "platformList", "experiments", "selectedExperiments", "joinSelected", "separateSelected"] 
     
    2428         
    2529        self.separateList = [n for n, long in obiDicty.DatabaseConnection.aoidPairs] 
    26         self.separateSelected = [4, 5]         
     30        self.separateSelected = [4, 5] 
    2731         
    2832        self.experiments = [] 
     
    3337        OWGUI.lineEdit(self.controlArea, self, "serverToken", box="Server Token", callback=self.Connect) 
    3438         
    35         self.joinListBox = OWGUI.listBox(self.controlArea, self, "joinSelected", "joinList", box="Join By", selectionMode=QListWidget.ExtendedSelection) 
    36         self.separateListBox = OWGUI.listBox(self.controlArea, self, "separateSelected", "separateList", box="Separate By", selectionMode=QListWidget.ExtendedSelection) 
     39        self.joinListBox = OWGUI.listBox(self.controlArea, self, "joinSelected", "joinList", box="Join By", selectionMode=QListWidget.ExtendedSelection, callback=self.UpdateJoinSelected) 
     40        self.separateListBox = OWGUI.listBox(self.controlArea, self, "separateSelected", "separateList", box="Separate By", selectionMode=QListWidget.ExtendedSelection, callback=self.UpdateJoinSelected) 
    3741        OWGUI.button(self.controlArea, self, "&Update list", callback=self.UpdateExperiments) 
     42##        box = OWGUI.widgetBox(self.controlArea, "Data") 
     43##        OWGUI.checkBox(box, self, "useCache", "Use cached data",  
    3844        OWGUI.button(self.controlArea, self, "&Commit", callback=self.Commit) 
    3945        OWGUI.rubber(self.controlArea) 
     
    5258        self.dbc = None         
    5359 
     60        self.UpdateJoinSelected()         
    5461        self.FillExperimentsWidget() 
    5562 
     
    7380        self.error(0) 
    7481 
     82    def UpdateJoinSelected(self): 
     83        for i, item in [(i, self.joinListBox.item(i)) for i in range(self.joinListBox.count())]: 
     84            self.separateListBox.item(i).setHidden(item.isSelected()) 
     85        for i, item in [(i, self.separateListBox.item(i)) for i in range(self.separateListBox.count())]: 
     86            self.joinListBox.item(i).setHidden(item.isSelected()) 
     87 
    7588    def UpdateExperiments(self): 
    7689        if not self.dbc: 
     
    91104                    for platform in platforms: 
    92105                        self.experiments.append([strain, treatment, cond, platform]) #, str(len(opt["replicate"])), str(len(opt["techReplicate"]))]) 
    93                         self.items.append(QTreeWidgetItem(self.experimentsWidget, self.experiments[-1])) 
     106                        self.items.append(MyTreeWidgetItem(self.experimentsWidget, self.experiments[-1])) 
    94107            self.progressBarSet((100.0 * i) / len(strains)) 
    95108        self.progressBarFinished() 
     
    102115        self.items = [] 
    103116        for strings in self.experiments: 
    104             self.items.append(QTreeWidgetItem(self.experimentsWidget, strings)) 
     117            self.items.append(MyTreeWidgetItem(self.experimentsWidget, strings)) 
    105118         
    106  
    107     def ShowPreview(self): 
    108         pass 
    109  
    110119    def SearchUpdate(self, string=""): 
    111120        for item in self.items: 
    112             item.setHidden(not all(s in (item.text(0) + item.text(1) + item.text(2) + item.text(3)) for s in self.searchString.split())) 
     121            item.setHidden(not all(s in item for s in self.searchString.split())) 
    113122             
    114123     
     
    123132        print "Start:", start 
    124133        for item in self.experimentsWidget.selectedItems(): 
    125 ##            print str(item.text(0)), str(item.text(1)), str(item.text(2)) 
    126134            tables = self.dbc.getData(sample=str(item.text(0)), treatment=str(item.text(1)), growthCond=str(item.text(2)), join=join, separate=separate) 
    127135            for table in tables: 
Note: See TracChangeset for help on using the changeset viewer.