Re: Terry: replace SubProject label with Summary items?

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 9:01 PM, Terry Brown  wrote:

I'm not fussed one way or the other


​Neither am I.  It's just a suggestion.  They are your items.

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: LaTex to PDF workflow using Leo

2018-03-11 Thread Edward K. Ream
On Thursday, March 8, 2018 at 10:48:28 AM UTC-6, Arjan wrote:

Reviving this old topic. I made a crude attempt, hard-coded etc., to just 
> rewrite the section definitions via regex search and replace...
>
> How would I add Undo to this? Any other obvious improvements to make?
>

Here is a version with undo:

@language python

"""
Changes LaTeX section definition levels in the subtree of an @clean file 
node to their subtree level.
Only one LaTeX section level can therefore be used within a single node 
body.
"""

import re

section_levels = {
1: 'chapter',
2: 'section',
3: 'subsection',
4: 'subsubsection',
5: 'paragraph',
6: 'subparagraph'
}

def latex_convert_section_levels(p, adjusted_level_name):
""" Replaces LaTeX section definition levels found on a single line (re 
multiline mode).
Returns the modified node body."""
return re.sub(r
'\\(chapter|section|subsection|subsubsection|paragraph|subparagraph)(\[.*?\])?({.*})'
,
r'\\'+adjusted_level_name+r'\g<2>\g<3>', p.b, re.M)

u, undoType = c.undoer, 'change-latex'
h = p.h.strip()
if g.match_word(h, 0, '@clean') and h.endswith('.tex'):
bunch = u.beforeChangeTree(c.p)
changed, dirtyVnodeList = 0, []
root_level = p.level()
for p in p.subtree():
level = p.level() - root_level
if level < 7:
level_name = section_levels[level]
else:
level_name = 'subparagraph'
s = latex_convert_section_levels(p, level_name)
if s != p.b:
bunch2 = u.beforeChangeNodeContents(p)
p.b = s
u.afterChangeNodeContents(p, undoType, bunch2, dirtyVnodeList=
dirtyVnodeList)
p.v.setDirty()
changed += 1
if changed:
u.afterChangeTree(c.p, undoType, bunch)
g.es('Changed %s node%s.' % (changed, g.plural(changed)))
else:
g.es('No nodes changed')
else:
g.es('not a LaTeX file node?')

The only important change besides the addition of undo code was to test for 
.tex files with the following instead of regex.

 if g.match_word(h, 0, '@clean') and h.endswith('.tex'):

The regex will fail in some cases, especially on Windows:

And that's all.  It's a good @button node.

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: Terry: replace SubProject label with Summary items?

2018-03-11 Thread Terry Brown
On Sun, 11 Mar 2018 15:54:35 -0700 (PDT)
"Edward K. Ream"  wrote:

> Imo, you will likely find creating summary items, with "Summary"
> label, quite useful.  This will allow us to retire the SubProject
> label.
> 
> Edward

I'm not fussed one way or the other - to me Sub Project has a
connotation of self-contained, although perhaps that wasn't true of all
it's instances.  So fine with me if you want to replace them with
Summary.

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: Gitlab

2018-03-11 Thread Edward K. Ream
On Tue, Mar 6, 2018 at 4:25 PM, Kent Tenney  wrote:

> I see references to gitlab, never knew it's story.
>
> Here is an interview with it's creator, it's quite compelling stuff
> https://twit.tv/shows/floss-weekly/episodes/473
>
> As advertised, it's dead simple to install locally and play with.
>

​Well, I gave up after 10 minutes of chat about sick people and pianos, and
then the host starts to read from a web page.  You have more patience than
I.

Can you summarize why we would want to migrate from github?

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: Autocomplete

2018-03-11 Thread Edward K. Ream
On Sat, Mar 10, 2018 at 9:06 AM, Arjan  wrote:

I happened upon Python auto-completion somewhere in the docs (nice
> feature!). Upon first trying it, I got an exception:
>

​This uncovered a can of worms ;-)  Rev 6d95fe6 makes many changes to
leo/external/codewise.py.

