Exemplo n.º 1
0
 def event_loop(self):
     while True:
         try:
             weak_method(self.loop_event)()
         except ReferenceError:
             return
     self.status = 1
Exemplo n.º 2
0
 def open(self, address):
     """Open the socket on the given address"""
     from cothread.cosocket import socket as cosocket
     import socket
     from ws4py.client import WebSocketBaseClient
     _socket = socket.socket
     socket.socket = cosocket
     self.sock = WebSocketBaseClient(address)
     self.sock.handshake_ok = lambda: None
     socket.socket = _socket
     self.sock.received_message = weak_method(self.received_message)
     self.sock.connect()
Exemplo n.º 3
0
 def __init__(self, name, single=False, timeout=None):
     # TODO: add single step
     super(DummyDet, self).__init__(name, timeout=timeout)
     self.single = single
     # Add the attributes
     self.add_attributes(
         nframes=Attribute(int, "Number of frames"),
         exposure=Attribute(float, "Detector exposure"),
     )
     self.sim = DummyDetSim(name + "Sim")
     self.sim.add_listener(weak_method(self.on_status))
     self.add_loop(self.sim)
     self.sim_post = self.sim.post
Exemplo n.º 4
0
 def __init__(self, outs):
     self.outs = outs
     self.i = 0
     self.stop_requested = cothread.Event(auto_reset=False)
     self.proc = cothread.Spawn(weak_method(self.event_loop))
     self.status = 0