Пример #1
0
def register_events(register: bool):
    global events_registered
    if register:
        if not events_registered and live_update:
            events_registered = True
            # registry.register('post:update_contexts', contexts_updated)
            registry.register("update_commands", commands_updated)
    else:
        events_registered = False
        # registry.unregister('post:update_contexts', contexts_updated)
        registry.unregister("update_commands", commands_updated)
Пример #2
0
    for i, entry in enumerate(function_list, 1):
        if entry in registry.lists["user.code_functions"][0]:
            gui.text(
                "{}. {}: {}".format(
                    i, entry, registry.lists["user.code_functions"][0][entry]
                )
            )


@imgui.open(software=False)
def gui_libraries(gui: imgui.GUI):
    gui.text("Libraries")
    gui.line()

    for i, entry in enumerate(library_list, 1):
        gui.text(
            "{}. {}: {}".format(
                i, entry, registry.lists["user.code_libraries"][0][entry]
            )
        )


def commands_updated(_):
    if gui_functions.showing:
        update_function_list_and_freeze()
    if gui_libraries.showing:
        update_library_list_and_freeze()


registry.register("update_commands", commands_updated)
Пример #3
0
    ui,
    Module,
    app,
    clip,
    registry,
    scope,
    speech_system,
)
import os
import re
from itertools import islice
import datetime


ui.register("win_focus", print)
registry.register("", print)
mod = Module()
pattern = re.compile(r"[A-Z][a-z]*|[a-z]+|\d")

# todo: should this be an action that lives elsewhere??
def create_name(text, max_len=20):
    return "_".join(list(islice(pattern.findall(text), max_len))).lower()


@mod.action_class
class Actions:
    def talon_add_context_clipboard_python():
        """Adds os-specific context info to the clipboard for the focused app for .py files. Assumes you've a Module named mod declared."""
        friendly_name = actions.app.name()
        # print(actions.app.executable())
        executable = actions.app.executable().split(os.path.sep)[-1]
Пример #4
0
def on_ready():
    # print("on_ready")
    on_update_decls(registry.decls)
    registry.register("update_decls", on_update_decls)
Пример #5
0
def on_ready():
    # print("on_ready")
    update_lists(registry.decls)
    registry.register("update_decls", update_lists)