Re: ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread Terry Brown
On Thu, 20 Apr 2017 17:24:19 -0500
"Edward K. Ream"  wrote:

> On Thu, Apr 20, 2017 at 11:31 AM, Kent Tenney 
> wrote:
> 
> > possibly logging would help?
> > https://pypi.python.org/pypi/devpy
> >
> 
> ​I doubt it. The solution, imo, is to use pudb (linux) or winpdb
> (windows). I got sidetracked with other issues.  I'll attempt one or
> the other working now...

In linux at least there are plenty of ways of separating the trace
output from the screen output.  As Kent points out, you could use
logging to log to a file, and then to tail -f on the file in a
different terminal, separating tty display and logging completely.
Maybe you don't even need logging, just points g.* outputs at a file
rather than sys.stderr would do it.

Cheers -Terry

-- 
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 https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Why I prefer Windows, for now

2017-04-20 Thread Edward K. Ream
On Wed, Apr 19, 2017 at 12:27 PM, Mike Hodson  wrote:

> I'm going to be probably the first to recommend something​ other than
> ubuntu: Sabayon.
>

​Thanks.  I'll take a look at it.  Maybe even at the sprint.

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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread Edward K. Ream
On Thu, Apr 20, 2017 at 11:31 AM, Kent Tenney  wrote:

> possibly logging would help?
> https://pypi.python.org/pypi/devpy
>

​I doubt it. The solution, imo, is to use pudb (linux) or winpdb (windows).
I got sidetracked with other issues.  I'll attempt one or the other working
now...

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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Linux Leo on windows

2017-04-20 Thread Edward K. Ream
On Thu, Apr 20, 2017 at 3:17 PM, john lunzer  wrote:

> What is the value in running the "linux version" of Leo in windows with
> emulated X11 server?
>
> An easy way to get going on Windows is by installing anaconda. It will
> install everything you need to run Leo from the anaconda command prompt. If
> you're worried about how bloaty anaconda is you can install miniconda and
> then install PyQt manually from the conda package manager.
>
> I don't understand what benefit there could be to running it non-natively.
>

​Neither do I.  Leo runs extremely well on Windows.

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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Linux Leo on windows

2017-04-20 Thread john lunzer
What is the value in running the "linux version" of Leo in windows with 
emulated X11 server?

An easy way to get going on Windows is by installing anaconda. It will 
install everything you need to run Leo from the anaconda command prompt. If 
you're worried about how bloaty anaconda is you can install miniconda and 
then install PyQt manually from the conda package manager. 

I don't understand what benefit there could be to running it non-natively.

On Thursday, April 20, 2017 at 2:39:36 PM UTC-4, Eric S. Johansson wrote:
>
> Okay, the title was click bait. :-)
>
> Running Leo on Windows has been frustratingly inefficient. For some 
> reason, I keep breaking things, fixing things, and then breaking them 
> again. I just got fed up. So this is what I am currently trying:
>
> Installed bash on Windows 10 Creators update[1]. --> Instructions 
> 
> Buy Xming[2] ---> Xming 
> add "export DISPLAY="localhost:0.0" to the end of .bashrc
> test the X11 in connection by running some kind of X11 app like a terminal 
> emulator or Emacs
> update 
> install python-qt4/5 and any other packages you may need[3]
> Copy Leo from git repository
> update path to include the leo git repository path
> test Leo "python launchLeo.py"[4]
>
> The only thing I would suggest is putting in a soft link to where ever in 
> the Windows file system you want to store your code. The reason I do this 
> is because when I backup, I backup from the window side. However, having 
> said, depending on how well bash in windows works, I may backup my Windows 
> file system from the bash environment.
>
> For me, a big problem is finding stuff that works well with speech 
> recognition. In this case, it's kind of - sort of ok. I'm having problems 
> with Xming but it probably won't interfere with the rest of you.
>
> [1] I highly recommend installing the creators update because then the 
> bash on Windows environment is based on 16.04.
> [2] the free version may work. I went for the paid version because I felt 
> it was important to support the project.
> [3] for example, I installed the gnome-terminal just because I like it 
> better
> [4] yes I'm still using Python 2.7 because I was getting a plug in error 
> with Python 3. Didn't bother to chase down, I just wanted something that 
> worked.
>
>

-- 
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 https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Linux Leo on windows

2017-04-20 Thread Eric S. Johansson
Okay, the title was click bait. :-)

Running Leo on Windows has been frustratingly inefficient. For some reason, 
I keep breaking things, fixing things, and then breaking them again. I just 
got fed up. So this is what I am currently trying:

Installed bash on Windows 10 Creators update[1]. --> Instructions 

Buy Xming[2] ---> Xming 
add "export DISPLAY="localhost:0.0" to the end of .bashrc
test the X11 in connection by running some kind of X11 app like a terminal 
emulator or Emacs
update 
install python-qt4/5 and any other packages you may need[3]
Copy Leo from git repository
update path to include the leo git repository path
test Leo "python launchLeo.py"[4]

The only thing I would suggest is putting in a soft link to where ever in 
the Windows file system you want to store your code. The reason I do this 
is because when I backup, I backup from the window side. However, having 
said, depending on how well bash in windows works, I may backup my Windows 
file system from the bash environment.

For me, a big problem is finding stuff that works well with speech 
recognition. In this case, it's kind of - sort of ok. I'm having problems 
with Xming but it probably won't interfere with the rest of you.

[1] I highly recommend installing the creators update because then the bash 
on Windows environment is based on 16.04.
[2] the free version may work. I went for the paid version because I felt 
it was important to support the project.
[3] for example, I installed the gnome-terminal just because I like it 
better
[4] yes I'm still using Python 2.7 because I was getting a plug in error 
with Python 3. Didn't bother to chase down, I just wanted something that 
worked.

-- 
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 https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread Kent Tenney
possibly logging would help?
https://pypi.python.org/pypi/devpy

provides logging with one line of code, maybe the useful message gets
logged before the terminal is lost ...

On Thu, Apr 20, 2017 at 10:38 AM, Edward K. Ream 
wrote:

> On Thu, Apr 20, 2017 at 8:12 AM, john lunzer  wrote:
>
> I realize you're doing this as an exercise but if you're getting
>> frustrated with npyscreen (I also think the docs are a little sparse) there
>> is always urwid, which I think has much better documentation. It's also got
>> all the widgets necessary for Leo.
>>
>
> ​Thanks for the reminder. Now would be a good time to investigate urwid.
>
> I'm having trouble getting control of npyscreen keystrokes in a useful
> way. The biggest challenge is debugging. Both prints (sys.stdout.write) and
> g.pdb scroll the npyscreen stuff off the console!
>
> 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.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://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 https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread Edward K. Ream
On Thu, Apr 20, 2017 at 8:12 AM, john lunzer  wrote:

I realize you're doing this as an exercise but if you're getting frustrated
> with npyscreen (I also think the docs are a little sparse) there is always
> urwid, which I think has much better documentation. It's also got all the
> widgets necessary for Leo.
>

​Thanks for the reminder. Now would be a good time to investigate urwid.

I'm having trouble getting control of npyscreen keystrokes in a useful way.
The biggest challenge is debugging. Both prints (sys.stdout.write) and
g.pdb scroll the npyscreen stuff off the console!

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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread john lunzer
I realize you're doing this as an exercise but if you're getting frustrated 
with npyscreen (I also think the docs are a little sparse) there is always 
urwid, which I think has much better documentation. It's also got all the 
widgets necessary for Leo.

Also, again, a good example of a full screen application which has a layout 
somewhat similar to what you'd expect in Leo is *pudb*. It's got a tree 
widget which lists variables and a code widget which shows source code. 
It's also got a list widget that lists the frame stack.

I've mentioned it before but there is also a full fledged code editor name 
xo (exofrills) which is also written in urwid.

My plan, when I magically found time, was to study both pudb and xo, 
because I think between the two there is enough there to put together a 
full fledged Leo curses GUI.

On Thursday, April 20, 2017 at 8:46:27 AM UTC-4, Edward K. Ream wrote:
>
> On Thursday, April 20, 2017 at 6:21:05 AM UTC-5, Edward K. Ream wrote:
>
> Remember, to run the app, use the --gui=curses command-line option. To 
>> quit the app, click on the ok button in the lower right corner, then hit 
>> return.
>>
>
> Also, when not editing, tab moves between widgets, and shift-tab moves in 
> the opposite direction.
>
> The npyscreen docs are weak.  Reading the code (or trial and error) is 
> more helpful.
>
> 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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread Edward K. Ream
On Thursday, April 20, 2017 at 6:21:05 AM UTC-5, Edward K. Ream wrote:

Remember, to run the app, use the --gui=curses command-line option. To quit 
> the app, click on the ok button in the lower right corner, then hit return.
>

Also, when not editing, tab moves between widgets, and shift-tab moves in 
the opposite direction.

