Re: Scripting leo: Programmatic way to reference the vnode containing the script that is being executed?

2018-02-17 Thread Edward K. Ream
On Saturday, February 17, 2018 at 5:57:19 PM UTC-6, John Clark wrote:

Firstly, I can't seem to find a way to programmatically reference the vnode 
> containing the script that is being executed (or the root vnode thereof in 
> the case where the script is composed using numerous child nodes).
>

That would be p.v.  p is predefined in scripts.  Outside of scripts, say in 
Leo's commands, the answer is c.p.v, c.p being the presently selected nodes.

It is usually clear how to get c.  Within  Leo's own classes, there is 
almost always a self.c ivar.  Otherwise, say in commands, you get c this 
way:

@g.command('my-command-name')
def my_command(event):
c = event and event.get('c') 

But are you sure you want p.v instead of v?  Most code does just fine using 
positions.  You want to use p.v only when saving references to vnodes when 
the outline itself may change.

Secondly, ...I would really like...to reference the vnode containing the 
> @path directory. Specifically, I would like to be able to programmatically 
> reference the headline of the node containing the path directive to form a 
> pathspec based on the headline. E.g.
>

Given c.p, the presently selected node, you could look up the tree, looking 
for the nearest @path node:

for p in c.p.self_and_parents():
if p.h.startswith('@path '):
# p is the nearest @path node. 

But the following probably does exactly what you want:

path = g.fullPath(c, c.p)

g.fullPath is defined as follows:

def fullPath(c, p, simulate=False):
'''
Return the full path (including fileName) in effect at p. Neither the
path nor the fileName will be created if it does not exist.
'''
trace = False and not g.unitTesting
# 2016/03/30: search p and p's parents.
for p in p.self_and_parents():
aList = g.get_directives_dict_list(p)
path = c.scanAtPathDirectives(aList)
fn = p.h if simulate else p.anyAtFileNodeName()
# Use p.h for unit tests.
if fn:
# Fix #102: call commander method, not the global function.
if trace and c and c.p == p: g.trace('found', p.h)
return c.os_path_finalize_join(path, fn)
return ''

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.


Scripting leo: Programmatic way to reference the vnode containing the script that is being executed?

2018-02-17 Thread John Clark
Hi there,

I'm trying to get deeper into scripting leo and have hit upon a question I 
can't find an answer to.

Firstly, I can't seem to find a way to programmatically reference the vnode 
containing the script that is being executed (or the root vnode thereof in 
the case where the script is composed using numerous child nodes).

Secondly (and very similarly), I note 
http://leoeditor.com/directives.html#path-expressions that some handy 
tricks are available to programmatically craft @path directive pathspecs, 
but the trick I would really like (which doesn't seem available) is to be 
able to reference the vnode containing the @path directory. Specifically, I 
would like to be able to programmatically reference the headline of the 
node containing the path directive to form a pathspec based on the 
headline. E.g.

+ This is a node
  This is some body text
 + This is child A
   This is more body text
   + MyFunkyThingemy
 @path {{thisnode.h}}.unit


Is there any way to achieve (hopefully) both of the above objectives?

Thanks in advance

John

-- 
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.


Running shell commands. New: g.execute_shell_commands_with_options

2018-02-17 Thread Edward K. Ream
This will be pre-writing for an expanded and improved version of this part 

 
of Leo's scripting miscellany 
.

There are at least three ways to execute shell commands from Leo.  Which 
you choose is a matter of taste. You can use whatever way is simplest or 
clearest.  All of the following run 'npm run dev' from 
leo/proto/Vitalije/leo-el-vue.

Assume the following in each example:

import os
base_dir = g.os_path_finalize_join(g.app.loadDir, '..', 'proto', 'Vitalije', 
'leo-el-vue')

*Note*: I have not found a way of doing 'cd directory' using 
subprocess.popen on Windows 10.  Yes, this is strange.

*Call subprocess.popen directly*

This may be simplest/clearest if there are few commands to execute and the 
exact commands are known beforehand.  The following doesn't wait for 'npm 
run dev' to return, which is usually what is wanted (Leo doesn't hang).

os.chdir(base_dir)
subprocess.Popen('npm run dev', shell=True)

The following *does *wait:

os.chdir(base_dir)
proc = subprocess.Popen(command, shell=True)
proc.communicate()

*Call g.execute_shell_commands*

This function calls subprocess.popen once for every command in a list.  
This function waits for commands that start with '&'.  It doesn't do all 
that much:

def execute_shell_commands(commands, trace=False):
if g.isString(commands): commands = [commands]
for command in commands:
wait = not command.startswith('&')
if command.startswith('&'): command = command[1:].strip()
if trace: print('\n>%s%s\n' % ('' if wait else '&', command))
proc = subprocess.Popen(command, shell=True)
if wait: proc.communicate()

So the following works:

os.chdir(base_dir)
g.execute_shell_commands(['&npm run dev',])

g.execute_shell_commands might be slightly preferable to popen if there 
were several commands to run at once.

*Call g.execute_shell_commands_with_options*

This is experimental code.  All the examples above work with rev 516c9c6.

This function has arguments that allow scripts to get both the starting 
directory and the list of commands *from settings*. Its signature is:

def execute_shell_commands_with_options(
base_dir = None,
c = None,
command_setting = None,
commands = None,
path_setting = None,
warning = None,
):
'''
A helper for prototype commands or any other code that
runs programs in a separate process.

base_dir:   Base directory to use if no config path given.
commands:   A list of commands, for g.execute_shell_commands.
commands_setting:   Name of @data setting for commands.
path_setting:   Name of @string setting for the base directory.
warning:A warning to be printed before executing the 
commands.
'''

The following works:

g.execute_shell_commands_with_options(
c = c,
base_dir=base_dir,
commands = ['&npm run dev',],
command_setting = 'leo-el-vue-commands',
# @data leo-el-vue-commands
path_setting= 'leo-el-vue-base',
# @string leo-el-vue-base
)

This lets devs change a) the location of the test directory and b) the 
commands that will be executed.  For example, vitalije recommends using 
yarn instead of npm.  To do this, I only needed to put this in 
myLeoSettings.leo:

@data leo-el-vue-commands
yarn dev

The 'leo-el-vue' command itself did *not* need to change.

*Summary*

It is dead easy for scripts, including @button scripts, plugins, etc., to 
drive any external processes, including compilers and interpreters, from 
within Leo. Scripts can use subprocess.popen directly or 
g.execute_shell_commands.

The new g.execute_shell_commands_*with_options* function allows scripts to 
use settings to specify a) the directory in which to run commands, and b) 
the commands themselves. All of Leo's proto-* commands will use this 
function.

All comments, bug reports and suggestions are welcome.

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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Terry Brown
Made some changes to leoserver explained in the commit message:
https://github.com/leo-editor/leo-editor/commit/736a6a5

  eliminate jQuery.ajax() calls

  and some other changes, but that's the main difference. Using
  fetch() instead will break the client for legacy broswers like
  IE, but let's not rush to fix that, there are a number of possible
  fixes: https://www.javascriptstuff.com/ajax-libraries/ and we should
  pick one deliberately.

  I'm assuming we'll use something like Vue, rather than jQuery, for the
  UI, and Vue doesn't handle ajax, hence this change.

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: a826cf2: The proto-leo-el-vue command

2018-02-17 Thread Edward K. Ream
On Sat, Feb 17, 2018 at 1:38 PM, vitalije  wrote:

> - Doing 'npm install' works, but slows things down.
>>
>>
>> I suggest to use yarn instead of npm. You need to execute once
> npm install -g yarn
>
>  to install yarn globally and then instead of
> npm install
> # use
> yarn
>
> # and instead of running npm run  use just
> yarn 
> # for example
> yarn dev
> # or yarn build, yarn test,...
>
> Yarn installs much quicker then npm, and the rest of the functionality is
> pretty same.
>

​Thanks for this.  It has implications for user-supplied variants of
prototype commands.  I'll be working on this, and documenting it, next.

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: a826cf2: The proto-leo-el-vue command

2018-02-17 Thread vitalije

>
> - Doing 'npm install' works, but slows things down.
>
>
> I suggest to use yarn instead of npm. You need to execute once 
npm install -g yarn

 to install yarn globally and then instead of 
npm install
# use
yarn

