Example #1
0
def draw_commands_title(gui: imgui.GUI, title: str):
    global selected_context_page
    global total_page_count

    gui.text("{} ({}/{})".format(title, selected_context_page,
                                 total_page_count))
    gui.line()
Example #2
0
def gui_folders(gui: imgui.GUI):
    global current_folder_page, total_folder_pages
    total_folder_pages = math.ceil(
        len(ctx.lists["self.file_manager_directories"]) /
        len(selection_numbers))
    gui.text("Select a directory ({}/{})".format(current_folder_page,
                                                 total_folder_pages))
    gui.line()

    index = 1
    current_index = (current_folder_page - 1) * len(selection_numbers)

    while index <= len(selection_numbers) and current_index < len(
            folder_selections):
        gui.text("{}: {} ".format(index, folder_selections[current_index]))
        current_index += 1
        index = index + 1

    if total_folder_pages > 1:
        gui.spacer()

        if gui.button('Next...'):
            actions.user.file_manager_next_folder_page()

        if gui.button("Previous..."):
            actions.user.file_manager_previous_folder_page()
Example #3
0
def gui(gui: imgui.GUI):
    global history
#    gui.text("Command History")
#    gui.line()
    text = history[:] if hist_more else history[-hist_short_len:]
    for line in text:
        gui.text(line)
Example #4
0
def print_value(gui: imgui.GUI, path: str, value, ignore: set[str] = {}):
    if isinstance(value, dict):
        for key in value:
            if key not in ignore:
                p = f"{path}.{key}" if path else key
                print_value(gui, p, value[key])
    elif value:
        gui.text(f"{path}: {format_value(value)}")
Example #5
0
def gui(gui: imgui.GUI):
    global _gui_text
    # TODO: Guard this with a lock?
    with _gui_lock:
        if _gui_text:
            # TODO: Animate this?
            #
            # TODO: Make it red & bold?
            gui.text(_gui_text)
Example #6
0
def gui_folders(gui: imgui.GUI):
    global current_folder_page, total_folder_pages
    total_folder_pages = math.ceil(
        len(ctx.lists["self.file_manager_directories"]) /
        setting_imgui_limit.get())
    gui.text("Select a directory ({}/{})".format(current_folder_page,
                                                 total_folder_pages))
    gui.line()

    index = 1
    current_index = (current_folder_page - 1) * setting_imgui_limit.get()

    while index <= setting_imgui_limit.get() and current_index < len(
            folder_selections):
        name = ((
            folder_selections[current_index][:setting_imgui_string_limit.get()]
            + "..") if len(folder_selections[current_index]) >
                setting_imgui_string_limit.get() else
                folder_selections[current_index])
        gui.text("{}: {} ".format(index, name))
        current_index += 1
        index = index + 1

    # if total_folder_pages > 1:
    # gui.spacer()

    # if gui.button('Next...'):
    #    actions.user.file_manager_next_folder_page()

    # if gui.button("Previous..."):
    #   actions.user.file_manager_previous_folder_page()

    gui.spacer()
    if gui.button("Manager close"):
        actions.user.file_manager_hide_pickers()
Example #7
0
def gui(gui: imgui.GUI):
    global history
    #gui.text("Command History")
    #gui.line()
    text = history[:] if hist_more else history[-1:]
    for line in text:
        gui.text(line)

    gui.spacer()
    if gui.button("Command history close"):
        actions.user.history_disable()
Example #8
0
def gui_visible(gui: imgui.GUI):
    gui.text("Names of visible windows")
    gui.line()
    for line in ctx.lists["self.visible"]:
        gui.text(line)
    gui.spacer()
    if gui.button("Visible close"):
        actions.user.switcher_hide_visible()
Example #9
0
def gui_running(gui: imgui.GUI):
    gui.text("Names of running applications")
    gui.line()
    for line in ctx.lists["self.running"]:
        gui.text(line)
    gui.spacer()
    if gui.button("Running close"):
        actions.user.switcher_hide_running()
Example #10
0
def gui(gui: imgui.GUI):
    gui.text("Recent phrases")
    gui.line()
    for index, text in enumerate(
            phrase_history[:phrase_history_display_length], 1):
        gui.text(f"{index}: {text}")

    gui.spacer()
    if gui.button("Recent close"):
        actions.user.phrase_history_hide()
Example #11
0
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]))

    gui.spacer()
    if gui.button("Toggle libraries close"):
        actions.user.code_toggle_libraries_hide()
Example #12
0
def gui_alphabet(gui: imgui.GUI):
    global alphabet
    gui.text("Alphabet help")
    gui.line()

    for key, val in alphabet.items():
        gui.text("{}: {}".format(val, key))

    gui.spacer()
    if gui.button("close"):
        gui_alphabet.hide()
Example #13
0
def gui_formatters(gui: imgui.GUI):
    global formatters_words
    gui.text("formatters help")
    gui.line()

    for key, val in formatters_words.items():
        gui.text("{}: {}".format(val, key))

    gui.spacer()
    if gui.button("close"):
        gui_formatters.hide()
Example #14
0
def gui(gui: imgui.GUI):
    global history
    gui.text("Command History")
    gui.line()
    text = (history[:]
            if hist_more else history[-setting_command_history_display.get():])
    for line in text:
        gui.text(line)

    gui.spacer()
    if gui.button("Command history close"):
        actions.user.history_disable()
Example #15
0
def gui_functions(gui: imgui.GUI):
    gui.text("Functions")
    gui.line()

    # print(str(registry.lists["user.code_functions"]))
    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]))

    gui.spacer()
    if gui.button("Toggle funk (close window)"):
        actions.user.code_toggle_functions_hide()