How does this work for you? I don't use this and haven't tested the changes.

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: Atom might be Leo's future

2018-03-11 Thread Edward K. Ream
On Sat, Mar 10, 2018 at 8:04 PM, Thomas Passin  wrote:

> It seems to me that many python-based systems could be run in a Leo
> process, which would give access to their internal APIs.  The challenge
> would be to get their input and output into Leo cells.
>
> For non-python systems, in some cases there could be a python wrapper that
> handles communication (i.e., the Leo Bridge could be wrapped to communicate
> with a node.js server, just as an example, though that goes in the opposite
> direction from what I am thinking of).
>
> To go this route, one challenge would be to abstract the new parts so that
> they can be adapted to new systems as easily as possible, without having to
> rewrite existing code (except of course for the adapters and wrappers).
>

​All this seems in line with my thinking, which is quite fuzzy at present.

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: Summary info items

2018-03-11 Thread Edward K. Ream
On Sunday, March 11, 2018 at 3:54:10 PM UTC-5, Edward K. Ream wrote:

We can regard labels as the top-level of the organization, summary/info 
> items as the second level, and individual labels as the bottom layer.
>

Summary items typically consist of bullet lists of other items:

- Item 1
- Item 2
etc.

Aha: These bullet lists can have sublists, so summary items can represent 
arbitrarily complex structure:

- Item 1
  - Sub-item 1
  - Sub-item 2
- Sub-sub-item
- Item 2

In practice this will not often be needed, but it's good to know the 
capability exists.

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: Themes

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 6:06 PM, k-hen  wrote:

​[I] ...​
> was just curious whether you envisioned people editing the regular
> constants/defaults, like 'red' and/or 'leoRed' or whether these were best
> kept separate.
>

​Devs should not change the color definitions in leoSettings.leo:

leoSettings.leo#@settings--> Color definitions​

Other than that, using more meaning full names, and "multi-level" names,
seems like a great idea.

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: Python 2?

2018-03-11 Thread Edward K. Ream
On Sat, Mar 10, 2018 at 6:52 PM, Terry Brown  wrote:

Bottom line I think pickle's a bad format for anything except transient
> serialization
>

​Let's google "python alternative to pickle":

First hit: Don't Pickle Your Data
. The
recommendation: just use json. Pickle is slow, python-centric and is a
security risk. I googled "python to json" which yields python's json module
.

I have just created #800: Replace pickle with json everywhere in Leo
.

Imo, this is a high priority item.  It should have been done long ago.
Terry, do you agree?

I switch frequently, and see this a lot.


​Interesting.  I never see this.  It's fallen off my radar.

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: Themes

2018-03-11 Thread k-hen
Edit: I guess what I'm saying here is that I prefer a 3-step approach, 1st 
the definition of the full color-palette, 2nd the assignment of the 
color-palette to the logical structural & syntax elements, 3rd the 
assignment of those logical elements to the physical components in the 
stylesheet, i.e. the @data component.

Obviously I can contain these to my own model, but was just curious whether 
you envisioned people editing the regular constants/defaults, like 'red' 
and/or 'leoRed' or whether these were best kept separate. 

Kevin


On Sunday, March 11, 2018 at 6:56:08 PM UTC-4, Edward K. Ream wrote:
>
>
>
> On Sun, Mar 11, 2018 at 5:47 PM, k-hen  > wrote:
>
>>
>> Just wanted to say thanks very much for this.  It happens I was looking 
>> at creating my own theme as a way of learning more about Leo and was really 
>> struggling with the stylesheets myself. FWIW, the way I was going about 
>> this was first defining my full color palette in a section within 
>> myLeoSettings as my-magenta, my-red, my-orange, etc., then applying those 
>> colors to the various objects in the stylesheet. This makes it a bit easier 
>> to swap them in and out of the @settings section depending on the context 
>> I'm in without having to reassign the major styles. Another thing I often 
>> do is set magenta+1, magenta-1 for more/less emphasis that can be reversed 
>> for light/dark themes. I'll post a bit more once I get it updated for the 
>> newer standard.
>>
>
> ​Thanks for these comments. They are all good ideas.
>
> 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: Styling Plugins

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 3:44 PM, Chris George  wrote:

GammaRay requires PyQt 5.10 to work. I can build it and use it to load Leo
> and it works great. Very useful.
>

​Thanks for this info.
​


> But PyQt 5.10 breaks my stylesheet. Qt Designer validates the stylesheet
> just fine. Drop back to PyQt 5.6.2 and the stylesheet renders correctly in
> Leo. All things considered, I blame PyQt. :-)
>

​Reasonable, imo.​



> Is there anything we can do to have Leo support 5.10? This is the second
> time that I have had an app *require* PyQt 5.10.
>

​We can't require anyone to use PyQ6 5.10, or Python 3.   But you are free
to use those, and to create themes that require them.  Just please document
the requirements.

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: Simple design principles for style sheets

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 4:05 PM, Chris George  wrote:

Would it be possible to program a button to "Reload Stylesheets",
> close the current file, and then reopen it? I must do this a hundred
> times a day manually. :-)
>

​Why do you want to reload Leo if you reload stylesheets?

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: Themes

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 5:47 PM, k-hen  wrote:

>
> Just wanted to say thanks very much for this.  It happens I was looking at
> creating my own theme as a way of learning more about Leo and was really
> struggling with the stylesheets myself. FWIW, the way I was going about
> this was first defining my full color palette in a section within
> myLeoSettings as my-magenta, my-red, my-orange, etc., then applying those
> colors to the various objects in the stylesheet. This makes it a bit easier
> to swap them in and out of the @settings section depending on the context
> I'm in without having to reassign the major styles. Another thing I often
> do is set magenta+1, magenta-1 for more/less emphasis that can be reversed
> for light/dark themes. I'll post a bit more once I get it updated for the
> newer standard.
>

​Thanks for these comments. They are all good ideas.

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.


Terry: replace SubProject label with Summary items?

2018-03-11 Thread Edward K. Ream
Imo, you will likely find creating summary items, with "Summary" label, 
quite useful.  This will allow us to retire the SubProject label.

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: Summary info items

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 3:18 PM, Edward K. Ream  wrote:

> #796: Summary of installation items
> , contains links to
> all installation-related items.  I have closed all these items so as not to
> obscure the info items page
> 
> .
>

​I have just marked all summary items with the new "Summary" label.  This
allows me to open or close info items separately.

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: Themes

2018-03-11 Thread k-hen
Hi Guys,
Just wanted to say thanks very much for this.  It happens I was looking at 
creating my own theme as a way of learning more about Leo and was really 
struggling with the stylesheets myself. FWIW, the way I was going about 
this was first defining my full color palette in a section within 
myLeoSettings as my-magenta, my-red, my-orange, etc., then applying those 
colors to the various objects in the stylesheet. This makes it a bit easier 
to swap them in and out of the @settings section depending on the context 
I'm in without having to reassign the major styles. Another thing I often 
do is set magenta+1, magenta-1 for more/less emphasis that can be reversed 
for light/dark themes. I'll post a bit more once I get it updated for the 
newer standard.

Kevin


On Saturday, March 10, 2018 at 5:57:54 AM UTC-5, Edward K. Ream wrote:
>
> On Sat, Mar 10, 2018 at 4:46 AM, Edward K. Ream  > wrote:
>  
>
>> is there a different mechanism
>>> ​ [to generalize the] ​
>>> path relative to leo/themes/?
>>>
>>
> ​This is tricky.  We probably need a new setting for 
> ssm.set_indicator_paths.
>
> Something like @string theme_base_directory, which would *itself* be a 
> path relative to leo/themes (first) and leo/Icons (second).
>
> If this setting exists, it would be used *in addition to* the 
> tree-image-closed and tree-image-closed settings.
>
> This is on my local list of things to do today.
>
> 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: Simple design principles for style sheets