# and instead of running npm run  use just
yarn 
# for example
yarn dev
# or yarn build, yarn test,...

Yarn installs much quicker then npm, and the rest of the functionality is 
pretty same.
Vitalije

-- 
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: a826cf2: The proto-leo-el-vue command

2018-02-17 Thread Edward K. Ream
On Sat, Feb 17, 2018 at 11:27 AM, vitalije  wrote:

> in dist folder would end up binary version of the electron desktop
> application (50+ Mb for each operating system). I guess safest would be to
> git ignore dist folder too.
>

​Thanks.  1bf2258 changes .gitignore in both your prototype folders.

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.


d4fbf6f: g.runExternalCommands

2018-02-17 Thread Edward K. Ream
This new method will be a common helper for the proto-* commands.  It will 
also be more generally useful. Here is the first draft:

def runExternalCommands(c, commands,
base_dir = None,
path_setting = None,
warning = None,
):
'''
A helper for prototype commands or any other code that
runs programs in a separate process.

base_dir:   Base directory to use if no config path given.
commands:   A string or list of commands, for 
g.execute_shell_commands.
path_setting:   Name of @string setting for the base directory.
warning:A warning to be printed before executing the commands.
'''
if not base_dir and not path_setting:
return g.es_print('Please use base_dir, path_setting or both')
if path_setting and not c:
return g.es_print('path_setting requires valid c arg')
if path_setting:
base_dir = c.config.getString(path_setting)
if base_dir:
base_dir = base_dir.replace('\\','/')
if not g.os_path_exists(base_dir):
return g.es_print('@string path-setting not found: %r' % 
base_dir)
else:
return g.es_print('setting not found: @string %s' % path_setting
)
else:
base_dir = base_dir.replace('\\','/')
if not g.os_path_exists(base_dir):
return g.es_print('base_dir not found: %r' % base_dir)
if warning:
g.es_print(warning)
os.chdir(base_dir) # Can't do this in the commands list.
g.execute_shell_commands(commands)

It could be called a thin wrapper for g.execute_shell_commands.  Its main 
feature is to allow users to specify either a base directory, or an @string 
setting giving the base directory.  It then checks the resulting directory 
and gives a warning if it doesn't exist.

This method is the easy way to run any desired program in an external 
process.

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: a826cf2: The proto-leo-el-vue command

2018-02-17 Thread vitalije
in dist folder would end up binary version of the electron desktop 
application (50+ Mb for each operating system). I guess safest would be to 
git ignore dist folder too.

On Saturday, February 17, 2018 at 4:27:34 PM UTC+1, Edward K. Ream wrote:
>
> On Saturday, February 17, 2018 at 9:24:25 AM UTC-6, Edward K. Ream wrote:
>
> Hmm. I think it is a mistake to include the dist folder in Leo's git repo. 
>>
>
> Actually, this folder contains only main.js, so it seems safe enough to 
> distribute it. Let me know if you disagree.
>
> 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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Edward K. Ream
On Saturday, February 17, 2018 at 7:14:22 AM UTC-6, Edward K. Ream wrote:

> It's not wise to add Joe's LeoVue project to the proto folder. It takes 
over 86 MB of disk space.

The proto-leo-el-vue command shows the way forward.  An @string setting 
will point to the base directory of Joe's work.  That's all it will take.  
We could use this pattern for any prototype code (or any other code) that 
lives in its own git repo.

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.


c2803b5: the 'proto-leo-server' command

2018-02-17 Thread Edward K. Ream
Here it is:

@g.command('leoserver')
@g.command('proto-leo-server')
def proto_leoserver(event):
"""
Terry's fully functional Leo web interface :-)

First announced here, in a comment to #684:

https://github.com/leo-editor/leo-editor/issues/684#issuecomment-363992724

The code is here:
https://github.com/leo-editor/leo-editor/files/1705639/leoserver.zip
"""
# c = event and event.get('c')
base = g.os_path_finalize_join(g.app.loadDir,
'..', 'proto', 'Terry', 'leoserver')
base = base.replace('\\','/')
if g.os_path_exists(base):
g.es_print('WARNING: killing the server will also kill Leo')
os.chdir(base) # Can't do this in the commands list.
g.execute_shell_commands(commands=['&python leoserver.py',])
else:
g.es_print('not found: %r' % base)

