Re: aeca2fc: @path is now valid in body text of @ nodes

2018-03-27 Thread Edward K. Ream
On Tuesday, March 27, 2018 at 3:15:51 PM UTC-5, Edward K. Ream wrote:
>
>
> Next, the recursive import code will insert @path directives when it is 
> safe and useful to do so, namely for imported @clean nodes.
>

Done at e0ed35f. The "add_path" keyword arg to c.recursiveImport controls 
whether the @path directive will be added.  This is true by default.

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: Constant width icon boxes are important

2018-03-27 Thread Edward K. Ream
On Tue, Mar 27, 2018 at 5:19 PM, Chris George  wrote:

> Done at fc2344a92.
>
> Fixed width icons are in ../leo/themes/fixed-width-icons
>

​Thanks for this.

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: Constant width icon boxes are important

2018-03-27 Thread Chris George
Done at fc2344a92.

Fixed width icons are in ../leo/themes/fixed-width-icons

Chris

On Tue, Mar 27, 2018 at 8:15 AM, Edward K. Ream  wrote:
>
>
> On Tue, Mar 27, 2018 at 10:05 AM, Edward K. Ream 
> wrote:
>>
>> I finally understand why I have been having trouble recently.  Variable
>> width icon don't just "misalign" headline text, the make it much harder to
>> see the outline structure.  For now I have reverted to the old, tiny boxes.
>
>
> I have updated #786 to indicate that icon boxes should have constant width.
>
> --
> 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: color icons

2018-03-27 Thread Terry Brown
On Tue, 27 Mar 2018 14:26:36 -0700 (PDT)
jkn  wrote:

> On Tuesday, March 27, 2018 at 6:26:36 PM UTC+1, Terry Brown wrote:
> >
> > https://github.com/leo-editor/snippets/blob/master/examples/tests/make_icons.py
> >  
> >
> > make the simple icons attached.  Intended for dark rather than
> > light background.  Might be useful for other automated icon
> > generation things, seeing it iterates the 16 states in the correct
> > 00..15 order. 
> >
> > Maybe it could be added to .../leo/extensions/ 
> >
> > Still "eating my own dog food" to see if I actually like the
> > icons.  I went with an indicator for nodes with no content, rather
> > than an indicator for nodes with content, seeing the latter's more
> > common and I'm not really sure how important that indicator is
> > anyway... maybe I'll try not indicating that state.  Of course then
> > there's a wasted slot in my 2x2 icon design :-) 
> >
> > Cheers -Terry 
> 
> Do the icons have to be .pngs? I had to make something similar a
> while ago and ended up using  svgwrite to create .svg files,

Not really, well, they might need to be PNG's to work the way Leo uses
them, but from the point of view of generating them with the script, no.

The script really does two things, runs a loop with these values:

(0, ('clean', 'no_clone', 'unmarked', 'empty'))
(1, ('clean', 'no_clone', 'unmarked', 'content'))
(2, ('clean', 'no_clone', 'marked', 'empty'))
(3, ('clean', 'no_clone', 'marked', 'content'))
(4, ('clean', 'clone', 'unmarked', 'empty'))
(5, ('clean', 'clone', 'unmarked', 'content'))
(6, ('clean', 'clone', 'marked', 'empty'))
(7, ('clean', 'clone', 'marked', 'content'))
(8, ('dirty', 'no_clone', 'unmarked', 'empty'))
(9, ('dirty', 'no_clone', 'unmarked', 'content'))
(10, ('dirty', 'no_clone', 'marked', 'empty'))
(11, ('dirty', 'no_clone', 'marked', 'content'))
(12, ('dirty', 'clone', 'unmarked', 'empty'))
(13, ('dirty', 'clone', 'unmarked', 'content'))
(14, ('dirty', 'clone', 'marked', 'empty'))
(15, ('dirty', 'clone', 'marked', 'content'))

and demonstrates their use to make simple 4-color square PNGs using
PIL.  But you could certainly use that loop to generate SVG files in
various ways, maybe hiding / showing pre-drawn elements in an SVG file.

Still the SVG files may need to be rendered to a bitmap format for Leo
to use them, but that's a separate issue.

Cheers -Terry

