Exemplo n.º 1
0
    def __init__(
        self,
        *args,
        bot=None,
        file_path=None,
        run=False,
        headless=False,
        step_by_step=False,
        **kwargs,
    ):
        super().__init__(*args, **kwargs)

        if not bot:
            bot = ThreadedBot()

        self.bot = bot

        if file_path:

            # Run a flow
            if run:

                # Run parameters
                if os.path.isfile("input/parameters.py"):
                    with open("input/parameters.py", "r",
                              encoding="utf-8") as f:
                        code = f.read()

                    bot.run(code)

                # Run Flow
                FlowPlayerWindow(
                    self,
                    flow=Flow(file_path),
                    bot=self.bot,
                    autoplay=True,
                    step_by_step=step_by_step,
                    autoclose=True,
                )

            # Edit the flow
            else:
                FlowDesignerWindow(self, bot=self.bot, flow=Flow(file_path))

        # New flow
        else:
            FlowDesignerWindow(self, bot=self.bot)

        # Run sounds better, right?
        self.run = self.mainloop
Exemplo n.º 2
0
    def run_click(self, event):
        self.add_highlight()
        from .windows import FlowPlayerWindow
        from automagica.flow import Flow

        _ = FlowPlayerWindow(
            self.parent.master,
            flow=Flow(self.node.subflow_path.replace('"', "")),
            bot=self.parent.master.master.bot,
            autoplay=True,
            step_by_step=False,
            autoclose=True,
        )

        self.remove_highlight()