The ampersand in the commands list prevents Leo from hanging.

This rev also adds the ampersand in the proto-leo-el-vue command

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: a826cf2: The proto-leo-el-vue command

2018-02-17 Thread Edward K. Ream
On Saturday, February 17, 2018 at 9:24:25 AM UTC-6, Edward K. Ream wrote:

Hmm. I think it is a mistake to include the dist folder in Leo's git repo. 
>

Actually, this folder contains only main.js, so it seems safe enough to 
distribute it. Let me know if you disagree.

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: a826cf2: The proto-leo-el-vue command

2018-02-17 Thread Edward K. Ream

On Saturday, February 17, 2018 at 9:14:50 AM UTC-6, Edward K. Ream wrote:

> Doing 'npm install' works, but slows things down...
> We could always define an command that installs, then runs, but building 
from the console seems good enough for now.

Hmm. I think it is a mistake to include the dist folder in Leo's git repo. 
This folder should be added to the local .gitignore file. The command 
should ask the user to do 'npm install' if the folder does not exist.

That's what I plan to do next.  All comments welcome.

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.


a826cf2: The proto-leo-el-vue command

2018-02-17 Thread Edward K. Ream
This has been laughably easy.  Here is the new code, in leoPrototype.py:

@g.command('leo-el-vue')
@g.command('proto-leo-el-vue')
def leo_el_vue(event):
"""
Vitalije's electron/vue project:: Leo in CoffeeScript and Vue.

Original sources and documentation at: 
https://leoelvue.computingart.net/home
"""
# c = event and event.get('c')
base = g.os_path_finalize_join(g.app.loadDir,
'..', 'proto', 'Vitalije', 'leo-el-vue')
base = base.replace('\\','/')
commands = [
# 'npm install',
'npm run dev',
]
if g.os_path_exists(base):
os.chdir(base) # Can't do this in the commands list.
g.execute_shell_commands(commands)
else:
g.es_print('not found: %r' % base)

The takeaways:

- It's dead easy to execute code in other languages from Leo.
- The new prototype commands will allow devs to play with each others ideas.
- The docstring reminds us all where the original code came from.
- Doing 'npm install' works, but slows things down.

We could always define an command that installs, then runs, but building 
from the console seems good enough for 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.


effective collaborate with .leo for doc.?[via]Advices for Leo documentation in Chinese translated version?

2018-02-17 Thread Zoom.Quiet
2 years ago: Re: How to collaborate using Leo
https://groups.google.com/d/msg/leo-editor/Mr1cAfi8BLs/Q2PlDxsrBwAJ
discuss about  Leonard(Leo user) and Nancy(not Leo user) how to work together,
the result is :
@clean be upgraded, and support perfect auto merge from Nancy fixed
resource files.

but for the doc. translate project:
work in doc/LeoDocs.leo is the necessarily, because:

0: the target for translate doc. of Leo , just for Chinese Nancy start love Leo
1: so contributor base LeoDocs.leo is the only right start

BUT collaborate in github, there is always 2 ways:
0: like svn, usage github as one kinds of collaborate Repo., member
with Repo. ACL;
1: base DVCS , usage Fork->Pull-Request flow;

in the doc. translate project, the contributor in different level,
will produce different result:
0: member of Repo. with write ACL, can push LeoDocs.leo, and usage
Rst3 export new translate results;
1: contributor from fork Repo., if P-R  LeoDocs.leo, the member can
not decide accept or not base diff from .leo, because mix so many XML
info.

SO my question is :
how to make different roles in doc. translate project all in effective
edit action?

in my mind:
0: member of Project, work in self .leo such as LeoDocs_ZQ.leo, push
new .rst and .leo into Repo., because we all Leonard
1: contributor from fork Repo., work with .rst files,P-R only include
.rst diff info., because can not requirement  Nancy immediately became
Leonard

BUT there is some problems:
0: members .leo can not auto merge by git? or How to auto merge others
member's new translated into self .leo?
1: new translate work result if merge succeed by git from
Pull-Request, how to make Member's .leo accept them?

for now , i only think out one way:
- change the nodes in doc/LeoDocs.leo @rst --> @clean
- so whatever Nancy/Leonard's translate result will auto exchange with .rst
- in the same time, every member can keep self outlines in .leo

