Changeset 1888:cad892644786 in orange-bioinformatics for orangecontrib/bio/widgets/OWGEODatasets.py


Ignore:
Timestamp:
10/14/13 16:14:57 (6 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Changed progress bar updates.

The update in the loop was actually slowing things down.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orangecontrib/bio/widgets/OWGEODatasets.py

    r1874 r1888  
    304304        with orngServerFiles.DownloadProgress.setredirect(self.progressBarSet): 
    305305            self.gds_info = info = obiGEO.GDSInfo() 
    306         milestones = set(range(0, len(info), max(len(info)/100, 1))) 
     306 
    307307        self.cells = cells = [] 
    308308        gdsLinks = [] 
     
    310310        localGDS = [] 
    311311        full_text_search_data = [] 
    312          
     312        self.progressBarSet(10) 
    313313        self.gds = [] 
    314314        for i, (name, gds) in enumerate(info.items()): 
     
    323323                localGDS.append(i) 
    324324            self.gds.append(gds) 
    325              
     325 
    326326            full_text_search_data.append(unicode(" | ".join([gds.get(key, "").lower() for key in self.searchKeys]), errors="ignore")) 
    327              
    328             if i in milestones: 
    329                 self.progressBarSet(100.0*i/len(info)) 
    330  
     327 
     328        self.progressBarSet(20) 
    331329        model = TreeModel(cells, ["", "ID", "Title", "Organism", "Samples", "Features", "Genes", "Subsets", "PubMedID"], self.treeWidget) 
    332330        model.setColumnLinks(1, gdsLinks) 
    333331        model.setColumnLinks(8, pmLinks) 
    334          
     332 
    335333        for i, text in enumerate(full_text_search_data): 
    336334            model.setData(model.index(i, 0), QVariant(text), TextFilterRole) 
    337          
     335 
    338336        proxyModel = MySortFilterProxyModel(self.treeWidget) 
    339 #        proxyModel = QSortFilterProxyModel(self.treeWidget) 
    340337        proxyModel.setSourceModel(model) 
    341338        proxyModel.setFilterKeyColumn(0) 
     
    343340        proxyModel.setFilterCaseSensitivity(False) 
    344341        proxyModel.setFilterFixedString(self.filterString) 
     342 
    345343        self.treeWidget.setModel(proxyModel) 
    346344        self.connect(self.treeWidget.selectionModel(), SIGNAL("selectionChanged(QItemSelection , QItemSelection )"), self.updateSelection) 
     
    354352        filterItems = [item for item in filterItems if len(filterItems) > 3] 
    355353        self.filterLineEdit.setItems(filterItems) 
    356          
     354 
     355        self.progressBarSet(40) 
     356 
    357357        for i in range(8): 
    358358            self.treeWidget.resizeColumnToContents(i) 
     359 
     360        self.progressBarSet(70) 
     361 
    359362        self.treeWidget.setColumnWidth(1, min(self.treeWidget.columnWidth(1), 300)) 
    360363        self.treeWidget.setColumnWidth(2, min(self.treeWidget.columnWidth(2), 200)) 
     364 
    361365        self.progressBarFinished() 
    362366 
     
    367371                mapFromSource = self.treeWidget.model().mapFromSource 
    368372                self.treeWidget.selectionModel().select(mapFromSource(model.index(current[0], 0)), QItemSelectionModel.Select | QItemSelectionModel.Rows) 
    369              
     373 
    370374        self.updateInfo() 
    371375 
Note: See TracChangeset for help on using the changeset viewer.