> and then converting these to .png files. This was the best quality
> route for my purposes. If Qt can accept .svg icons directly they
> might come out nicer, in case this makes any difference.
> 
> SVGwrite documentation 
> 
> J^n

-- 
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: color icons

2018-03-27 Thread jkn


On Tuesday, March 27, 2018 at 6:26:36 PM UTC+1, Terry Brown wrote:
>
>
> https://github.com/leo-editor/snippets/blob/master/examples/tests/make_icons.py
>  
>
> make the simple icons attached.  Intended for dark rather than light 
> background.  Might be useful for other automated icon generation 
> things, seeing it iterates the 16 states in the correct 00..15 order. 
>
> Maybe it could be added to .../leo/extensions/ 
>
> Still "eating my own dog food" to see if I actually like the icons.  I 
> went with an indicator for nodes with no content, rather than an 
> indicator for nodes with content, seeing the latter's more common and 
> I'm not really sure how important that indicator is anyway... maybe 
> I'll try not indicating that state.  Of course then there's a wasted 
> slot in my 2x2 icon design :-) 
>
> Cheers -Terry 
>

Do the icons have to be .pngs? I had to make something similar a while ago 
and ended up using  svgwrite to create .svg files,
and then converting these to .png files. This was the best quality route 
for my purposes. If Qt can accept .svg icons directly they
might come out nicer, in case this makes any difference.

SVGwrite documentation 

J^n

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


aeca2fc: @path is now valid in body text of @ nodes

2018-03-27 Thread Edward K. Ream
Previously, I have no idea why, @path directives were explicitly disallowed 
in the body text of @ nodes.

But it's actually very useful to put them there, especially when studying 
code recursively imported.  Why? Because nodes can be moved freely--they 
aren't constrained to be children of an @path node.

Next, the recursive import code will insert @path directives when it is 
safe and useful to do so, namely for imported @clean nodes.

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.


color icons

2018-03-27 Thread Terry Brown
https://github.com/leo-editor/snippets/blob/master/examples/tests/make_icons.py

make the simple icons attached.  Intended for dark rather than light
background.  Might be useful for other automated icon generation
things, seeing it iterates the 16 states in the correct 00..15 order.

Maybe it could be added to .../leo/extensions/

Still "eating my own dog food" to see if I actually like the icons.  I
went with an indicator for nodes with no content, rather than an
indicator for nodes with content, seeing the latter's more common and
I'm not really sure how important that indicator is anyway... maybe
I'll try not indicating that state.  Of course then there's a wasted
slot in my 2x2 icon design :-)

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: Edit text with a script in Leo

2018-03-27 Thread Edward K. Ream
On Tue, Mar 27, 2018 at 3:34 AM, Jeremy Chen  wrote:

Let say I have a text file like this:
> ​ [snip]
>

Leo scripts, including @button nodes, can do any kind of text formatting.​



> I need to substitute pandas with pd and numpy with np etc. (step 1)
>

​Assuming p is the node containing your text, this will do what you want:​


​p.b = p.b.replace('pandas', 'pd').replace('numpy', 'np')
​


> Can I create a node and put the code into it? (step 2)
>

​Yes.  Something like this:

p2 = c.p.insertAfter()
p2.h = "My new node"

And then create another node where I write a script to automate a few
> repetitive substitutions? (step 3)
>

​Here is tested code.  Create @button substitute, with a body of:

# Make substitutions...
aList = [
('pandas', 'pd'),
('numpy', 'np'),
]
s = p.b
for pat1, pat2 in aList:
s = s.replace(pat1, pat2)

# Create a new node, with the new text.
p2 = c.p.insertAfter()
p2.h = "Substitutions"
p2.b = s
c.selectPosition(p2)
c.redraw()

​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: zim-import

2018-03-27 Thread Edward K. Ream
On Tue, Mar 27, 2018 at 4:20 AM, Josef  wrote:

>
> First I got error messages that the @string path_to_zim is missing, until
> I figured out that it needs an @string path-to-zim instead,
>
​
Either should work.  both are equivalent to @string pathtozim.
​

> so the error message is confusing.
>
> Then I got a message:
> not found: .../zim/index.rst
>
> now I am totally confused, because Zim keeps its data in .txt files, not
> .rst and the configuration file is the Notebook.zim file in the top level
> folder.
>

​The docstring for the ZimImportController class contains:

