Associate .Leo files to open with Leo when double click, and some more noob confussion

75 views
Skip to first unread message

Fidel Pérez

unread,
May 9, 2013, 3:36:36 AM5/9/13
to leo-e...@googlegroups.com
Hi:
  • Im having trouble also linking Leo files to Leo. I have tried this:

      Associate .leo filetype batch file: 
          ftype LeoFile=C:Python25pythonw.exe “C:Python25Libsite- 
packagesleolaunchLeo.py” “%1” assoc .leo=LeoFile 

Which I found here, but leolaunchleo.py doesnt even exist anymore (the post is old).

  • I guess others have had this idea but It would be great to include a small file within the Quickstart guide which would associate files automatically. (Or maybe asking for imput, which can be done through a Leo node and this way the user learns about its functionality).

  • Also, I miss some more buttons or scripts in quick start guide, preferably before the "programming" section, so when a new user opens it, he has had the opportunity to do Ctrl+B on several scripts (for instance, showing in the log the name of all the nodes within the selected one, having some subnodes with numbers and doing math on them and showing the result on the log pane, and as much "silly" but visual functions as possible so the user, by going pressing ctrl+b on each, gets a bigger chance to understand what is Leo. In my oppinion some users will just stop in the quickguide if they are not presented with such a thing before going to docs.leo etc.

  • Another thing is the plugin activation, the description of the plugins is not as accessible as it should be (opinions here, focusing in new users, and as I always say, appreciating and fully grateful for Leo as is now),and a script for activating them  easier, been a week using Leo and still cant quite activate, find the descriptions or use them freely... And if each plugin or script had an example of use that would be priceless, for instance, including them all in quickstart (both scripts, plugins branchs) and then the new user could just go through all clicking on the examples and just seeing Leo work and show its potential. I know some of those are done but as I said, after a week or so I still am very confused...

Thank you.

Fidel Pérez

unread,
May 9, 2013, 3:41:28 AM5/9/13
to leo-e...@googlegroups.com
  • Also, quickstartguide should be open by default (instead of current Leo workbook) at least until the user changes some config and prevents that from happening. Is there any "load previous tabs" functionality? (IE open the Leo files which where open when it was closed the last time)

Edward K. Ream

unread,
May 9, 2013, 1:27:07 PM5/9/13
to leo-editor
On Thu, May 9, 2013 at 2:36 AM, Fidel Pérez <fidel...@gmail.com> wrote:
Hi:
  • Im having trouble also linking Leo files to Leo. I have tried this:

[snip]

Thanks for these detailed suggestions.  I've put them on the list of improvements for documentation.

Edward

Matt Wilkie

unread,
May 9, 2013, 9:55:20 PM5/9/13
to leo-e...@googlegroups.com
  • Im having trouble also linking Leo files to Leo. I have tried this:

      Associate .leo filetype batch file: 
          ftype LeoFile=C:Python25pythonw.exe “C:Python25Libsite- 
packagesleolaunchLeo.py” “%1” assoc .leo=LeoFile 

Which I found here, but leolaunchleo.py doesnt even exist anymore (the post is old).

Those instructions are sitll more or less relevant, but somehow all the slashes are missing. In any case, please try downloading "create-leobat.bat" batch file to the Leo directory and running from an admin-level command prompt:

   create-leobat c:\path\to\python27\python.exe register
  • I guess others have had this idea but It would be great to include a small file within the Quickstart guide which would associate files automatically. (Or maybe asking for imput, which can be done through a Leo node and this way the user learns about its functionality).
 
I wrote a leo script that creates the file association, which I hope to include in the next release or on the Leo blog as a sample: https://groups.google.com/d/msg/leo-editor/ANPuhuEIU9c/GTcpLvVB_WoJ.

To use it, copy everything between the triple curly braces {{{...}}}, but not including the braces, and paste into an Leo window, then press [Ctrl-B].

It requires that Leo is started from an Admin level command shell (or that UAC is turned off).

cheers,

-matt

Fidel Pérez

unread,
May 11, 2013, 11:46:00 AM5/11/13
to leo-e...@googlegroups.com
Thanks for the info Matt.

I just did the first step, and this is the result:
  • When double click leo files, Leo opens, asks if I really want to open that file (it says it is already open, but its not true) and then open and instantly (I get to see the tree but in about 1/4th of  a second it dissapears/closes Leo). Same thing happens if I have another instance of Leo open. (That instance will still be open and not affected by this process)
Did also the second step, with UAC disabled:
  • It actually works, but as a tip for non expert users like me, it asked me what did I want to associate leo files with, I said launchleo.py, and of course it didnt work. Then I associated them with python.exe (Im talking about Windows -right click- run with) and then it works! finally! Thanks a lot
  • Still asks if i want to open the file even though the file is already open (and its not)
Thanks again, hope this feedback is useful.

Matt Wilkie

unread,
May 13, 2013, 2:14:45 AM5/13/13
to leo-e...@googlegroups.com
Thanks for the info Fidel. Can you post the beginning of the Leo log window? It looks like:

    Leo Log Window
    Leo 4.11 devel, build 5768, 2013-05-11 23:23:23
    Python 2.7.4, qt version 4.7.1
    Windows 6, 1, 7601, 2, Service Pack 1

cheers,

-matt

Fidel Pérez

unread,
May 13, 2013, 2:53:36 AM5/13/13
to leo-e...@googlegroups.com
Welcome, here you go:

Leo Log Window
Leo 4.11 devel, build 5753, 2013-05-08 02:56:43 -0500
Python 2.7.4, qt version 4.8.4
Windows 6, 1, 7601, 2, Service Pack 1

Fidel Pérez

unread,
May 27, 2013, 4:25:34 AM5/27/13
to leo-e...@googlegroups.com
After a while I realized Im not using this feature, and here is the reason:

If I double click my desktop links to the leo files I use the most, they will open Leo alright, but they will open each in a new window, instead of incoroprating themselves to the leo window Im working with.
Since Leo offers the option to detach leo windows, In my oppinion they should come to the same Leo window already open. I was also thinking on linking the leo files I use the most each to a node of my tree, but again its not as useful as I would like because each of them will open in different windows. My objective here is to be able to come back to the previous Leo session as it was then i closed it to go on, instead of having to open every leo file individually)