The npyscreen docs are weak.  Reading the code (or trial and error) is more 
helpful.

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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread Edward K. Ream
On Thursday, April 20, 2017 at 6:21:05 AM UTC-5, Edward K. Ream wrote:
>
>
> Rev e1e4e48 completes part A using an npyscreen.NPSApp class and 
> associated MultiLineEditableBoxed widget. It looks like npyscreen has what 
> we need, including a tree widget.
>

One more improvement: the various __getattr__ methods now use both g.trace 
and g.es, so that their output is retained in the curses log widget after 
the original console's contents is overwritten.

On to part B!

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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread Edward K. Ream
On Thursday, April 20, 2017 at 3:26:31 AM UTC-5, Edward K. Ream wrote:

2. The cursesGui ctor set self.consoleOnly = True, which tells g.trace to 
> use print immediately for traces instead of queuing up traces for Leo's log 
> window.  Today's work will start with making things work when 
> g.app.gui.consoleOnly is False. This will queue traces for later.
>

Done at 243740. Notes:

1. Leo does *not* queue g.trace messages. Leo only queues log messages.
2. It was useful *not* to define a __getattr__ method in the CursesLog 
class.  This ensured quick tracebacks.
3. The CursesLog class is *not* a subclass of the LeoLog class, at least 
for now. Only two methods were copied from LeoLog.
4. CG.runMainLoop just calls sys.exit().  It is only a test of the 
CursesLog class.

So now we have gone as far as we can without a curses log widget.  There 
are two parts left of this phase of the prototype:

Part A.  Implement a curses log widget and re-enable curses in 
CG.runMainLoop.
Part B.  Call k.masterKeyHandler to handle keystrokes.

Each part will like take an hour or three.

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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


ENB: Curses prototype: phase 2 design and process

2017-04-20 Thread Edward K. Ream
This post discuss the next phase of curses gui prototype. This is an 
Engineering Notebook post, of interest only to devs.

This second phase is a crucial intermediate step. It should be doable in a 
few hours.



*Phase 1 summary*1. cursesGui2.py contains three functional classes 
CursesGui, CursesFrame and CursesMenu, and one disabled class, CursesLog.

2. The cursesGui ctor set self.consoleOnly = True, which tells g.trace to 
use print immediately for traces instead of queuing up traces for Leo's log 
window.  Today's work will start with making things work when 
g.app.gui.consoleOnly is False. This will queue traces for later.

2. GG.runMainLoop is just barely functional:

def runMainLoop(self):
'''The curses gui main loop.'''
w = curses.initscr()
w.addstr('enter characters: x quits')
while 1:
i = w.getch() # Returns an int.
ch = chr(i)
if ch == 'x': break
sys.exit(0)

The call to curses.initscr() erases the entire console, including all 
traces generated by g.trace.

*Phase 2 design and process*

1. CG.runMainLoop should implement Leo's log pane in a (scrollable?) curses 
text widget of some kind. The initial contents of this widget will be the 
queued log messages generated during startup. This step will enable and 
revise the CursesLog class, which is presently commented out. This class 
started life as a copy of the LeoQtLog class.

2. CG.runMainLoop should translate key w.getch key codes to LeoKeyEvent 
objects and call c.k.masterKeyHandler, where c is the first loaded 
outline.  I'm guessing c will be available as g.app.log.c.  In effect, this 
step rewrites LeoQtEventFilter.

And that's it.  The only knowledge needed was/will be:

A. Remembering yesterday's consoleOnly workaround.
B. Knowing that we need to rewrite the keystroke portion LeoQtEventFilter 
so it calls k.masterKeyHandler.
C. Knowing that the LoadManager class is the proper place to start 
single-stepping through code to see why log messages get eaten, as they 
will when g.app.gui.consoleOnly gets set back to False :-)

*Summary*

Phase two of the curses prototype is a crucial intermediate step.  It will 
capture all log messages in a curses text widget so that they aren't lost 
after calling curses.initscr(). More importantly, CG.runMainLoop will call 
k.masterKeyHandler.  *This will allow Leo to execute commands*. We will see 
the effects of those commands *only *via enabled traces, but *those traces 
will show up in the new curses log widget*.

I expect to finish phase two today. It should be straightforward, provided 
a proper curses text widget can be found. I am hoping that npyscreen 
widgets will suffice. We 
shall see...

The third and final phase of this project will be to implement most of 
Leo's gui elements using curses/npyscreen widgets. Leo's menu, icon bar and 
status areas are optional, as are most subsidiary tabs of the log widget. 
This last phase is still a big deal. It remains to be seen how useful 
npyscreen will be.

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.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.