How to use the leo.core.leoGlobals.registerHandler 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 / settings_finder.py View on Github external
def init():
    '''Return True if the plugin has loaded successfully.'''
    g.registerHandler('after-create-leo-frame',onCreate)
    g.plugin_signon(__name__)
    return True
github leo-editor / leo-editor / leo / plugins / datenodes.py View on Github external
def init():
    '''Return True if the plugin has loaded successfully.'''
    g.registerHandler("after-create-leo-frame", on_create)
    g.plugin_signon(__name__)
    return True # OK for unit testing.
#@+node:gfunch.20041207100416.5: ** class DateNodes
github leo-editor / leo-editor / leo / plugins / toolbar.py View on Github external
def init ():
    """Initialize and register plugin."""

    ok = Tk and Pmw and g.app.gui.guiName() == "tkinter" and not g.app.unitTesting

    if ok:
        g.registerHandler('before-create-leo-frame',onPreCreate)
        g.registerHandler('after-create-leo-frame', onCreate)
        g.registerHandler('close-frame', onClose)

        tkGui.leoTkinterFrame = ToolbarTkinterFrame
        g.plugin_signon(__name__)

    return ok
#@+node:bobjack.20080424195922.11: *3* onPreCreate
github leo-editor / leo-editor / leo / plugins / obsolete / ipython.py View on Github external
def init ():
    '''Return True if the plugin has loaded successfully.'''
    print('**Important**: Use Leo\'s --ipython option instead of the ipython.py plugin.')
    if not import_ok:
        return False
    # This plugin depends on the properties of the gui's event loop.
    # It may work for other gui's, but this is not guaranteed.
    if g.app.gui and g.app.gui.guiName() == 'qt' and not g.app.useIpython:
        g.pr('ipython.py plugin disabled ("leo --ipython" enables it)')
        return False
    # Call onCreate after the commander and the key handler exist.
    g.registerHandler('after-create-leo-frame',onCreate)
    g.plugin_signon(__name__)
    return True
#@+node:ekr.20080201143145.5: *3* onCreate
github leo-editor / leo-editor / leo / plugins / run_nodes.py View on Github external
def init ():
    '''Return True if the plugin has loaded successfully.'''
    g.registerHandler("bodykey2",OnBodyKey)
    g.registerHandler("icondclick2",OnIconDoubleClick)
    g.registerHandler("end1",OnQuit)
    g.registerHandler("idle",OnIdle)
    g.plugin_signon(__name__)
    return True  # Ok for unit testing.
#@+node:ekr.20060108160737.1: ** Hooks
github leo-editor / leo-editor / leo / plugins / open_shell.py View on Github external
def init ():
    '''Return True if the plugin has loaded successfully.'''
    # Ok for unit testing: creates a new menu.
    g.registerHandler("after-create-leo-frame", onCreate)
    g.plugin_signon(__name__)
    return True
#@+node:ekr.20060107110126.1: ** onCreate
github leo-editor / leo-editor / leo / plugins / templates.py View on Github external
def init ():

    ok = import_succeed and g.app.gui.guiName() == "tkinter"

    if ok:
        initImages()
        g.registerHandler("after-create-leo-frame",addButtons)
        g.registerHandler("after-redraw-outline",drawImages)
        g.registerHandler(("new","open2"),scanForTemplates)
        g.plugin_signon(__name__)

    return ok
#@+node:ekr.20070301110439: ** initImages
github leo-editor / leo-editor / leo / plugins / shortcut_button.py View on Github external
def init ():

    ok = (
        rClickBasePluginClasses and mod_scripting and
        g.app.gui.guiName() == "tkinter" and
        not g.app.unitTesting
    )

    if ok:

        # Note: call onCreate _after_ reading the .leo file.
        # That is, the 'after-create-leo-frame' hook is too early!
        g.registerHandler(('new','open2'),onCreate)
        g.plugin_signon(__name__)

    return ok
#@+node:ekr.20060601151845.5: ** onCreate
github leo-editor / leo-editor / leo / plugins / viewrendered3.py View on Github external
return False
            # #1248.
    # if g.app.gui.guiName()
    if not QtWidgets or not g.app.gui.guiName().startswith('qt'):
        if (
            not g.unitTesting and
            not g.app.batchMode and
            g.app.gui.guiName() in ('browser', 'curses')  # EKR.
        ):
            g.es_print('viewrendered3 requires Qt')
        return False
    if not got_docutils:
        g.es_print('Warning: viewrendered3.py running without docutils.')
    # Always enable this plugin, even if imports fail.
    g.plugin_signon(__name__)
    g.registerHandler('after-create-leo-frame', onCreate)
    g.registerHandler('close-frame', onClose)
    g.registerHandler('scrolledMessage', show_scrolled_message)
    return True
#@+node:TomP.20191215195433.10: *3* vr3.isVisible
github leo-editor / leo-editor / leo / plugins / viewrendered3.py View on Github external
def activate(self):
        '''Activate the vr3-window.'''
        #VrC.activate(self)

        pc = self
        if pc.active: return
        pc.inited = True
        pc.active = True
        g.registerHandler('select2', pc.update)
        g.registerHandler('idle', pc.update)
    #@+node:TomP.20191215195433.45: *3* vr3.deactivate