Changeset 11101:e5aa7c1c5b23 in orange


Ignore:
Timestamp:
10/05/12 15:11:37 (19 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added scheme package, containing the scheme graph workflow data structure/model.

Location:
Orange
Files:
14 added
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/OWBaseWidget.py

    r10651 r11101  
    330330    def resizeEvent(self, ev): 
    331331        QDialog.resizeEvent(self, ev) 
    332         if self.savePosition: 
     332        # Don't store geometry if the widget is not visible 
     333        # (the widget receives the resizeEvent before showEvent and we must not 
     334        # overwrite the the savedGeometry before then) 
     335        if self.savePosition and self.isVisible(): 
    333336            self.widgetWidth = self.width() 
    334337            self.widgetHeight = self.height() 
     
    718721        self.needProcessing = 1 
    719722 
    720  
    721723    # ############################################ 
    722724    # PROGRESS BAR FUNCTIONS 
     725 
     726    progressBarValueChanged = pyqtSignal(float) 
     727    """Progress bar value has changed""" 
     728 
     729    processingStateChanged = pyqtSignal(int) 
     730    """Processing state has changed""" 
     731 
    723732    def progressBarInit(self): 
    724733        self.progressBarValue = 0 
     
    727736        if self.progressBarHandler: 
    728737            self.progressBarHandler(self, 0) 
     738        self.processingStateChanged.emit(1) 
    729739 
    730740    def progressBarSet(self, value): 
    731741        if value > 0: 
    732             self.progressBarValue = value 
     742            self.__progressBarValue = value 
    733743            usedTime = max(1, time.time() - self.startTime) 
    734             totalTime = (100.0*usedTime)/float(value) 
     744            totalTime = (100.0 * usedTime) / float(value) 
    735745            remainingTime = max(0, totalTime - usedTime) 
    736             h = int(remainingTime/3600) 
    737             min = int((remainingTime - h*3600)/60) 
    738             sec = int(remainingTime - h*3600 - min*60) 
    739             if h > 0: text = "%(h)d:%(min)02d:%(sec)02d" % vars() 
    740             else:     text = "%(min)d:%(sec)02d" % vars() 
     746            h = int(remainingTime / 3600) 
     747            min = int((remainingTime - h * 3600) / 60) 
     748            sec = int(remainingTime - h * 3600 - min * 60) 
     749            if h > 0: 
     750                text = "%(h)d:%(min)02d:%(sec)02d" % vars() 
     751            else: 
     752                text = "%(min)d:%(sec)02d" % vars() 
    741753            self.setWindowTitle(self.captionTitle + " (%(value).2f%% complete, remaining time: %(text)s)" % vars()) 
    742754        else: 
    743             self.setWindowTitle(self.captionTitle + " (0% complete)" ) 
    744         if self.progressBarHandler: self.progressBarHandler(self, value) 
     755            self.setWindowTitle(self.captionTitle + " (0% complete)") 
     756        if self.progressBarHandler: 
     757            self.progressBarHandler(self, value) 
     758 
     759        self.progressBarValueChanged.emit(value) 
     760 
    745761        qApp.processEvents() 
    746762 
     763    def progressBarValue(self): 
     764        return self.__progressBarValue 
     765 
     766    progressBarValue = pyqtProperty(float, fset=progressBarSet, 
     767                                    fget=progressBarValue) 
     768 
    747769    def progressBarAdvance(self, value): 
    748         self.progressBarSet(self.progressBarValue+value) 
     770        self.progressBarSet(self.progressBarValue + value) 
    749771 
    750772    def progressBarFinished(self): 
    751773        self.setWindowTitle(self.captionTitle) 
    752         if self.progressBarHandler: self.progressBarHandler(self, 101) 
     774        if self.progressBarHandler: 
     775            self.progressBarHandler(self, 101) 
     776        self.processingStateChanged.emit(0) 
    753777 
    754778    # handler must be a function, that receives 2 arguments. First is the widget instance, the second is the value between -1 and 101 
Note: See TracChangeset for help on using the changeset viewer.