def __setattr__(self, name, value): #--------------------------------------------------------------------------------- # # purpose: '__setattr__' is called on every assignment to an instance attribute. # Consequently, it must put the value in through the __dict__ to avoid # calling itself and setting up an infinite recursion loop.It sets the # attribute called name to value in two steps. # One -- set the global C code control parameter # Two -- set the instance self data control parameter # # usage: x.name = value # # passed : name and value # # returned: None # #--------------------------------------------------------------------------------- names = Shgrid.parameterNames(self) names = names[2:] if name in names: shgridmodule.shseti(name, value) self.__dict__[name] = value else: self.__dict__[name] = value return None
def setInstanceParameters(self): #--------------------------------------------------------------------------- # # purpose: set the instance values of the current shgrid control parameters in c code # # usage: r.setInstanceParameters() # # where r is an instance of Shgrid # # passed: self # # returned: None # #---------------------------------------------------------------------------- names = Shgrid.parameterNames(self) names = names[2:] for name in names: shgridmodule.shseti(name, eval('self.' + name)) return None