I have done this process (associating leo files) again in another computer (to be able to report its performance on it) and It doesnt work well:

Files will open Leo, stand there for a second, and then close. 
But I can open leo by running "launchleo.py". 

I have deleted myleosettings file and then it works, so its a conflict with a plugin.

Tell me if you need any extra information to try and find the bug. The plugins im currently using are:


plugins_menu.py

contextmenu.py
leo_to_html.py
mod_scripting.py
nav_qt.py
quicksearch.py
stickynotes.py
todo.py
viewrendered.py


active_path.py
add_directives.py
at_folder.py
at_produce.py
at_view.py
bookmarks.py
codewisecompleter.py
colorize_headlines.py
datenodes.py
detect_urls.py
dragdropgoodies.py
FileActions.py
interact.py
leo_interface.py
leo_pdf.py
leo_to_html.py
leo_to_rtf.py
leofeeds.py
leomail.py
leoscreen.py
macros.py
mnplugins.py
mod_framesize.py
mod_http.py
mod_read_dir_outline.py
mod_scripting.py
mod_timestamp.py
nested_splitter.py
nodeActions.py
outline_export.py
paste_as_headlines.py
plugins_menu.py
pretty_print.py
projectwizard.py
qtGui.py
qt_main.py
qt_quicksearch.py
qtframecommands.py
quickMove.py
quicksearch.py
run_nodes.py
screenshots.py
scripts_menu.py
todo.py
viewrendered.py

The Leo log window when I open with launchleo.py is:

Leo Log Window
Leo 4.11 devel, build 5753, 2013-05-08 02:56:43 -0500
Python 2.7.2, qt version 4.8.4
Windows 6, 1, 7600, 2, 
Error: leo.plugins.at_folder.init did not return a bool
loadOnePlugin: can not load enabled plugin: leo.plugins.at_folder
at_view plugin not loaded: win32Clipboard not present.
Error: leo.plugins.at_view.init did not return a bool
loadOnePlugin: can not load enabled plugin: leo.plugins.at_view
loadOnePlugin: can not load enabled plugin: leo.plugins.codewisecompleter
error importing plugin: leo.plugins.detect_urls
Traceback (most recent call last):
  File "D:\Dropbox\LEO EDITOR\leo\core\leoPlugins.py", line 556, in loadOnePlugin
    __import__(moduleName)
