#NEWLINE# def _set_busy( self , value ) : #NEWLINE# #INDENT# 'The `busy` trait is either `True` or `False`.  However,\n        this could be problematic since we could have two methods\n        `foo` and `bar that both set `scene.busy = True`.  As soon as\n        `bar` is done it sets `busy` back to `False`.  This is wrong\n        since the UI is still busy as `foo` is not done yet.  We\n        therefore store the number of busy calls and either increment\n        it or decrement it and change the state back to `False` only\n        when the count is zero.\n        ' #NEWLINE# bc = self . _busy_count #NEWLINE# if value : #NEWLINE# #INDENT# bc += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# bc -= 1 #NEWLINE# bc = max ( 0 , bc ) #NEWLINE# #UNINDENT# self . _busy_count = bc #NEWLINE# if ( bc == 1 ) : #NEWLINE# #INDENT# self . trait_property_changed ( 'busy' , False , True ) #NEWLINE# #UNINDENT# if ( bc == 0 ) : #NEWLINE# #INDENT# self . trait_property_changed ( 'busy' , True , False )