def gui(gui: imgui.GUI):
    gui.text("Select a Microphone")
    gui.line()
    for index, item in enumerate(microphone_device_list, 1):
        if gui.button("{}. {}".format(index, item)):
            actions.user.microphone_select(index)

    gui.spacer()
    if gui.button("Microphone close"):
        actions.user.microphone_selection_hide()
Example #17
0
def gui(gui: imgui.GUI):
    global active_word_list
    if show_help:
        gui.text("Homephone help - todo")
    else:
        gui.text("Select a homophone")
        gui.line()
        index = 1
        for word in active_word_list:
            gui.text("Choose {}: {} ".format(index, word))
            index = index + 1

    if gui.button("Hide"):
        close_homophones()
Example #18
0
def gui(gui: imgui.GUI):
    global active_word_list
    if show_help:
        gui.text("Homephone help - todo")
    else:
        gui.text("Select a homophone")
        gui.line()
        index = 1
        for word in active_word_list:
            gui.text("Pick {}: {} ".format(index, word))
            index = index + 1
Example #19
0
def gui(gui: imgui.GUI):
    gui.text("snippets")
    gui.line()

    if "user.snippets" in registry.lists:
        function_list = sorted(registry.lists["user.snippets"][0].keys())
        # print(str(registry.lists["user.snippets"]))

        # print(str(registry.lists["user.code_functions"]))
        if function_list:
            for i, entry in enumerate(function_list):
                gui.text("{}".format(entry, function_list))

    gui.spacer()
    if gui.button("Snip close"):
        actions.user.snippet_hide()
def gui(gui: imgui.GUI):
    global shown_windows
    global window_spelling
    global groups
    gui.text("Select a window")
    index = 0
    for g in groups:
        gui.line()
        gui.text("desktop {}".format(g))
        for win in groups[g]:
            if gui.button("{} switch: {} ({})".format(window_spelling[index],
                                                      win.title,
                                                      win.app.name)):
                win.focus()
                close_gui_and_drawing()
            index = index + 1

    gui.line()
    if gui.button("close"):
        close_gui_and_drawing()
def gui_folders(gui: imgui.GUI):
    global current_folder_page, total_folder_pages
    total_folder_pages = math.ceil(
        len(ctx.lists["self.file_manager_directories"]) / setting_imgui_limit.get()
    )
    gui.text(
        "Select a directory ({}/{})".format(current_folder_page, total_folder_pages)
    )
    gui.line()

    index = 1
    current_index = (current_folder_page - 1) * setting_imgui_limit.get()

    while index <= setting_imgui_limit.get() and current_index < len(folder_selections):
        name = (
            (
                folder_selections[current_index][: setting_imgui_string_limit.get()]
                + ".."
            )
            if len(folder_selections[current_index]) > setting_imgui_string_limit.get()
            else folder_selections[current_index]
        )
        gui.text("{}: {} ".format(index, name))
        current_index += 1
        index = index + 1
Example #22
0
def gui(gui: imgui.GUI):
    gui.text("Command History")
    gui.line()
    text = history[:]
    # text = [str(x) for x in actions.core.recent_phrases()[:hist_len]]
    for line in text:
        gui.text(line)
Example #23
0
def draw_search_commands(gui: imgui.GUI):
    global search_phrase
    global total_page_count
    global cached_active_contexts_list
    global selected_context_page

    title = f"Search: {search_phrase}"
    commands_grouped = get_search_commands(search_phrase)
    commands_flat = list(
        itertools.chain.from_iterable(commands_grouped.values()))

    sorted_commands_grouped = sorted(
        commands_grouped.items(),
        key=lambda item: context_map[item[0]] not in
        cached_active_contexts_list,
    )

    pages = get_pages([
        sum(get_command_line_count(command) for command in commands) + 3
        for _, commands in sorted_commands_grouped
    ])
    total_page_count = max(pages, default=1)

    draw_commands_title(gui, title)

    current_item_index = 1
    for (context, commands), page in zip(sorted_commands_grouped, pages):
        if page == selected_context_page:
            gui.text(format_context_title(context))
            gui.line()
            draw_commands(gui, commands)
            gui.spacer()
Example #24
0
def gui(gui: imgui.GUI):
    gui.text("List formatters")
    gui.line()
    for name in sorted(set(formatters_words.keys())):
        gui.text(
            f"{name} | {format_text_helper(['one', 'two', 'three'], name, False)}"
        )
Example #25
0
def gui(gui: imgui.GUI):
    gui.text("List formatters")
    gui.line()
    for name in sorted(set(formatters_words.keys())):
        gui.text(
            f"{name} | {format_phrase_no_history(['one', 'two', 'three'], name)}"
        )
Example #26
0
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]))
Example #27
0
def gui(gui: imgui.GUI):
    global history
    gui.text("Command History")
    gui.line()
    text = history[:]
    for line in text:
        gui.text(line)
Example #28
0
def gui(gui: imgui.GUI):
    global personal_info_list
    gui.text("Select an entry")
    gui.line()
    index = 1
    for word in personal_info_list:
        gui.text("Pick {}: {} ".format(index, word))
        index = index + 1

    if gui.button("Hide"):
        close_personal_info()
Example #29
0
def gui(gui: imgui.GUI):
    global history
    gui.text("Command History")
    gui.line()
    text = (history[:]
            if hist_more else history[-setting_command_history_display.get():])
    for line in text:
        gui.text(line)
Example #30
0
def gui(gui: imgui.GUI):
    gui.text("Functions")
    gui.line()

    # print(str(registry.lists["user.code_functions"]))
    for i, entry in enumerate(function_list, 1):
        gui.text("{}. {}: {}".format(
            i, entry, registry.lists["user.code_functions"][0][entry]))