connectors/PYRO/__init__.py
changeset 923 6ef6e0b3a908
parent 917 401e44bae7c0
child 969 1950fe687dde
equal deleted inserted replaced
922:60fafd828a30 923:6ef6e0b3a908
    86                 return default
    86                 return default
    87         return catcher_func
    87         return catcher_func
    88 
    88 
    89     # Check connection is effective. 
    89     # Check connection is effective. 
    90     # lambda is for getattr of GetPLCstatus to happen inside catcher
    90     # lambda is for getattr of GetPLCstatus to happen inside catcher
    91     if PyroCatcher(lambda:RemotePLCObjectProxy.GetPLCstatus())() == None:
    91     if PyroCatcher(lambda:RemotePLCObjectProxy.GetPLCstatus())() is None:
    92         confnodesroot.logger.write_error(_("Cannot get PLC status - connection failed.\n"))
    92         confnodesroot.logger.write_error(_("Cannot get PLC status - connection failed.\n"))
    93         return None
    93         return None
    94 
    94 
    95 
    95 
    96     class PyroProxyProxy:
    96     class PyroProxyProxy:
   142             return self.RemotePLCObjectProxyCopy.GetTraceVariables()
   142             return self.RemotePLCObjectProxyCopy.GetTraceVariables()
   143         GetTraceVariables = PyroCatcher(_PyroGetTraceVariables,("Broken",None,None))
   143         GetTraceVariables = PyroCatcher(_PyroGetTraceVariables,("Broken",None,None))
   144 
   144 
   145         def _PyroGetPLCstatus(self):
   145         def _PyroGetPLCstatus(self):
   146             return RemotePLCObjectProxy.GetPLCstatus()
   146             return RemotePLCObjectProxy.GetPLCstatus()
   147         GetPLCstatus = PyroCatcher(_PyroGetPLCstatus, ("Broken",-1))
   147         GetPLCstatus = PyroCatcher(_PyroGetPLCstatus, ("Broken",None))
   148 
   148 
   149         def _PyroRemoteExec(self, script, **kwargs):
   149         def _PyroRemoteExec(self, script, **kwargs):
   150             return RemotePLCObjectProxy.RemoteExec(script, **kwargs)
   150             return RemotePLCObjectProxy.RemoteExec(script, **kwargs)
   151         RemoteExec = PyroCatcher(_PyroRemoteExec, (-1, "RemoteExec script failed!"))
   151         RemoteExec = PyroCatcher(_PyroRemoteExec, (-1, "RemoteExec script failed!"))
   152 
   152