remote_traits

Use traits remotely
Download

remote_traits Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Andrew Straw
  • Publisher web site:
  • http://www.visionegg.org/

remote_traits Tags


remote_traits Description

remote_traits is a very crude hack to make Enthought's Traits work in a multi-process situation. Let's say a process called Alice has a variable called camera, which is an instance of (a subclass of) HasTraits. Now, if another process called Bob wants to be notified when camera.shutter changes, this should happen using the normal Traits machinery. Furthermore, if Bob wants to change Alice's camera.shutter settings, Alice should be notified of those changes.There was a little discussion on this subject on the enthought-dev email list, with Robert Kern's idea being to use Python 2.6's multiprocess module to create Proxy objects of HasTraits subclasses which would transparently do this. I suspect such an approach would be very slick, but was beyond my one-day abilities, and I was on a deadline to get some code working.Therefore, I created a hack: both the Alice and Bob processes have full copies of the camera instance which mirror each other. For my real world usage, Alice's camera instance would be connected to something that actually does something, such as take pictures with a real camera, whereas Bob's camera instance would be connected to a GUI on a remote computer. The synchronization between the two processes happens using Pyro (Python remote objects). (The dependency on Pyro could probably be removed in favor of using multiprocess, but I was already familiar with Pyro and couldn't immediately figure out how to do the equivalent things with multiprocess.)QuickstartTo run the demo, run this in one terminal:# Start the "do" program -- Alice in the motivation abovepython wx_demo.py doAnd run this in another terminal:# Start the "view" program -- Bob in the motivation abovepython wx_demo.py viewProduct's homepage


remote_traits Related Software