On 5/1/2015 9:29 AM, Edward K. Ream wrote:
On Tuesday, April 28, 2015 at 2:06:56 PM UTC-5, Jacob Peck wrote:

> Rev d30c0993f8 includes a new plugin, python_terminal.py, that adds an interactive python session to your log pane.

This is very cool.  A few comments:

1. The code is based on Python's code module in the standard library. The code there is about the same magnitude as the code in the plugin, so the entire project is smallish.

And indeed, largely ripped off from the stackexchange thread mentioned in the plugin's source ;-)

2. It's off putting not to have a blinking cursor when the pane has focus. It's possible that Leo's focus-handling is to blame. Jake, have you looked into this? I would rate this the most important improvement.

This is my highest priority when I get back to picking at it. It's on my list. I do think it has something to do with Leo's focus-handling, or perhaps the Qt stylesheet. *shrug*
3. > The console swallows stdout and stderr while focused, but properly resets it to the default values when unfocused.

Misleading. Both stdout and stderr are redirected to the interactive pane, as can easily be verified. Moreover, sys.__stdout__ and sys.__stderr__ are available should scripts need them.

Truth. I misused 'console' there. In that sentence, I meant 'the new interactive console pane' rather than 'the normal command-line console'. This should be fixed -- I'll push an update soon.

Also, thanks for the hint on __stdout__ and __stderr__... Currently the plugin reassigns sys.stdout and sys.stderr to the values stored in g.user_dict['old_stdout'] and g.user_dict['old_stderr'] respectively, whenever it loses focus. 99% of the time, these will likely be the same values as sys.__stdout__ and sys.__stderr__, unless the user has some specific configuration in place that sets stdout and stderr to something else before the python_terminal plugin loads.

It should be noted in the docstring that sys.__stdout__ and sys.__stderr__ can be used inside the interactive pane to print to the proper CLI-console. I'll add this as well.
4. The history stuff is quite useful. It would be easy to update Leo's minibuffer history. c.nodeHistory is an instance of the NodeHistory class defined in leoCommands.py.

Hmm, but the minibuffer lacks the ability to execute python code directly, no? This !hist stores executable lines of python, not Leo minibuffer commands. I'm failing to see the connection here :-/
5. The open-python-window command is much less useful than this plugin.

...I didn't even know that command existed!
Thanks, Jake, for this work.  It is intriguing.

It's strange how I hacked that together in an afternoon. I'd been toying with the idea for about a year, but every time I hit a roadblock... then I found the Stackexchange code and it all just fit easily!

-->Jake
Edward
--
You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com <mailto:leo-editor+unsubscr...@googlegroups.com>. To post to this group, send email to leo-editor@googlegroups.com <mailto:leo-editor@googlegroups.com>.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to