1
2
3
4
5
6
7
8
9
10
11
12 """
13 Python Remote Objects support.
14
15 Use this class if you don't want to deal with TCP directly and Python
16 is the program on both ends of the network.
17
18 The module provides some Vision Egg specific code for Pyro. Pyro
19 allows you to call python objects on remote machines just like they
20 are on the local machine. This makes the task of writing a two
21 computer Vision Egg application quite easy, because one can mostly
22 ignore the network-based intermediate stage.
23
24 PyroControllers are run on the computer performing the presentation.
25 The PyroServer class also runs on this computer, and allows these
26 controllers to be changed from a computer running PyroClient. To
27 listen to the network PyroListenerController must be instantiated by
28 the PyroServer -- this checks for any requests coming over the
29 network, but only at times specified because it is a subclass of
30 VisionEgg.FlowControl.Controller.
31
32 Just like TCPControllers, don't use this class for realtime control
33 unless you think your network is that fast and reliable. It's great
34 for setting up parameters in advance and sending a trigger pulse,
35 though!"""
36
37 import VisionEgg
38 import VisionEgg.Core
39 import VisionEgg.FlowControl
40 import VisionEgg.ParameterTypes as ve_types
41
42 __version__ = VisionEgg.release_name
43 __cvs__ = '$Revision$'.split()[1]
44 __date__ = ' '.join('$Date$'.split()[1:3])
45 __author__ = 'Andrew Straw <astraw@users.sourceforge.net>'
46
47 import Pyro.core
48 import Pyro.errors
49
50 Pyro.config.PYRO_MULTITHREADED = 0
51
53 """Set up a Pyro server for your PyroControllers and PyroGoClass.
54
55 This class is analagous to VisionEgg.TCPController.TCPServer.
56
57 """
59
60 Pyro.core.initServer()
61 self.daemon = Pyro.core.Daemon()
62 self.ok_to_run = 1
63
65 return self.daemon.hostname, self.daemon.port
66
68 """Serve an object under a name"""
69 URI=self.daemon.connect(object,name)
70 return URI
71
73 if Pyro.core.constants.VERSION >= '3.2':
74 self.daemon.disconnect(object)
75 else:
76
77 del self.daemon.implementations[object.GUID()]
78 object.setDaemon(None)
79
81 if hasattr(self,'listen_controller'):
82 raise RuntimeError("Only one pyro listen controller allowed per server!")
83 self.listen_controller = PyroListenController(self)
84 return self.listen_controller
85
87 """Only use this if you don't use the PyroListenerController.
88
89 A timeout of 0 specifies return immediately."""
90 self.daemon.handleRequests(timeout)
91
96
101
106
108 """Create the instance of Controller on client, and send it to server.
109
110 This class is analagous to VisionEgg.TCPController.TCPController.
111 """
112 - def __init__(self,initial_controller=None,**kw):
115
117 """Contain several dictionary entries, set controller accordingly.
118 """
119 - def __init__(self, dict=None, key=None, **kw):
142 self.dict[key] = new_controller
143
145 """Handle connection from remote machine, control PyroControllers.
146
147 This meta controller handles a Pyro daemon, which checks the TCP
148 socket for new input and acts accordingly.
149
150 This class is analagous to VisionEgg.TCPController.SocketListenController.
151
152 """
153
164
168
172