2018-03-11 Thread Chris George
Hmmm,

I was considering asking for how to do something similar.

Would it be possible to program a button to "Reload Stylesheets",
close the current file, and then reopen it? I must do this a hundred
times a day manually. :-)

Chris


On Sun, Mar 11, 2018 at 11:02 AM, Edward K. Ream  wrote:
> On Sun, Mar 11, 2018 at 12:45 PM, Edward K. Ream 
> wrote:
>>
>>
>> @button load-ekr @key=F5
>>
>> @language python
>> # Open ekr.leo in a separate process.
>> import os
>> os.system("e")
>>
>> On Windows, F5 will execute e.bat, which opens ekr.leo.  The command runs
>> in the same console as Leo itself, but in a separate process that uses the
>> latest Leo code. Leo remains responsive.
>
>
> Oops.  Leo hangs.  This is opens a new console.
>
> os.system("start cmd /c t")
>
> t.bat ends with the exit command, so the console goes away when I close Leo.
> So now everything happens from Leo itself, and no consoles need to be closed
> by hand afterwards.
>
> 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: Summary info items

2018-03-11 Thread Edward K. Ream
On Sunday, March 11, 2018 at 3:18:33 PM UTC-5, Edward K. Ream wrote:

> #796: Summary of installation items 
, contains links to 
all installation-related items.
 
The info items page 

 
now contains *only* summary issues.  Please take a look.

This page will greatly improve my overview of complex issues.

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: Styling Plugins

2018-03-11 Thread Chris George
A big caveat:

GammaRay requires PyQt 5.10 to work. I can build it and use it to load Leo 
and it works great. Very useful.

But PyQt 5.10 breaks my stylesheet. Qt Designer validates the stylesheet 
just fine. Drop back to PyQt 5.6.2 and the stylesheet renders correctly in 
Leo. All things considered, I blame PyQt. :-)

Is there anything we can do to have Leo support 5.10? This is the second 
time that I have had an app *require* PyQt 5.10.

Chris

On Sunday, March 11, 2018 at 1:25:46 PM UTC-7, Chris George wrote:
>
> Thanks for the motivation. I am now running GammaRay and Leo native (no 
> Anaconda). I will have to rebuild a few things, but no big deal.
>
> Leo Log Window
> Leo 5.8 devel, build 20180307231313, Wed Mar 7 23:13:13 PST 2018
> Git repo info: branch = devel, commit = 0a733e0506cd
> Python 3.6.4, PyQt version 5.10.0
> linux
> isPython3: True
>
>
> Chris
>

-- 
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: Styling Plugins

2018-03-11 Thread Chris George
Thanks for the motivation. I am now running GammaRay and Leo native (no 
Anaconda). I will have to rebuild a few things, but no big deal.

Leo Log Window
Leo 5.8 devel, build 20180307231313, Wed Mar 7 23:13:13 PST 2018
Git repo info: branch = devel, commit = 0a733e0506cd
Python 3.6.4, PyQt version 5.10.0
linux
isPython3: True


Chris

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


Summary info items

2018-03-11 Thread Edward K. Ream
#796: Summary of installation items 
, contains links to 
all installation-related items.  I have closed all these items so as not to 
obscure the info items page 

.

Imo such summary pages are significantly better than just labeling related 
items, for the following reasons:

1. They allow for discussions about all the subsumed items.
2. They allow for multiple levels of subsumed items.
3. They do not require additional labels.  We have enough of those already.

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: Simple design principles for style sheets

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 12:45 PM, Edward K. Ream 
wrote:

>
> @button load-ekr @key=F5
>
> @language python
> # Open ekr.leo in a separate process.
> import os
> os.system("e")
>
> On Windows, F5 will execute e.bat, which opens ekr.leo.  The command runs
> in the same console as Leo itself, but in a separate process that uses the
> latest Leo code. Leo remains responsive.
>

​Oops.  Leo hangs.  This is opens a *new* console.

os.system("start cmd /c t")

