Esempio n. 1
0
def flow_edit(file_path):
    """
    `automagica flow edit <filename>` opens an existing Automagica Flow for editing
    """
    root = AutomagicaTk()
    _ = FlowApp(root, file_path=file_path)
    root.mainloop()
Esempio n. 2
0
def bot():
    """
    'automagica bot' launches the Automagica Bot
    """
    root = AutomagicaTk()
    _ = BotApp(root)
    root.mainloop()
Esempio n. 3
0
def flow_new():
    """
    `automagica flow new` creates a new Automagica Flow
    """
    root = AutomagicaTk()
    _ = FlowApp(root)
    root.mainloop()
Esempio n. 4
0
def wand(delay=0):
    """
    `automagica wand` launches the Automagica Wand
    """
    def on_finish(automagica_id):
        """
        Callback function when Automagica Wand is closed
        """
        print(f"Automagica ID: {automagica_id}")
        os._exit(0)

    root = AutomagicaTk()
    _ = WandApp(root, delay=delay, on_finish=on_finish)
    root.mainloop()
Esempio n. 5
0
def flow_run(filename, headless, step_by_step):
    """
    `automagica flow run <filename>` opens an existing Automagica Flow and executes it
    """
    root = AutomagicaTk()

    # Run FLow
    app = FlowApp(
        root,
        file_path=filename,
        run=True,
        headless=headless,
        step_by_step=step_by_step,
    )

    root.mainloop()
Esempio n. 6
0
def trace_record():
    root = AutomagicaTk()
    _ = TraceApp(root)
    root.mainloop()
Esempio n. 7
0
import pytest

from automagica.gui.apps import AutomagicaTk

# This is required to launch a single instance of the Tkinter interpreter
# as launching the Tkinter interpreter multiple times from within the same
# Python process causes problems.
pytest.automagica_tk = AutomagicaTk()
Esempio n. 8
0
    """
    Protocol handler for URLS with the automagica://-protocol
    This allows to immediate launch Automagica Flow for example from a website URL
    """
    url = sys.argv[1]

    url = url.replace("automagica://", "")

    parts = url.split("/")

    os.chdir(os.path.expanduser("~"))

    # Automagica Flow (automagica://flow/new)
    if parts[0] == "flow":
        if parts[1] == "new":
            root = AutomagicaTk()
            _ = FlowApp(root)
            root.mainloop()

    # Automagica Lab (automagica://lab/new)
    if parts[0] == "lab":
        if parts[1] == "new":
            app = LabApp()
            app.new()

    # Automagica Wand (automagica://wand)
    if parts[0] == "wand":
        root = AutomagicaTk()
        _ = WandApp(root)
        root.mainloop()