On Wed, Aug 13, 2014 at 5:02 PM, 'Terry Brown' via leo-editor
<[email protected]> wrote:
> On Wed, 13 Aug 2014 14:31:21 -0700 (PDT)
> "Edward K. Ream" <[email protected]> wrote:
> It would be great to be able to type things like:
>
> d =
> read.csv("/mnt/usr1/usr1/home/tbrown/Proj/NPC/DLP-WSU-SSU/plots/wlsystem/splits.csv")
>
> with the help of filename completion. So not actually accessing the
> file, just typing its name.
Great idea. Let's see if I can code it right now...
k.getFileName now takes a callback argument, a function to be called
when the file name is completed. The callback takes a single argument,
the completed file name.
The following @command node works, invoked using the shortcut or from
the minibuffer:
@command insert-file-name @key=Alt-8
w = g.app.gui.get_focus()
w_name = g.app.gui.widget_name(w)
if w_name == 'richTextEdit':
w = c.frame.body
elif w_name.startswith('head'):
w = w.wrapper
else:
w = None
if w:
def callback(arg,w=w):
i = w.getInsertPoint()
w.insert(i,arg)
# Undo only if we are in the body.
if w_name == 'richTextEdit':
c.frame.body.onBodyChanged(undoType='Typing')
# oldSel=None,oldText=None,oldYview=None)
c.k.getFileName(callback=callback)
else:
g.es('not a text widget',w_name)
I'll make this an official Leo command 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.