t.bat ends with the exit command, so the console goes away when I close
Leo.  So now everything happens from Leo itself, and no consoles need to be
closed by hand afterwards.

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: Simple design principles for style sheets

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 8:56 AM, Thomas Passin  wrote:

I didn't have too much trouble finding color constants per se.
> ​...​
> But colors look different depending on their surroundings, and I had to do
> a lot of trial and error to hit on ones that worked *and* were distinct
> enough from other syntax colors you might find in a page of code.
>

​Here's a trick I use all the time.  During testing I reload a *small* leo
file, running in another process.  It typically takes just a few keystrokes
to load this.  Not perfect, but the test file could have the syntax
coloring "template" as the selected node, so you can see your results in
context.

Just now I saw that I could speed this process further.  I created the
following @button node as a *common* @button node in myLeoSettings.leo.
That is, it is a child of the @buttons node.

@button load-ekr @key=F5

@language python
# Open ekr.leo in a separate process.
import os
os.system("e")

On Windows, F5 will execute e.bat, which opens ekr.leo.  The command runs
in the same console as Leo itself, but in a separate process that uses the
latest Leo code. Leo remains responsive.

The /wait option to os.system would wait for the command to finish, but I
see no reason to want to do that.

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: Styling Plugins

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 9:04 AM, Chris George  wrote:

What is going to be the convention for styling plugins?
>

​Good question.​


So far to accommodate the bookmarks plugin, heroic theming is required.
> Will it be up to the theme developer to load, inspect and style every
> plugin?
>

You keep bringing up holes in Leo :-) It's a valuable skill.

it would be a mountain of work to ensure that every Qt plugin was loaded,
> inspected, and styled appropriately.
>

​I agree. Don't know what the solution is.  Theme designers are, of course,
free to ignore plugins that they personally don't use.
​


> BTW, GammaRay is highly recommended for inspecting Qt applications.
> https://github.com/KDAB/GammaRay
>

​Sounds like a must-have tool.
​


> Caveat: The Cmake process seems to be incompatible with Anaconda.
>

​Have you tried installing an alternate version of Python 3?  That's my
plan.

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: The design of Leo+Ipython+Jupyter+Lit-computing

2018-03-11 Thread Terry Brown
On Sun, 11 Mar 2018 07:05:54 -0700 (PDT)
Thomas Passin  wrote:

> I haven't worked on anything much in-browser since before html5 came
> out. So I didn't know anything about "~=", for example.  Even then I
> tried to only work with the simpler constructs (both javascript and
> css), so I probably wouldn't have used that particular construct
> anyway.

The ~= operator is a Qt Stylesheet thing that let's Qt stylesheets act
like HTML CSS with classes.  So having a class is probably the most
fundamental selector in CSS, ignoring ID, but it's a second class
citizen in Qt Stylesheets, implemented by ~= which is "attribute
contains".  So

HTML CSS

p.foo { }

Qt Stylesheet

p[style_class ~= 'foo'] { }

where style_class is arbitrary, but what Leo uses.

But I'd take second class citizen over broken, which is what I think it
is in Qt >= 5.8, unless it got fixed and they never cleared the bug
report.

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: Using Holoview in @Jupyter Nodes

2018-03-11 Thread Edward K. Ream
On Sun, Mar 11, 2018 at 8:45 AM, Thomas Passin  wrote:

> I have only done this for a notebook located on my own computer.  You have
> to use "file:///" and I changed the backslashes (I'm on Windows) to forward
> slashes:
>
> file:///C:/Users/tom/holoview_tests.ipynb
>

​Thanks.  I understand the code again :-)  I'll update the docstring soon.

This works for me on Ubuntu, but not on Windows.  I'll investigate, but
it's good to know that it's working for me.

Recent revs allow the @jupyter node to contain the actual json from the
.ipynb file.

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: The design of Leo+Ipython+Jupyter+Lit-computing

2018-03-11 Thread Thomas Passin
I haven't worked on anything much in-browser since before html5 came out.  
So I didn't know anything about "~=", for example.  Even then I tried to 
only work with the simpler constructs (both javascript and css), so I 
probably wouldn't have used that particular construct anyway.

