Changeset 431:efa1c7172a44 in orange-bioinformatics


Ignore:
Timestamp:
07/23/08 11:55:26 (6 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
7f9028a98359a00f3aee0fca2741dae0c8bcd0f1
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • prototypes/OWDicty.py

    r430 r431  
    1414from traceback import print_exception 
    1515import sys 
    16  
    17 class ShadedItemDelegate(QItemDelegate): 
    18     def paint(self, painter, option, index): 
    19         self.drawBackground(painter, option, index) 
    20         value, ok = index.data(Qt.DisplayRole).toString() 
    21  
    22 class MyQThread(QThread): 
    23     def __init__(self, parent, func=None): 
    24         QThread.__init__(self, parent) 
    25         self.func = func 
    26          
    27     def run(self): 
    28         try: 
    29             self.returnValue = self.func() 
    30         except Exception, ex: 
    31             pass 
    32 ##            print_exception(*sys.exc_info()) 
    3316         
    3417class OWDicty(OWWidget): 
     
    4427        self.experiments = [] 
    4528        self.selectedExperiments = [] 
     29 
     30        self.searchString = "" 
    4631         
    4732        self.loadSettings() 
    4833         
    4934        OWGUI.lineEdit(self.controlArea, self, "serverToken", box="Server Token", callback=self.Connect) 
    50 ##        OWGUI.lineEdit(self.mainArea, self, "search",  
     35        OWGUI.lineEdit(self.mainArea, self, "searchString", "Search", callbackOnType=True, callback=self.SearchUpdate) 
    5136        self.experimentsWidget = QTreeWidget() 
    5237        self.experimentsWidget.setHeaderLabels(["Strain", "Treatment", "Growth condition"]) 
    5338        self.experimentsWidget.setSelectionMode(QTreeWidget.ExtendedSelection) 
    5439        self.experimentsWidget.setRootIsDecorated(False) 
     40        self.experimentsWidget.setSortingEnabled(True) 
    5541##        self.experimentsWidget.setAlternatingRowColors(True) 
    5642        self.mainArea.layout().addWidget(self.experimentsWidget) 
    5743##        OWGUI.button(self.controlArea, self, "&Preview", callback=self.ShowPreview) 
    58         OWGUI.button(self.controlArea, self, "&Update", callback=self.UpdateExperiments) 
     44        OWGUI.button(self.controlArea, self, "&Update list", callback=self.UpdateExperiments) 
    5945        OWGUI.button(self.controlArea, self, "&Commit", callback=self.Commit) 
    6046        OWGUI.rubber(self.controlArea) 
     
    8874        self.experiments = [] 
    8975        self.experimentsWidget.clear() 
     76        self.items = [] 
    9077        self.progressBarInit() 
    9178        strains = self.dbc.annotationOptions(self.dbc.aoidt("sample"))["sample"] 
     
    9784                for cond in growthConds: 
    9885                    self.experiments.append([strain, treatment, cond]) 
    99                     QTreeWidgetItem(self.experimentsWidget, self.experiments[-1]) 
     86                    self.items.append(QTreeWidgetItem(self.experimentsWidget, self.experiments[-1])) 
    10087            self.progressBarSet((100.0 * i) / len(strains)) 
    10188        self.progressBarFinished() 
    10289 
    10390    def FillExperimentsWidget(self): 
     91        if not self.experiments: 
     92            self.UpdateExperiments() 
     93            return 
    10494        self.experimentsWidget.clear() 
     95        self.items = [] 
    10596        for strings in self.experiments: 
    106             QTreeWidgetItem(self.experimentsWidget, strings) 
     97            self.items.append(QTreeWidgetItem(self.experimentsWidget, strings)) 
     98         
    10799 
    108100    def ShowPreview(self): 
    109101        pass 
     102 
     103    def SearchUpdate(self, string=""): 
     104        print "s:",self.searchString 
     105        for item in self.items: 
     106            item.setHidden(not all(s in (item.text(0) + item.text(1) + item.text(2)) for s in self.searchString.split())) 
     107             
     108         
    110109 
    111110    def Commit(self): 
Note: See TracChangeset for help on using the changeset viewer.