ImportError: No module named detect_urls
loadOnePlugin: can not load enabled plugin: leo.plugins.detect_urls
error importing plugin: leo.plugins.interact
Traceback (most recent call last):
  File "D:\Dropbox\LEO EDITOR\leo\core\leoPlugins.py", line 556, in loadOnePlugin
    __import__(moduleName)
  File "D:\Dropbox\LEO EDITOR\leo\plugins\interact.py", line 45, in <module>
    import pexpect
ImportError: No module named pexpect
loadOnePlugin: can not load enabled plugin: leo.plugins.interact
error importing plugin: leo.plugins.leo_pdf
Traceback (most recent call last):
  File "D:\Dropbox\LEO EDITOR\leo\core\leoPlugins.py", line 556, in loadOnePlugin
    __import__(moduleName)
  File "D:\Dropbox\LEO EDITOR\leo\plugins\leo_pdf.py", line 267, in <module>
    import docutils
ImportError: No module named docutils
loadOnePlugin: can not load enabled plugin: leo.plugins.leo_pdf
error importing plugin: leo.plugins.leofeeds
Traceback (most recent call last):
  File "D:\Dropbox\LEO EDITOR\leo\core\leoPlugins.py", line 556, in loadOnePlugin
    __import__(moduleName)
  File "D:\Dropbox\LEO EDITOR\leo\plugins\leofeeds.py", line 36, in <module>
    import feedparser
ImportError: No module named feedparser
loadOnePlugin: can not load enabled plugin: leo.plugins.leofeeds
exception importing plugin leo.plugins.pretty_print
Traceback (most recent call last):
  File "D:\Dropbox\LEO EDITOR\leo\core\leoPlugins.py", line 556, in loadOnePlugin
    __import__(moduleName)
  File "D:\Dropbox\LEO EDITOR\leo\plugins\pretty_print.py", line 28, in <module>
    oldPrettyPrinter = leoCommands.Commands.prettyPrinter
AttributeError: type object 'Commands' has no attribute 'prettyPrinter'
loadOnePlugin: can not load enabled plugin: leo.plugins.pretty_print
reading: D:\Dropbox\LEO EDITOR\leo\config\myleoSettings.leo
hook failed: create-optional-menus, <function create_UserMenu at 0x0276CEB0>, leo.plugins.mnplugins
Traceback (most recent call last):
  File "D:\Dropbox\LEO EDITOR\leo\core\leoPlugins.py", line 336, in callTagHandler
    result = handler(tag,keywords)
  File "D:\Dropbox\LEO EDITOR\leo\plugins\mnplugins.py", line 136, in create_UserMenu
    c.frame.menu.createMenuEntries(c.pluginMenu,table,dynamicMenu=True)
AttributeError: 'Commands' object has no attribute 'pluginMenu'
hook failed: after-create-leo-frame, <function onCreate at 0x0276C0B0>, leo.plugins.leoscreen
Traceback (most recent call last):
  File "D:\Dropbox\LEO EDITOR\leo\core\leoPlugins.py", line 336, in callTagHandler
    result = handler(tag,keywords)
  File "D:\Dropbox\LEO EDITOR\leo\plugins\leoscreen.py", line 176, in onCreate
    leoscreen_Controller(c)
  File "D:\Dropbox\LEO EDITOR\leo\plugins\leoscreen.py", line 214, in __init__
    self._get_output()  # prime output diffing system
  File "D:\Dropbox\LEO EDITOR\leo\plugins\leoscreen.py", line 284, in _get_output
    self.screen_cmd(['hardcopy -h "%s"'%self.tmpfile])
  File "D:\Dropbox\LEO EDITOR\leo\plugins\leoscreen.py", line 242, in screen_cmd
    stderr=subprocess.PIPE)  # screen's behavior
  File "C:\Python27\lib\subprocess.py", line 672, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 882, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

Edward K. Ream

unread,
May 27, 2013, 9:00:22 AM5/27/13
to leo-editor
On Mon, May 27, 2013 at 3:25 AM, Fidel Pérez <fidel...@gmail.com> wrote:
After a while I realized Im not using this feature, and here is the reason:

If I double click my desktop links to the leo files I use the most, they will open Leo alright, but they will open each in a new window, instead of incoroprating themselves to the leo window Im working with.

Yes.   I'm not sure how this could be changed so as to use an already-open Leo. 
[snip]

I suggest you disable the plugins that generate the error messages in the log.

Also, you may want to install docutils.

Terry Brown

unread,
May 27, 2013, 10:49:19 AM5/27/13
to leo-e...@googlegroups.com
On Mon, 27 May 2013 08:00:22 -0500
"Edward K. Ream" <edre...@gmail.com> wrote:

> On Mon, May 27, 2013 at 3:25 AM, Fidel Pérez <fidel...@gmail.com> wrote:
>
> > After a while I realized Im not using this feature, and here is the reason:
> >
> > If I double click my desktop links to the leo files I use the most, they
> > will open Leo alright, but they will open each in a new window, instead of
> > incoroprating themselves to the leo window Im working with.
> >
>
> Yes. I'm not sure how this could be changed so as to use an already-open
> Leo.

The leoserver plugin lets you do this. Here's my wrapper for loading
a .leo file from the command line into the existing Leo instance:

--- cut here ---
#!/usr/bin/python
import sys
sys.path.append("/home/tbrown/Package/leo/bzr/leo.repo/trunk")
from leo.external import lproto
import os

addr = open(os.path.expanduser('~/.leo/leoserv_sockname')).read()
pc = lproto.LProtoClient(addr)
pc.send("""
c = g.app.commanders()[0]
g.openWithFileName(%s, c)
""" % repr(os.path.join(os.getcwd(), sys.argv[1])) )
--- cut here ---

So you'd need to associate .leo files with this python code... and it
would also need to do something smart when Leo wasn't already running.

This only works with the leoserver plugin running of course.

Cheers -Terry

Edward K. Ream

unread,
May 27, 2013, 12:05:44 PM5/27/13
to leo-editor
On Mon, May 27, 2013 at 9:49 AM, Terry Brown <terry_...@yahoo.com> wrote:


> Yes.   I'm not sure how this could be changed so as to use an already-open
> Leo.

The leoserver plugin lets you do this.  Here's my wrapper for loading
a .leo file from the command line into the existing Leo instance:

[snip]

So you'd need to associate .leo files with this python code... and it
would also need to do something smart when Leo wasn't already running.

This only works with the leoserver plugin running of course.

Thanks for this.  I'm wondering, given that our focus is on installation issues, whether the leoserver plugin should be promoted into Leo's core, so that the standard install would "just work" in the way that Fidel would like.

Comments?

Edward

Fidel Pérez

unread,
May 27, 2013, 12:19:00 PM5/27/13
to leo-e...@googlegroups.com
Sounds great! -hehe-
And on top of that it will work similar to how internet browsers work (they open new links in a new tab) which is more intuitive for people since everybody uses them.
Moreover, support for session tracking and restoring becomes an instant addition since just by oppening all the @path leo nodes under a "session" node we can restore our session!

Terry Brown

unread,
May 27, 2013, 1:49:15 PM5/27/13
to leo-e...@googlegroups.com
On Mon, 27 May 2013 09:19:00 -0700 (PDT)
Fidel Pérez <fidel...@gmail.com> wrote:

> Moreover, support for session tracking and restoring becomes an instant
> addition since just by oppening all the @path leo nodes under a "session"
> node we can restore our session!

There was a thread about saving sessions some time ago. Here's a
script from that thread which adds a @script node to your outline which
reloads the other outlines currently loaded when this outline is next
loaded.

tablist = g.findNodeAnywhere(c, '@script load tabs')
if not tablist:
from leo.core.leoNodes import vnode
v = vnode(c)
v.h = '@script load tabs'
v._linkAsNthChild(c.hiddenRootNode,
len(c.hiddenRootNode.children))
tablist = g.findNodeAnywhere(c, '@script load tabs')
assert tablist
import time
b = ["# Generated %s\n"%time.strftime('%c')]
for oc in g.app.commanders():
b.append("g.openWithFileName('%s', c)" % oc.fileName())
b.append("c.frame.bringToFront()")
b.append("c.setLog()")
tablist.b = '\n'.join(b)
Reply all
Reply to author
Forward
0 new messages