Changeset 7787:4d93766ca002 in orange


Ignore:
Timestamp:
03/30/11 17:12:09 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
2e3b09bbe21a92c1c8453b26d89d511e0d01c2e0
Message:

Added progress bar for optimization dialog.
Fixed a bug when setting the optimized list back into the main widget.
Fixed a GUI element ordering in the Optimization box.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Visualize/OWParallelCoordinates.py

    r7039 r7787  
    321321        self.resultList = OWGUI.listBox(self.resultsBox, self) 
    322322        self.resultList.setMinimumSize(200,200) 
    323         self.connect(self.resultList, SIGNAL("selectionChanged()"), self.showSelectedAttributes) 
     323        self.connect(self.resultList, SIGNAL("itemSelectionChanged()"), self.showSelectedAttributes) 
    324324 
    325325        # remove non-existing files 
     
    349349        self.connect(self.allAttributesRadio, SIGNAL("clicked()"), self.setAllAttributeRadio) 
    350350        box = OWGUI.widgetBox(self.optimizeBox, orientation = "horizontal") 
    351         self.subsetAttributeRadio = QRadioButton("find subsets of      ", box) 
    352         self.optimizeBox.layout().addWidget(self.subsetAttributeRadio) 
     351        self.subsetAttributeRadio = QRadioButton("Find subsets of", box) 
     352#        self.optimizeBox.layout().addWidget(self.subsetAttributeRadio) 
     353        box.layout().addWidget(self.subsetAttributeRadio) 
    353354        self.connect(self.subsetAttributeRadio, SIGNAL("clicked()"), self.setSubsetAttributeRadio) 
    354355        self.subsetAttributeEdit = OWGUI.lineEdit(box, self, "numberOfAttributes", valueType = int) 
    355         label  = OWGUI.widgetLabel(box, "   attributes") 
     356        self.subsetAttributeEdit.setMaximumWidth(30) 
     357        label  = OWGUI.widgetLabel(box, "attributes") 
    356358 
    357359        self.startOptimizationButton = OWGUI.button(self.optimizeBox, self, "Start Optimization", callback = self.startOptimization) 
     
    403405    # return list of selected attributes 
    404406    def getSelectedAttributes(self): 
    405         if self.resultList.count() == 0: return None 
    406         return self.allResults[self.resultList.currentItem()][1] 
     407        if self.resultList.count() == 0 or self.allResults == []: 
     408            return None 
     409        return self.allResults[self.resultList.currentRow()][1] 
    407410 
    408411    # called when optimization is in progress 
     
    530533 
    531534        attrInfo = [] 
     535        self.progressBarInit() 
    532536        if self.optimizationMeasure == CORRELATION: 
    533537            attrList = [attr.name for attr in self.parallelWidget.data.domain.attributes] 
    534             attrInfo = orngVisFuncts.computeCorrelationBetweenAttributes(self.parallelWidget.data, attrList) 
     538            self.startOptimizationButton.hide() 
     539            self.stopOptimizationButton.show() 
     540            self.canOptimize = 1 
     541            class StopOptimizationException(Exception): 
     542                pass 
     543            def progressSetWithStop(value): 
     544                if not self.canContinueOptimization(): 
     545                    raise StopOptimizationException() 
     546                else: 
     547                    self.progressBarSet(value * 0.9) 
     548            try:  
     549                attrInfo = orngVisFuncts.computeCorrelationBetweenAttributes(self.parallelWidget.data, attrList, progressCallback=progressSetWithStop) 
     550            except StopOptimizationException: 
     551                attrInfo = [] 
     552                self.startOptimizationButton.show() 
     553                self.stopOptimizationButton.hide() 
     554                 
     555#            self.progressBarFinished() 
    535556            #attrInfo = orngVisFuncts.computeCorrelationInsideClassesBetweenAttributes(self.parallelWidget.data, attrList) 
    536557        elif self.optimizationMeasure == VIZRANK: 
     
    564585        self.stopOptimizationButton.hide() 
    565586        self.startOptimizationButton.show() 
     587         
     588        self.progressBarFinished() 
    566589 
    567590 
Note: See TracChangeset for help on using the changeset viewer.