and is there better collaborate ways for doc. translate project?


On Thu, Feb 1, 2018 at 10:28 PM, OMlalala  wrote:
> Overview
>
> Hi, I use Leo from one month ago, very enjoy ;-)
> and I want to make chinese version Doc for spread the perfect Leo, any
> advices?
>
...

leo-editor-cn
https://github.com/DebugUself/leo-editor-cn


-- 
life is pathetic, go Pythonic! 人生苦短, Python当歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗余不做,日子甭过!备份不做,十恶不赦!
KM keep growing environment culture which promoting organization learning!

-- 
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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Edward K. Ream
On Sat, Feb 17, 2018 at 7:18 AM, Edward K. Ream wrote:

> On Saturday, February 17, 2018 at 7:10:08 AM UTC-6, vitalije wrote:
>
> Just keep in mind that these subprojects when built, install lot of
>> subfolders and files which need to be ignored by git.
>
>
​Rev 1e56cc8 creates a .gitignore file in ​

​leo\proto\Vitalije\leo-el-vue that prevents the ~300 MB node_modules
folder from being pushed.

​The cool thing is that building is a) easy and b) contained to the
leo-el-vue folder.  That is, `npm install` downloads everything needed to
the *local* folder, so no other node.js projects can possibly be affected.

The only thing not stated in the readme.md file is that the commands must
be run from the leo-el-vue folder.  We probably all can figure that out,
but I'll put a note to that effect in readme.md just to make sure.

The happy thing about the build process is that the vit-leo-el-vue command
won't have to do it ;-)

This is turning out to be far easier than I dared hope.

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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Edward K. Ream
On Sat, Feb 17, 2018 at 7:14 AM, Edward K. Ream  wrote:

Rev 0138853 of the proto branch adds Vitalije's two projects.
>

​Important: the readme.md files in these two projects contains detailed
build instructions.

We devs are debugging the process of trying out other people's code. This
is worth any amount of effort.  Mistakes and detours along the way will
teach us exactly what we need to know.

I'll be googling installation questions today, perhaps constantly ;-)

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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Edward K. Ream


On Saturday, February 17, 2018 at 7:10:08 AM UTC-6, vitalije wrote:

Just keep in mind that these subprojects when built, install lot of 
> subfolders and files which need to be ignored by git. Default gitignore is 
> designed for the situation when project folder is actually root of project.
> I am not sure that will be a problem but just be cautious not to 
> accidentally commit those files in repository.


Thanks for this heads up.  I'll keep this in mind when building them. 
Suggestions for .gitignore are welcome.

Rev 013885336 did install your two projects, but at present they contain 
less than 2MB in total, so pulling the proto branch should work for a bit 
longer ;-)

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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Edward K. Ream
On Saturday, February 17, 2018 at 6:55:40 AM UTC-6, Edward K. Ream wrote:

> I'll add subfolders under proto/Joe and proto/Vitalije soon.

Rev 0138853 of the proto branch adds Vitalije's two projects.

But now we come to two problems:

1. It's not wise to add Joe's LeoVue project to the proto folder. It takes 
over 86 MB of disk space.

2. Copying code to leo/proto means that it won't be updated if the authors 
update their code elsewhere.  This is particularly true for the LeoVue 
project because it is under active development.

I'm going to ignore these problems temporarily.

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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread vitalije
Just keep in mind that these subprojects when built, install lot of subfolders 
and files which need to be ignored by git. Default gitignore is designed for 
the situation when project folder is actually root of project.
I am not sure that will be a problem but just be cautious not to accidentally 
commit those files in repository.

Vitalije

-- 
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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Edward K. Ream
On Saturday, February 17, 2018 at 6:32:01 AM UTC-6, Edward K. Ream wrote:

>> A new leo/proto folder will contain prototype code, organized by 
developer.

Rev d13c608 of the new proto branch creates this directory structure:

- leo/proto
  - Joe
  - Terry
- leoserver
  - Vitalije

Using first names seems egalitarian :-) I'll add subfolders under proto/Joe 
and proto/Vitalije soon.

I changed proto/Terry/leoserver/leoserver.py so it runs properly when 
started in its new home.