On Saturday, March 10, 2018 at 11:13:33 PM UTC-5, Terry Brown wrote:
>
> ...Being fairly used to Qt I don't find it difficult to code in.  OTOH 
> maybe a modern browser based GUI system - well, really "HTML" CSS is a 
> lot better than Qt's Stylesheet system I think.  With Qt 5.8 breaking 
> the ~= operator it's hard to even emulate CSS classes well

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


Styling Plugins

2018-03-11 Thread Chris George
What is going to be the convention for styling plugins?

So far to accomodate the bookmarks plugin, heroic theming is required. Will 
it be up to the theme developer to load, inspect and style every plugin?

It took a bit for me to figure out how to style the Tags Tab, for example. 
The good news is that if the plugin exists, it gets styled. If it is 
unloaded, the css is ignored. But it would be a mountain of work to ensure 
that every Qt plugin was loaded, inspected, and styled appropriately.



BTW, GammaRay is highly recommended for inspecting Qt applications. 
https://github.com/KDAB/GammaRay

Caveat: The Cmake process seems to be incompatible with Anaconda. Cmake 
"knows" where the cmake file for QT5 lives and no amount of hacking (I will 
try again as the workaround sucks) could convince it that it lives in 
~/anaconda3. I had to unload Anaconda. Unfortunately the combination of 
python3 and QT in my default install doesn't work with Leo. So python2 it 
was. At the end of the day (literally) gammaray compiled and I loaded Leo. 
This morning I pulled the details on the widgets I needed to style the find 
tab. Unfortunately the spell tab doesn't load in python2, so it will have 
to wait until I find a way to make it work with Anaconda.

Chris

-- 
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: Simple design principles for style sheets

2018-03-11 Thread Thomas Passin

I didn't have too much trouble finding color constants per se.  I would do 
a web search for, say, "color #553399", and that would show me the color.  
There are also on-line color pickers.  But colors look different depending 
on their surroundings, and I had to do a lot of trial and error to hit on 
ones that worked *and* were distinct enough from other syntax colors you 
might find in a page of code.

That's why the PyScripter way works well.

On Sunday, March 11, 2018 at 8:45:04 AM UTC-4, Edward K. Ream wrote:
>
>
> On Monday, March 5, 2018 at 10:14:00 PM UTC-5, Edward K. Ream wrote:
>>
>> "...EditPlus (Windows only) has a listbox of syntax element names, and 
>> when you choose one it shows you the foreground and background color, which 
>> you can then change using a standard Windows color selector.
>> ​
>> Leo definitely should do at least this much, and to the dropdown list we 
>> can add the foreground/background colors for Leo's various panes, buttons, 
>> etc."
>>
>
>
>

-- 
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: Using Holoview in @Jupyter Nodes

2018-03-11 Thread Thomas Passin
I have only done this for a notebook located on my own computer.  You have 
to use "file:///" and I changed the backslashes (I'm on Windows) to forward 
slashes:

file:///C:/Users/tom/holoview_tests.ipynb

The right syntax for a file URL seems to confuse people.  I think the RFCs 
aren't too clear.  "file:///" is correct - the protocol is "file", and 
there is no server (so "//server/" becomes "///").  But many programs want 
you to use "file:/c:/..."), and there can be other variants.  I just try 
all the combinations I can think of until one of them works.

Just as a reminder, this is using VR, *not* VR2.