"First use Zim to export your project to rst files."

This was missing from the  docstring used by help-for-command for
import-zim-folder. Rev 59c1425 adds advice.

HTH.

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: Constant width icon boxes are important

2018-03-27 Thread Edward K. Ream
On Tue, Mar 27, 2018 at 10:05 AM, Edward K. Ream 
wrote:

> I finally understand why I have been having trouble recently.  Variable
> width icon don't just "misalign" headline text, the make it much harder to
> see the outline structure.  For now I have reverted to the old, tiny boxes.
>

​I have updated #786 
to indicate that icon boxes should have constant width.

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


Constant width icon boxes are important

2018-03-27 Thread Edward K. Ream
I finally understand why I have been having trouble recently.  Variable 
width icon don't just "misalign" headline text, the make it much harder to 
see the outline structure.  For now I have reverted to the old, tiny boxes.

Chris, are you willing to create a constant-width set?

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: Change to icon functions

2018-03-27 Thread Edward K. Ream
On Tuesday, March 27, 2018 at 9:33:32 AM UTC-5, Terry Brown wrote:

5406b6e45 changes the calling signature of appendImageDictToList, it no 
> longer accepts an iconDir parameter.  Always hard to know when a 
> method's "internal" and can be changed this way or part of the external 
> API and shouldn't be changed.  Let me know if it causes trouble for 
> anyone, we can change it to preserve the legacy behavior. 
>

Works for me.  I typically assume that nobody will use helper functions, 
especially if they are not used in plugins, and outside the class that 
defines them.

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.


Change to icon functions

2018-03-27 Thread Terry Brown
5406b6e45 changes the calling signature of appendImageDictToList, it no
longer accepts an iconDir parameter.  Always hard to know when a
method's "internal" and can be changed this way or part of the external
API and shouldn't be changed.  Let me know if it causes trouble for
anyone, we can change it to preserve the legacy behavior.

All calls to appendImageDictToList in the codebase updated.

All unit tests unchanged.

ALSO I found the declutter code was broken, partly because of
https://github.com/leo-editor/leo-editor/issues/840  It's fixed now
(hadn't noticed before because it worked with my settings).

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.


Edit text with a script in Leo

2018-03-27 Thread Jeremy Chen
Hi,

I'm a newbie. I read the tutorials a few times but I still can't figure out 
how to do this.

Let say I have a text file like this:

# bug fix for display formats to avoid run time errors
pandas.set_option('display.float_format', lambda x:'%.2f'%x)

data = pandas.read_csv('gapminder.csv')

# convert to numeric format
data['internetuserate'] = pandas.to_numeric(data['internetuserate'], errors=
'coerce')
data['urbanrate'] = pandas.to_numeric(data['urbanrate'], errors='coerce')
data['femaleemployrate'] = pandas.to_numeric(data['femaleemployrate'], 
errors='coerce')


I need to substitute pandas with pd and numpy with np etc. (step 1)

Can I create a node and put the code into it? (step 2)

And then create another node where I write a script to automate a few 
repetitive substitutions? (step 3)

If so, how do I get step 3 and below going?
Can I read the body of the text node in to a variable and then just write 
python code to deal with it?
Then I have to output it to the console, a new node or file, right?

Any hint is appreciated. Thanks!

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


zim-import

2018-03-27 Thread Josef
Hello,
I just tried to import a zim-wiki folder using the menu File --> Import --> 
Import Zim Folder.
I assume that "Zim Folder" refers to a Zim-Wiki, which keeps its data in a 
local folder.

First I got error messages that the @string path_to_zim is missing, until I 
figured out that it needs an @string path-to-zim instead,
so the error message is confusing.

Then I got a message:
not found: .../zim/index.rst

now I am totally confused, because Zim keeps its data in .txt files, not 
.rst and the configuration file is the Notebook.zim file in the top level 
folder.

Being able to read in a Zim folder would be a great thing. I find Zim 
better than Leo for taking notes (dragging info from the browser etc), 
while I prefer Leo as a project manager / editor,
so I use both, and on occasion it would be nice to switch between the two.

I see there was hardly any discussion regarding Zim, so if I am the only 
one interested in this, don't bother implementing anything. In that case I 
would rather suggest to remove the (in my opinion broken) import code.

- Josef

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