Other tweaks may be required to support the terry-leoserver command, aka 
proto-terry-leoserver. As usual, the names don't matter as much as you 
might think because of Ctrl-P, repeat complex command.

All python-based commands will use imp.reload so that it won't be necessary 
to restart Leo after changing prototype code.  Commands running non-python 
code will run in external processes that rebuild the code.

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: Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Edward K. Ream
On Sat, Feb 17, 2018 at 1:55 AM, Edward K. Ream  wrote:

A new leo/proto folder will contain prototype code, organized by developer.
> This folder will allow devs to push work for others to see.
>

All prototypes will live in a long-lived *proto* branch, or sub-branches if
desired.

This was a long ENB post, not marked as such.

In future, please consider the following to be implicit in all long posts:

*tl;dr:* Read the summary

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.


Energy, prototypes, leoPrototype.py and leo/proto

2018-02-17 Thread Edward K. Ream
#684: Create a browser gui for Leo 
 is one of the largest 
projects in Leo's history. It might take 6 months or more to complete.

The only way to confront such a project is to focus on prototypes that take 
only one or two days.  That puts us into action and keeps energy levels 
high.

Yesterday I worked on Terry's prototype server code.  I learned much more 
from wrestling with the code than I would have from reading words, words, 
words.

This experience suggests a number of improvements:

1. I keep forgetting Terry introduced his leoserver stuff 

 
in a comment to #684 itself :-) More generally, it's a challenge to keep 
track of what Terry, Vitalije and Joe have done, and where the original 
code came from.

2. Yesterday it quickly became obvious that I needed to commit my changes 
to Terry's work somewhere.  I chose the leo/external folder, but that's not 
quite right.

Instead, I'll create a leo/proto folder for prototype code.  This will be 
organized by original developer: proto/tnb, proto/vitalije, proto/orr, etc. 
And yes, @file nodes for these files must be added to LeoPyRef.py.

3. Similarly, the leo/core/leoPrototype.py file will contain commands 
needed to run the prototypes. The docstrings for these commands will be 
convenient places to discuss where the code came from, what it's purpose 
is, etc.

4. The commands in leoPrototype.py may require improved infrastructure, say 
for running javascript or clojurescript code. 

An example may clarify some of the issues. Yesterday I first ran Terry's 
server code as follows:

  cd /test/Terry
  python leoserver.py

Which was fine, except that I had to copy the entire leo folder into 
/test/Terry!  Ok only for a quick prototype ;-)

The next step was to copy leoserver[.py, .js, .html, .css] to leo/external. 
I modified leoserver.py so that it would run without a copy of the leo 
directory. The code to do this was just a bit tricky:

controller, g = open_bridge()
join = g.os_path_finalize_join
loadDir = g.app.loadDir
path = join(loadDir, '..', 'doc', 'LeoDocs.leo')
c = controller.openLeoFile(path)

*New commands*

Today I'll create a new command, say tnb-server, in the new leoPrototype.py 
file.  Its docstring will contain everything I am likely to forget, 
including a digest of everything I have written here :-)

I'll do the same for Vitalije's two prototypes and Joe Orr's LeoVue code. 
These prototypes are written in javascript, clojurescript and vue.js.  I'll 
create whatever infrastructure is needed to run these prototypes. 

The proposed names for these commands will be vit-leocljs, vit-leo-el-vue 
(after the folder names of the code), and orr-leovue. Prefixing these 
commands with developer's id will help me remember them.  I'll also add 
aliases for these commands.  These aliases will start with proto-, so that 
proto- will list the names of all prototype commands.

*Summary*

To paraphrase Richard Feynman, that which I cannot build, I do not 
understand.

Rapid prototyping, including prototyping of builds, is the key to 
maintaining high energy in a large project. 

A new leo/proto folder will contain prototype code, organized by developer. 
This folder will allow devs to push work for others to see.

New proto-* commands, in leoPrototype.py, will run prototype code, building 
it as necessary. New infrastructure may be required to build and run 
non-python code.  Yes, Leo is pure python, but Leo can support languages 
other than python.

The docstrings for prototype commands are the proper place for all notes, 
including the original source of the code.

All comments and suggestions welcome.

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.