[SciPy-dev] gui_thread and chaco under Linux
Prabhu Ramachandran
prabhu at aero.iitm.ernet.in
Wed Oct 8 13:49:05 EDT 2003
>>>>> "PP" == Pearu Peterson <pearu at scipy.org> writes:
[snip]
>> wrapped_class = gui_thread.register(some_wx_python_class)
>>
>> Then you create wrapped_class instances as you would create
>> some_wx_python_class and it should work (in theory).
PP> This will not work for chaco anymore because chaco executes
PP> wxPython functions during chaco.wxplt import.
OK. :(
>> I can't test this because I cannot run chaco anymore. kiva no
>> longer builds under gcc 2.95.4. :(
PP> Yes. In fact, this triggered me to upgrade gcc on my debian
PP> system. It turned out to be quite painless, now I have
PP> gcc-2.95 gcc-3.2 gcc-3.3
PP> nicely co-existing on my system. You could try the same ^K
PP> ;-)
Well, I'm running Woody (stable) so all I have is gcc-3.0 which I've
heard has bugs. testing and unstable are too unstable for me at the
moment.
>> Admittedly, the gui_thread approach is a hack and has
>> limitations but it used to work pretty OK. Eric was talking
>> about a better approach that IIRC is similar to your approach
>> (1). As you notice its a non-trivial job and AFAIK no one has
>> yet had a stab at it.
PP> I took this challenge and here are intermediate results:
>>>> from parallel_exec import ParallelExec pexec=ParallelExec() #
[snip]
>>>> app.shutdown()
PP> that is, I can already use chaco from my Linux prompt! And I
PP> have made no changes to chaco for that. The next step is to
PP> make
Nice. This looks to be similar to the code written for Gtk by
someone. IIRC it was available on ASPN.
>>>> from chaco.wxplt import * plot([1,2])
PP> safe...
I'd think you'd need to modify or wrap around wxPython itself to get
this to work that transparently or you'd need to do something similar
to gui_thread.
Actually it looks like this could be easy to hack into wxPython. Most
of wxPython's work is done inside of a call to apply. So if we
quietly replace apply inside wxPython's namespace with a massaged
apply that calls the real apply in the right thread, I think we should
be all set. This is a hack but if its this easy I guess Robin could
be convinced to add cleaner support for it.
orig_apply = apply
def apply(o, *args, **kwargs):
pexec('orig_apply(o, *args, **kwargs)')
I don't know if this will work with pexec the way its implemented
currently but I think you get what I'm trying to say here.
cheers,
prabhu
More information about the SciPy-Dev
mailing list