This fixes bug 807561: dragging a binary to Leo should create @url,
not @edit
https://bugs.launchpad.net/leo-editor/+bug/807561

Imo, this is a really nice hidden addition to Leo.

The only difficulty is determining what files are binary.  The
isBinaryFile helper does this.   Googling reveals that this is a hard
problem.  isBinaryFile  returns True if the extension is not known.
Not great, but safe.

The known extensions are:

1. '.css','.html','.leo','.txt'
2. All extensions in g.app.extension_dict.keys(), that is, all file
extensions that Leo can color.

This should take care of most non-binary cases.  Please let me if you
want to add another non-binary extension.

This is a minor matter, in fact, because the @url node created for
supposedly binary files will open the file regardless of its type.
The only difference is that you can see the text of non-binary files
in the .leo outline.

So, for example, it's debatable whether .svg files should be part of
the list.  At present, double-clicking the @url node brings up
Inkscape on my machine.  This is *probably* what is desired.

I suppose we could have an @data text-file-types option, but for now
the present code looks good enough.

Any comments, Amigos?

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to