On Sunday, March 11, 2018 at 8:35:06 AM UTC-4, Edward K. Ream wrote:
>
> On Saturday, March 10, 2018 at 8:26:21 PM UTC-6, Thomas Passin wrote:
>
> > Run the code in Jupyter Notebook. Let it finish and display the graphic, 
> then save the notebook...
> > ViewRendered will be able to show the graphic in the @jupyter node.
>
> Many thanks for this.  I had completely forgotten that the VR plugin 
> supports @jupyter nodes! Sheesh. gitk tells me I wrote this on 2017-01-05. 
>
> There is nothing in the docstring about @jupyter.  Thomas, what do you 
> paste into the body text?  A url, json or html?  Anything you can add will 
> find it's way into the docstring.
>
> Edward
>
> P.S. For my reference, the update_jupyter method does the rendering: Here 
> is the guts of the code:
>
> import nbformat
> from nbconvert import HTMLExporter
> from urllib.request import urlopen
> ...
> url = g.getUrlFromNode(c.p)
> if url and nbformat:
> s = urlopen(url).read().decode()
> try:
> nb = nbformat.reads(s, as_version=4)
> e = HTMLExporter()
> (s, junk_resources) = e.from_notebook_node(nb)
> except nbformat.reader.NotJSONError:
> # Assume the result is html.
> pass
> elif url:
> s = 'can not import nbformt: %r' % url
> else:
> s = g.u('')
> w.setHtml(s)
>
> 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: Simple design principles for style sheets

2018-03-11 Thread Edward K. Ream
On Sat, Mar 10, 2018 at 7:06 PM, Thomas Passin  wrote:

>
> One more reason I found it hard to adjust the colors is that so many of
> the syntax colors have those JEdit names, like "literal2_color".  What the
> heck does that map to?
>

​These map directly to the constants defined in each .py file in the
leo/modes folder.  There is a script to generate these .py files directly
from the jEdit .xml syntax coloring files.

The code in leoColorizer.py uses these name to init various data
structures.  The actual colorizing code knows nothing *directly *about the
names, but the names are bound (in the modes/*.py files) to arguments to
the pattern matches in leoColorizer.py.

In short, these names can't be changed.

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: Simple design principles for style sheets

2018-03-11 Thread Edward K. Ream
On Sat, Mar 10, 2018 at 7:19 PM, Thomas Passin  wrote:

PyScripter displays a small code example that contains most of the code
> structures that get touched by the syntax colorer.  If you click on one of
> them, a picklist scrolls to that element, and the color chooser gets
> populated with the corresponding color, including its symbolic constant
> name, which is shown in an edit box.  You can either pick form a color
> chart or type in a new color.  It's a pretty nice system, and you can see
> clearly which syntax element you are working with.
>

​Very cool.​

​Not sure how to do this.​

>
> EditPlus (Windows only) has a listbox of syntax element names, and when
> you choose one it shows you the foreground and background color, which you
> can then change using a standard Windows color selector.
>
​
Leo definitely should do at least this much, and to the dropdown list we
can add the foreground/background colors for Leo's various panes, buttons,
etc.

Leo's present themes probably already define the color constants needed to
do this easily.  As Terry says, reload-settings would then show the
results.​
​​
​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: Using Holoview in @Jupyter Nodes

2018-03-11 Thread Edward K. Ream
On Saturday, March 10, 2018 at 8:26:21 PM UTC-6, Thomas Passin wrote:

> Run the code in Jupyter Notebook. Let it finish and display the graphic, 
then save the notebook...
> ViewRendered will be able to show the graphic in the @jupyter node.

Many thanks for this.  I had completely forgotten that the VR plugin 
supports @jupyter nodes! Sheesh. gitk tells me I wrote this on 2017-01-05. 

There is nothing in the docstring about @jupyter.  Thomas, what do you 
paste into the body text?  A url, json or html?  Anything you can add will 
find it's way into the docstring.

Edward

P.S. For my reference, the update_jupyter method does the rendering: Here 
is the guts of the code:

import nbformat
from nbconvert import HTMLExporter
from urllib.request import urlopen
...
url = g.getUrlFromNode(c.p)
if url and nbformat:
s = urlopen(url).read().decode()
try:
nb = nbformat.reads(s, as_version=4)
e = HTMLExporter()
(s, junk_resources) = e.from_notebook_node(nb)
except nbformat.reader.NotJSONError:
# Assume the result is html.
pass
elif url:
s = 'can not import nbformt: %r' % url
else:
s = g.u('')
w.setHtml(s)

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.