Changeset 11640:1c517c9b2c3f in orange


Ignore:
Timestamp:
07/23/13 15:33:08 (9 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added 'processingState' to tracked widget state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/scheme/widgetsscheme.py

    r11639 r11640  
    113113    #:     widget's inputs 
    114114    #:   * BlockingUpdate - widget has entered a blocking state 
    115     InputUpdate, BlockingUpdate = 1, 2 
     115    #:   * ProcessingUpdate - widget has entered processing state 
     116    InputUpdate, BlockingUpdate, ProcessingUpdate = 1, 2, 4 
    116117 
    117118    def __init__(self, parent): 
     
    263264        node.title_changed.connect(widget.setCaption) 
    264265 
    265         # Bind widgets progress/processing state back to the node's properties 
     266        # Widget's info/warning/error messages. 
     267        widget.widgetStateChanged.connect(self.__on_widget_state_changed) 
     268 
     269        # Widget's progress bar value state. 
    266270        widget.progressBarValueChanged.connect(node.set_progress) 
    267         widget.processingStateChanged.connect(node.set_processing_state) 
    268         widget.widgetStateChanged.connect(self.__on_widget_state_changed) 
     271 
     272        # Widget processing state (progressBarInit/Finished) 
     273        # and the blocking state. 
     274        widget.processingStateChanged.connect( 
     275            self.__on_processing_state_changed 
     276        ) 
    269277        self.connect(widget, 
    270278                     SIGNAL("blockingStateChanged(bool)"), 
     
    370378            node.set_state_message(message) 
    371379 
     380    def __on_processing_state_changed(self, state): 
     381        """ 
     382        A widget processing state has changed (progressBarInit/Finished) 
     383        """ 
     384        widget = self.sender() 
     385        try: 
     386            node = self.node_for_widget(widget) 
     387        except KeyError: 
     388            return 
     389 
     390        if state: 
     391            self.__widget_processing_state[widget] |= self.ProcessingUpdate 
     392        else: 
     393            self.__widget_processing_state[widget] &= ~self.ProcessingUpdate 
     394        self.__update_node_processing_state(node) 
     395 
    372396    def __on_processing_started(self, node): 
    373397        """ 
Note: See TracChangeset for help on using the changeset viewer.