Re: NEW: cloud storage plugin for Leo

2017-09-24 Thread Terry Brown
p.s. for the Git cloud adapter, `git` needs to be on the path.

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


NEW: cloud storage plugin for Leo

2017-09-24 Thread Terry Brown
The new leo_cloud plugin allows subtrees within a .leo file to be
stored in the cloud.  It should be possible to support various cloud
platforms, currently git is supported (i.e. you can use GitLab or
GitHub or your own remote git server).

A leo_cloud subtree has a top node with a headline that starts with 
'@leo_cloud'.  The rest of the headline is ignored.  The body of this
top node is used to describe the cloud service, e.g.:

type: Git
remote: g...@gitlab.com:tnbrown/leo_cloud_storage.git
local: ~/.leo/leo_cloud/gitlab_leo_cloud_storage
ID: shortcuts
read_on_load: ask
write_on_save: ask

The first three lines can be repeated with different IDs to store
different subtrees at the same remote cloud location.

read_on_load: / write_on_save: can be yes, no, or ask.  If it's not one
of those three, there's a warning dialog.

There's also a file system backend, which would look like this:

type: FileSystem
root: ~/DropBox/leo_cloud
ID: my_notes
read_on_load: ask
write_on_save: ask

The FileSystem backend was meant to be for development, but of course
if you map it into a folder that is sync'ed externally, as shown above,
it can serve as a cloud adapter too.

In addition to the Git and FileSystem cloud types it should be possible
to add many others - Google Drive, OneDrive, DropBox, AWS, WebDAV,
sFTP, whatever.

Note: https://gitlab.com/ gives you free private repos., in case you
didn't know.

The data stored is basically headline, body, and uA (unknown
attributes).  The caveat is that it must be JSON serializable, this is
to avoid pickle flavor issues.  I don't think this will cause problems
except for legacy datetime objects from the todo.py plugin and set()s
in the tags plugin.  I think both can be fixed easily - a custom JSON
writer can write datetime as iso string time and sets as lists, and the
tags plugin can coerce lists to sets.  I think the todo.py plugin
already reads iso string time values.

My intended use was a common synchronized todo list across machines,
which this achieves.  (note to self, make sure todo icons are refreshed
properly).

An unintended bonus is that you can use it to sync. your settings
across machines easily too.  Because Leo is brilliant ;-), this:

@settings
  @keys
@leo_cloud
  @shortcuts

"just works", so now your shortcuts etc. can be stored on a central
server.

Lightly tested, but seems to work - testing and other feedback
appreciated.

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: Clone Find All / Clone Find Flat could benefit from auto highlighting of search term

2017-09-24 Thread Edward K. Ream
On Sun, Sep 24, 2017 at 2:46 PM, john lunzer  wrote:

> I had gotten close to getting past the trickiness before I got slammed at
> work leaving no time after work for hobby dev.
>
> There is a lot I don't understand about the Qt/PyQt highlighter, running
> Leo in the debugger around the highlighting code was rough. Do you remember
> if there were any resources you used when initially writing the highlighter?
>

​There are several very effective traces in the leoColorizer.py.

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: Clone Find All / Clone Find Flat could benefit from auto highlighting of search term

2017-09-24 Thread john lunzer
I had gotten close to getting past the trickiness before I got slammed at 
work leaving no time after work for hobby dev. 

There is a lot I don't understand about the Qt/PyQt highlighter, running 
Leo in the debugger around the highlighting code was rough. Do you remember 
if there were any resources you used when initially writing the highlighter?

I'd still like to get this done if work lets up.

On Thursday, September 21, 2017 at 11:38:25 AM UTC-4, Edward K. Ream wrote:
>
> On Tue, Sep 12, 2017 at 7:22 AM, john lunzer  > wrote:
>
>> I've been pouring through the syntax highlighting code and I think I've 
>> actually come up with a pretty elegant solution: custom highlighting rules
>>
>> The QSyntaxHighlighter is likely the best option for this. Basically 
>> rather than matching a regex syntax in a headline you would use the newly 
>> proposed directive *@highlight*. So for the simplest example, as it 
>> relates to clone-find-all and clone-find-flat, given the search term 
>> ​​
>> LeoHighlighter the Found collection node would include the directive 
>> @highlight 
>> ​​LeoHighlighter. The syntax highlighter would then either highlight or 
>> underline for every instance of the string "LeoHighlighter".
>>
>
> ​Yes, I think this could work.  Implementing it could be tricky, because 
> entering any node would potentially push or pop a stack of custom rules.  
> Furthermore, these rules would themselves be non-trivial to do. For 
> example, when @language python is in effect the custom rules would affect 
> virtually all the data structures in leo\modes\python.py.
>
> 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.