How to use the leo.core.leoGlobals.command function in leo

To help you get started, we’ve selected a few leo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leo-editor / leo-editor / leo / plugins / gitarchive.py View on Github external
@g.command('git-log')
def git_log_f(event):
    c = event['c']
    p = c.p
    # os.chdir ??
    inf = contfile(c,p)
    print("f", inf)
    os.system("gitk %s" % inf)
#@-others
github leo-editor / leo-editor / leo / plugins / qtframecommands.py View on Github external
@g.command('detach-editor-toggle-max')
def detach_editor_toggle_max(event):
    """ Detach editor, maximize """
    c = event['c']
    detach_editor_toggle(event)
    if c.frame.detached_body_info is not None:
        wdg = c.frame.top.leo_body_frame
        wdg.showMaximized()
github leo-editor / leo-editor / leo / core / leoMarkup.py View on Github external
@g.command('pandoc-with-preview')
def pandoc_with_preview_command(event=None, verbose=True):
    """Run the pandoc command, then show the result in the browser."""
    c = event and event.get('c')
    if not c:
        return None
    return c.markupCommands.pandoc_command(event, preview=True, verbose=verbose)
#@+node:ekr.20191017163422.1: *3* @g.command: 'sphinx' & 'sphinx-with-preview'
github leo-editor / leo-editor / leo / core / leoImport.py View on Github external
@g.command('import-zim-folder')
def import_zim_command(event):
    """
    Import a zim folder, http://zim-wiki.org/, as the last top-level node of the outline.
    
    First use Zim to export your project to rst files.
    
    This command requires the following Leo settings::

        @int rst_level = 0
        @string rst_type
        @string zim_node_name
        @string path_to_zim
    """
    c = event.get('c')
    if c:
        ZimImportController(c).run()
github leo-editor / leo-editor / leo / plugins / viewrendered3.py View on Github external
@g.command('vr3-export-rst-html')
def export_rst_html(event):
    """Export rendering to system browser."""
    vr3 = getVr3(event)
    if not vr3:
        return
    try:
        _html = vr3.rst_html
    except NameError as e:
        g.es('=== %s: %s' % (type(e), e))
        return
    if not _html:
        return
    _html = g.toUnicode(_html)
    # Write to temp file
    c = vr3.c
    path = c.getNodePath(c.rootPosition())
github leo-editor / leo-editor / leo / plugins / projectwizard.py View on Github external
@g.command('project-wizard')
def project_wizard(event):
    """ Launch project wizard """
    import os
    c = event['c']
    table = [("All files","*"),
        ("Python files","*.py"),]

    fname = g.app.gui.runOpenFileDialog(c,
        title = "Open",filetypes = table,defaultextension = ".leo")

    pth = os.path.dirname(os.path.abspath(fname))

    g.es(pth)
    tgt = c.currentPosition().insertAsLastChild()
    c.selectPosition(tgt)
    auto_walk(c, pth, tgt)
github leo-editor / leo-editor / leo / commands / gotoCommands.py View on Github external
@g.command('show-file-line')
def show_file_line(event):
    c = event.get('c')
    if not c:
        return
    w = c.frame.body.wrapper
    if not w:
        return
    n0 = GoToCommands(c).find_node_start(p=c.p)
    if n0 is None:
        return
    i = w.getInsertPoint()
    s = w.getAllText()
    row, col = g.convertPythonIndexToRowCol(s, i)
    g.es_print(1 + n0 + row)
github leo-editor / leo-editor / leo / plugins / active_path.py View on Github external
@g.command('active-path-mark-content')
def cmd_MarkContent(event):
    """cmd_MarkContent - mark nodes in @path sub-tree with non-filesystem content

    i.e. not organizer nodes (no body), subdirs (body starts with @path)
    vanished file placeholders, or @ nodes.
    """
    c = event.get('c')
    p = c.p

    while not p.h.startswith("@path "):
        p.moveToParent()
        if not p:
            g.es("Not in a @path tree")
            return
    c.unmarkAll()
    def find_content(nd, count):
github leo-editor / leo-editor / leo / core / leoDebugger.py View on Github external
@g.command('db-again')
def xdb_again(event):
    """Repeat the previous xdb command."""
    xdb = getattr(g.app, 'xdb', None)
    if xdb:
        xdb.qc.put(xdb.lastcmd)
    else:
        print('xdb not active')
#@+node:ekr.20181003054157.1: *3* db-b
github leo-editor / leo-editor / leo / plugins / leoscreen.py View on Github external
@g.command('leoscreen-get-note')
def cmd_get_note(event):
    """get all of results"""
    c = event.get('c')
    c.leo_screen.get_note()
#@+node:tbrown.20100502155649.5603: ** cmd_show_note (leoscreen_Controller)