From: Steve C. <ste...@ya...> - 2005-01-27 16:56:34
|
On Tue, 2005-01-25 at 22:25 -0700, Fernando Perez wrote: > In case anyone is interested, here's a lightweight, standalone (non-ipython) > GTK threaded interactive interpreter with matplotlib support. This code is > also based on the same ASPN recipe, it's basically the prototype I used to > understand that recipe when I was adding the matplotlib support to IPython. Thanks, its a good example of code.InteractiveConsole, when I saw codeop in the ASPN recipe I wondered why code.py was not used. I noticed a few small points: - GTKInterpreter says "Run a gtk mainloop() in a separate thread.", yet gtk.main() runs in the main thread, and the interpreter/console runs in a separate thread. - gtk.timeout_add() is now deprecated in favour of gobject.timeout_add() - runsource() and runcode() are synchronised using wait()/notify() so they deal with one code object at a time. If self.code_to_run is changed to a code queue (using list.append() and list.pop(0)) then the wait ()/notify() could be removed and the interpreter thread would return immediately it adds the code to self.code_to_run and not when the main thread has executed the code. > I think I sent this to John a while back so he could replace the > interactive.py shipped with matplotlib. I fully acknowledge in the header the > ASPN recipe as the origin of the threading solution. John, this looks like an much improved interactive.py, is it OK to use it to replace interactive.py in cvs, and if so should the '-pylab' option be left as it is or removed to be compatible with the current interactive.py? Steve |