[IPython-dev] Ipython plugin for Editra
Sun Mar 1 07:22:22 CST 2009
By the way, I send you the last update of the ipython shell.
You can copy it into Ipython/gui/wx
It works better, for example to test if you load the good one, just type ‘raw_input()’ it will not freeze and will display a box(had a problem before).
I have added also an “execute in thread checkbox” to allow disabling threading is you’re not interested with ctrl+C and want matplotlib for example.(matplotlib is not compatible with threading currently)
I have to check how %run works, because all lines must be executed via self.IP.doExecute(lines_to_execute.encode(ENCODING))
Because it take care of protecting stdin/stdout (that is the main issue with using ipython0 core).
So perhaps we will have to take care of some protection before calling run magic.
De : Ronen Abravanel [mailto:firstname.lastname@example.org]
Envoyé : dimanche 1 mars 2009 11:11
À : Laurent Dufréchou
Cc : email@example.com
Objet : Re: [IPython-dev] Ipython plugin for Editra
My hack attached.
It is mostly defined at "ShellIntegrator" class at the end of the file.
The work flow I want to achieve is as following:
* in Ipython - "%edit myfile.py" or "edit 1:5" etc. Open editing buffer within the current windows, and returns without running the file.
* Selectin "Run" from the tool menu in Editra run the buffer, as it was sopused to run after closing the editor.
By the way, the plugin have some series stabilty issues.
calling '%run filename.py' for none trevial python file is cusing editra crash with:
python2.5: ../../src/xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) ((xcb_req) - (dpy->request)) >= 0)' failed.
On Sun, Mar 1, 2009 at 3:33 AM, Laurent Dufréchou <firstname.lastname@example.org> wrote:
Happy to see you’ve tried to hack the editra plugin ;)
IPyShell/__init__.py contains only the interface with editra.
I do not cleanly understand the step your are trying to do. You’ve used ” %ed” than it launched editra new source panel? And closing it executed your code, but stdin/out goes outside ipython shell?
Is that what you tried?
About the files to modify. __init__.py in editra plugn is the definition of the plugin interface and how you interact with editra.
Ipython dir is a pure copy that I was used to upload from time to time. I have to take a look at some updates that cody did. (some compatibility issue with python 2.6 and ipython tree)
The fact is that the update you’re currently trying to di will surely need some update into /gui/wx I think L. But well we’ll see.
Depending on what you’ll want to do we will perhaps expose some methods so plugin will be able to configure the things you need. (ex being able to define an editor)
(I think we can use ipython config file but I’ve never used them since then so…)
I will try to upload updated sources for python tree tomorrow, so you’ll have a bleeding edge wx integration. I’ve corrected some bugs since then.
Sure we will find a way to workaround the stdin/out issue you saw.
Send me your current hack, I’ll take a look at your issue.
De : email@example.com [mailto:firstname.lastname@example.org] De la part de Ronen Abravanel
Envoyé : samedi 28 février 2009 22:53
À : email@example.com
Objet : [IPython-dev] Ipython plugin for Editra
Editra, an extensible programmer's editor written in wxPython, contain a cool IPython plugin. This mail is a follow up for a discussion with Laurent , The author of the plugin, in his blog, continue here according to his request. The Orginal discassion can be found in http://ipython0.wordpress.com/2008/04/25/editra-ipython-plugin-under-work/ or at the end of this mail.
Using papi to set\redefine IPython's magic word partly do the job, The other part is to execute some arbitrary python code inside The ipython shell. Invoking papis "ex" method (Using papi from ipython_panel.IP._IP.getapi() ) let the Code run in IPython's context, but the output is printed to Editra's stdout (The console in wich I invoked editra's from) and not in the IPython in the shelf. My attempts to set sys.stdout to an handler from, let say, _term.cout or others, cused IPython to stack. futher more, the Exeption throws while I call ip.ex, is cought within Editra and withn IPython.
Further more - I wish to change, If I can, Only IPyShell/__init__.py and not the stuff in "IPython" dir, as it seems as a "pure" copy of IPython's orginal source (is it?)
The orginal discassion:
1. Ronen Says:
February 21, 2009 at 8:18 pm <http://ipython0.wordpress.com/2008/04/25/editra-ipython-plugin-under-work/#comment-25>
That’s a one cool Plugin.
What will make it ideal, is better integration with Editra’s Editor:
Make ipython’s %edit Open the edit-buffer in Editra’s current Windows, and Enable poeple to run The code they edit in Editra inside the open IPython windows…
Any hint where should I try to hack in order to achieve those?
2. Erreur ! Nom du fichier non spécifié.Laurent Says:
February 22, 2009 at 10:45 am <http://ipython0.wordpress.com/2008/04/25/editra-ipython-plugin-under-work/#comment-26>
You can have access to the plugin repos:
# Non-members may check out a read-only working copy anonymously over HTTP.
svn checkout http://editra-plugins.googlecode.com/svn/trunk/ editra-plugins-read-only
The plugin name is ipyshell, in it’s directory you’ve got the whole ipython source + the plugin source.
It need a little refresh for sure Erreur ! Nom du fichier non spécifié..
If you want to try to hack it take a look @Ipython/gui/wx the whole code is in ipython_view and ipshellnonblocking.
ipython_view -> gui interface
ipshellnonblocking -> the interface with ipython
You can add:
ip = IPython.ipapi.get()
def myEdit(self, arg):
print ‘do what you want’
to WxNonBlockingIPShell inside ipython_view.py
Please note that if ipython is ever installed on your system you’ll have to make a eggsetup.py develop to make sure to use your new local copy.
We can discuss about all of this in ipython-dev mailing list Erreur ! Nom du fichier non spécifié.
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 22536 bytes
Desc: not available
Url : http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20090301/2dae5edb/attachment-0001.obj
More information about the IPython-dev