#NEWLINE# def _set_machine_var( self , name , value ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# prev_value = self . machine_vars [ name ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# prev_value = None #NEWLINE# #UNINDENT# self . machine_vars [ name ] = value #NEWLINE# try : #NEWLINE# #INDENT# change = ( value - prev_value ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# if ( prev_value != value ) : #NEWLINE# #INDENT# change = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# change = False #NEWLINE# #UNINDENT# #UNINDENT# if change : #NEWLINE# #INDENT# self . log . debug ( "Setting machine_var '%s' to: %s, (prior: %s, change: %s)" , name , value , prev_value , change ) #NEWLINE# self . events . post ( ( 'machine_var_' + name ) , value = value , prev_value = prev_value , change = change ) #NEWLINE# #UNINDENT# if self . machine_var_monitor : #NEWLINE# #INDENT# for callback in self . monitors [ 'machine_var' ] : #NEWLINE# #INDENT# callback ( name = name , value = self . vars [ name ] , prev_value = prev_value , change = name )