Beispiel #1
0
 def update_layout(self):
     if self.overview:
         self.layout = Layout(
             HSplit([
                 self.header,
                 VSplit([
                     HSplit(self.server_windows),
                     HSplit([
                         self.overview,
                         Window(FormattedTextControl(
                             text="[Ins ][Home][PgUp]\n[Del ][End ][PgDn]"),
                                style="class:overview",
                                height=2,
                                align=WindowAlign.CENTER,
                                dont_extend_height=True),
                     ]),
                 ]),
                 self.footer,
             ]), )
     else:
         self.layout = Layout(
             HSplit([
                 self.header,
                 VSplit([
                     HSplit(self.server_windows),
                 ]),
                 self.footer,
             ]), )
Beispiel #2
0
    def _get_windows(root_container):
        root_container = root_container.create()
        layout = Layout(root_container)
        all_windows = layout.find_all_windows()
        windows = []
        for window in all_windows:
            windows.append(window)

        return windows
Beispiel #3
0
def toggle_convo_list():
    global chat_area
    if chat_area:
        app.layout = Layout(root)
        app.layout.focus(convos)
        chat_area = False
        change_cursor(1)
    else:
        app.layout = Layout(chat_container)
        app.layout.focus(input_buf)
        chat_area = True
        change_cursor(vi_mode_to_cursor(get_input_mode))
Beispiel #4
0
    def on_resize(self):
        cols, rows = os.get_terminal_size(0)
        focused_element = self.layout.current_window
        if cols >= 2 * rows:  # fat
            self.app.layout = Layout(self.container_fat,
                                     focused_element=focused_element)
        else:  # tall
            self.app.layout = Layout(self.container_tall,
                                     focused_element=focused_element)

        self.app.renderer.erase(leave_alternate_screen=False)
        self.app._request_absolute_cursor_position()
        self.app._redraw()
Beispiel #5
0
    def __init__(
        self,
        state,
    ):
        self.state = state
        self.kb = KeyBindings()

        # layout components
        self.header_bar = FormattedTextControl(focusable=False, )
        self.input_buffer = Buffer(multiline=False, )
        self.input_buffer.on_text_changed += self.update_results
        self.results_control = SelectableList(text="")
        self.preview_bar = FormattedTextControl(focusable=False, )
        self.preview_buffer = BufferControl(
            input_processors=[TabsProcessor(tabstop=4, char1="", char2="")],
            focusable=False,
        )
        self.status_bar = FormattedTextControl()
        self.layout = Layout(
            HSplit([
                Window(self.header_bar, height=1, style="reverse"),
                Window(
                    BufferControl(self.input_buffer),
                    height=1,
                ),
                Window(self.results_control,
                       height=Dimension(**RESULTS_DIMENSION_DICT)),
                Window(self.preview_bar, height=1, style="reverse"),
                Window(
                    self.preview_buffer,
                    wrap_lines=True,
                    height=Dimension(**PREVIEW_DIMENSION_DICT),
                ),
                Window(self.status_bar, height=1, style="reverse"),
            ]), )
        self.reset_view()

        @self.kb.add("up")
        def _(event):
            self.results_control.index -= 1
            self.update_preview()

        @self.kb.add("down")
        def _(event):
            self.results_control.index += 1
            self.update_preview()

        @self.kb.add("enter")
        def _(event):
            self.select_collection()
            self.reset_view()
Beispiel #6
0
    def __init__(self, manager: mp.Manager, shared_state: dict, rpc_channel: mp.Queue):
        self.manager = manager
        self.shared_state = shared_state
        self.rpc_channel = rpc_channel

        self.fileman = Filemanager(self)
        self.fileman_visible = True

        self.toolbar = Toolbar(self)

        self.views = OrderedDict()  # type: Dict[str, SimpleView]

        self.app = Application(
            full_screen=True,
            mouse_support=True,
            color_depth=ColorDepth.DEPTH_24_BIT,
            clipboard=InMemoryClipboard(),
            enable_page_navigation_bindings=False,
            # key_bindings=get_filemanager_kb()
            layout=Layout(
                container=HSplit([
                    DynamicContainer(self._get_children),
                    DynamicContainer(lambda: self.toolbar)
                ]),
                # focused_element=(self.current_view or self.fileman).input_field,
            ),
        )
Beispiel #7
0
    def __init__(self, inpipe):
        self.inpipe = inpipe
        self.tempfile = tempfile.NamedTemporaryFile(mode="w", delete=True)
        self.initialize_nodes()

        root = VSplit(
            [
                # Input buffer and status line
                HSplit(
                    [
                        self.first_line,
                        Window(
                            content=BufferControl(
                                buffer=self.input_buffer,
                                # This lexer is disabled for now because
                                # I don't want to mess with colourschemes
                                # lexer=PygmentsLexer(PythonLexer),
                            )
                        ),
                        self.error_output,
                    ],
                    width=Dimension(),
                ),
                Window(width=1, char="|"),
                # Output display area
                Window(ignore_content_width=True, content=self.output, wrap_lines=True),
            ],
            width=Dimension(),
        )

        layout = Layout(root)

        self.app = Application(layout=layout, key_bindings=kb, full_screen=True)
Beispiel #8
0
    def main(self):
        session = PromptSession(message="> ",
                                enable_history_search=True,
                                auto_suggest=AutoCompleter(),
                                history=FileHistory(HISTORY_FILE))
        app = session.app
        textarea = TextArea(text=WELCOME_MSG, read_only=False, scrollbar=True)
        app.layout.container.height = 1
        mainlayout = HSplit([textarea, app.layout.container])
        app.layout = Layout(mainlayout, app.layout.current_control)

        # monkey patch fullscreen mode
        app.full_screen = True
        app.renderer.full_screen = True

        def accept(buf):
            if buf.text == "exit":
                app.exit(result="")
            else:
                newtext = self.cmd_parser.parse(buf.text)
                textarea.text = textarea.text + "\n" + newtext
                textarea.buffer.cursor_position = len(textarea.text)
                buf.reset(append_to_history=True)

        session.default_buffer.accept_handler = accept
        try:
            app.run()
        except (KeyboardInterrupt, EOFError):  # ctrl+c or ctrl+d
            pass
Beispiel #9
0
 def show_help(self):
     self.help_mode = True
     self.help_text = rich_print(md)
     self.help_window = Window(content=FormattedTextControl(
         text=ANSI(self.help_text)))
     self.app.layout = Layout(self.help_window)
     self.help_line = 0
Beispiel #10
0
    def init_layout(self):
        for i in range(len(self.top_screens)):
            s = self.top_screens[i]
            s.app = self
            s.screen_idx = i
            self.screen_sel_buttons.append(
                Button(text="%s %s" % (s.shortcut.upper(), s.shortcut_label),
                       handler=s.screen_sel))

        self.lbl_screen = Label(text=self.top_screens[0].title)

        self.top_screen = DynamicContainer(self.get_top_screen_container)

        btn_action = Button(text="F8 Action", handler=self.f_action)
        btn_exit = Button(text="F10 Exit", handler=self.f_exit)

        self.root_container = FloatContainer(
            HSplit([
                Box(
                    body=VSplit([self.lbl_screen], align="CENTER", padding=3),
                    style="class:button-bar",
                    height=1,
                ),
                self.top_screen,
                Box(
                    body=VSplit(self.screen_sel_buttons +
                                [btn_action, btn_exit],
                                align="CENTER",
                                padding=3),
                    style="class:button-bar",
                    height=1,
                ),
            ]), self.floats)
        self.top_layout = Layout(self.root_container,
                                 focused_element=self.screen_sel_buttons[0])
Beispiel #11
0
async def main():
    ''' Main stuff '''
    application = Application(
        layout=Layout(container),
        key_bindings=bindings,
        mouse_support=False,
        full_screen=True,
        style=Style.from_dict({
            #'dialog': 'bg:#cdbbb3',
            #'button': 'bg:#bf99a4',
            'checkbox': '#a4a24f',
            #'dialog.body': 'bg:#a9cfd0',
            'select-checked': 'fg:#000000 bg:#b0e2ff bold',
            'select-selected': 'fg:#000000 bg:#b0e0e6 bold',
            #'dialog shadow': 'bg:#c98982',
            'frame.label': '#884444 bold',
            #'dialog.body label': '#fd8bb6',
            'info': 'fg:#27408b bold',
        })
    )

    #background_task_tune = asyncio.create_task(tune(application))
    background_task_update_spots = asyncio.create_task(
        update_spots(application))

    try:
        await application.run_async()
    finally:
        background_task_update_spots.cancel()
    def editor_window(self):
        """configure the editor window and returns a application class"""
        self.buffer_1 = Buffer()  # need the text in another method
        self.text = self.open_file()

        f_ext = pathlib.PurePath(self.file_abs_path).suffix

        # set container(s)
        self.buffer_1.text = self.text
        style_n = style_from_pygments_cls(get_style_by_name("friendly"))
        container = Window(
            BufferControl(buffer=self.buffer_1, lexer=syntax_highlight(f_ext)))

        # create layout
        layout_editor = Layout(container)

        # make an instance from keybinds method
        key_bind = self.key_binds("")

        # define application that will be started
        app = Application(layout=layout_editor,
                          key_bindings=key_bind,
                          full_screen=True,
                          style=style_n)

        return app
Beispiel #13
0
def generate_layout(input_field: TextArea, output_field: TextArea,
                    log_field: TextArea):
    root_container = VSplit([
        FloatContainer(
            HSplit([
                output_field,
                Window(height=1, char='-', style='class:line'),
                input_field,
                TextArea(
                    height=1,
                    text=
                    f'Version: {version}    [Ctrl + C] QUIT    Hold down "fn" for selecting and copying text',
                    style='class:label'),
            ]),
            [
                # Completion menus.
                Float(xcursor=True,
                      ycursor=True,
                      transparent=True,
                      content=CompletionsMenu(max_height=16, scroll_offset=1)),
            ]),
        Window(width=1, char='|', style='class:line'),
        log_field,
    ])
    return Layout(root_container, focused_element=input_field)
def generate_layout(input_field: TextArea, output_field: TextArea,
                    log_field: TextArea, search_field: SearchToolbar):
    root_container = HSplit([
        VSplit([
            Window(FormattedTextControl(get_version), style="class:title"),
            Window(FormattedTextControl(get_paper_trade_status),
                   style="class:title"),
            Window(FormattedTextControl(get_title_bar_right_text),
                   align=WindowAlign.RIGHT,
                   style="class:title"),
        ],
               height=1),
        VSplit([
            FloatContainer(
                HSplit([
                    output_field,
                    Window(height=1, char='-', style='class:primary'),
                    input_field,
                ]),
                [
                    # Completion menus.
                    Float(xcursor=True,
                          ycursor=True,
                          transparent=True,
                          content=CompletionsMenu(max_height=16,
                                                  scroll_offset=1)),
                ]),
            Window(width=1, char='|', style='class:primary'),
            HSplit([
                log_field,
                search_field,
            ]),
        ]),
    ])
    return Layout(root_container, focused_element=input_field)
Beispiel #15
0
def application():

    root_container = VSplit([
        # One window that holds the BufferControl with the default buffer on
        # the left.
        input_field,

        # A vertical line in the middle. We explicitly specify the width, to
        # make sure that the layout engine will not try to divide the whole
        # width by three for all these windows. The window will simply fill its
        # content by repeating this character.
        Window(width=1, char='|'),

        # Display the text 'Hello world' on the right.
        Window(content=BufferControl(buffer=right_buffer)),
    ])

    layout = Layout(root_container)

    # TODO : different layout if input/output not a terminal...
    application = Application(
        key_bindings=kb,
        layout=layout,
        full_screen=True,
    )
    return application
Beispiel #16
0
    def _create_layout(self):
        has_before_fragments, get_prompt_text_1, get_prompt_text_2 = \
            _split_multiline_prompt(self._get_prompt)

        default_buffer = self.default_buffer

        default_buffer_control = BufferControl(
            buffer=default_buffer,
            search_buffer_control=None,
            input_processors=[],
            include_default_input_processors=False)

        prompt_window = Window(FormattedTextControl(get_prompt_text_1),
                               dont_extend_height=True)
        default_buffer_window = Window(
            default_buffer_control,
            dont_extend_height=True,
            get_line_prefix=partial(self._get_line_prefix,
                                    get_prompt_text_2=get_prompt_text_2))
        divider = Window(char='_', height=1, style='fg:gray bg:black')
        search_window = Window(content=SearchControl(), style='')
        bottom_toolbar = ConditionalContainer(
            Window(FormattedTextControl(lambda: self.bottom_toolbar),
                   dont_extend_height=True,
                   height=Dimension(min=1)),
            filter=~is_done & renderer_height_is_known
            & Condition(lambda: self.bottom_toolbar is not None))

        layout = HSplit([
            prompt_window, default_buffer_window, divider, search_window,
            bottom_toolbar
        ])

        return Layout(layout, default_buffer_window)
Beispiel #17
0
def make_app(path_to_checklist, new_session):
    session = ChecklistSession(path_to_checklist, new_session)
    checklist = session.load()

    def status_bar_text():
        items = checklist.items()
        return "{name} : {checked}/{total} done | 'q': quit | 'z': undo | '?' help | <up>/<down> moves | <space> toggles".format(
            name=checklist.name,
            checked=len([i for i in items if i.checked]),
            total=len(items))

    checklist_window = Window(ChecklistControl(checklist, session),
                              left_margins=[NumberedMargin()],
                              right_margins=[
                                  ScrollbarMargin(display_arrows=True),
                              ])
    status_bar_window = Window(content=FormattedTextControl(status_bar_text),
                               height=1,
                               style='reverse')

    root_container = FloatContainer(
        content=HSplit([
            checklist_window,
            status_bar_window,
        ]),
        floats=[],
    )

    if session.duplicates:
        root_container.floats.append(
            Float(content=DuplicatesWarningDialog(session.duplicates)))

    return Application(layout=Layout(root_container),
                       full_screen=True,
                       key_bindings=build_key_bindings())
Beispiel #18
0
 def create_layout(self):
     inout_cells = list(
         itertools.chain.from_iterable([(
             VSplit([cell.input_prefix, cell.input]),
             VSplit([cell.output_prefix, ONE_COL, cell.output]),
         ) for cell in self.cells]))
     root_container = ScrollablePane(HSplit(inout_cells))
     self.layout = Layout(root_container)
Beispiel #19
0
def build_app(args, original_text):
    input_field = Buffer()
    output_field = FormattedTextControl(original_text)
    message_field = FormattedTextControl('Enter regexp below:')

    input_window = Window(BufferControl(buffer=input_field), height=1)
    message_window = Window(message_field, height=1)
    output_window = Window(output_field)

    body = HSplit([
        output_window,
        Window(height=1, char="-", style="class:line"),
        message_window,
        Window(height=1, char="-", style="class:line"),
        input_window,
        Window(height=1, char="-", style="class:line"),
    ])

    title_window = Window(
        height=1,
        content=FormattedTextControl("Press [Ctrl-C] to quit."),
        align=WindowAlign.CENTER,
    )

    root_container = HSplit(
        [title_window,
         Window(height=1, char="-", style="class:line"), body])

    highlight = get_highlighting_function(args)

    kb = KeyBindings()

    @kb.add("c-c", eager=True)
    def _(event):
        event.app.exit()

    def handle_keypress(_):
        if len(input_field.text) == 0:
            output_field.text = original_text
            return

        try:
            output_field.text = highlight(input_field.text, original_text)
            message_field.text = 'Enter regexp below:'
        except re.error as e:
            output_field.text = original_text
            message_field.text = HTML('<red>Error: {}</red>'.format(e.msg))

    input_field.on_text_changed += handle_keypress

    application = Application(
        layout=Layout(root_container, focused_element=input_window),
        key_bindings=kb,
        mouse_support=False,
        full_screen=True,
    )

    return application
Beispiel #20
0
    def run(self):
        self.app = Application(
            layout=Layout(self.container),
            key_bindings=get_key_bindings(),
            mouse_support=True,
            full_screen=True,
        )

        self.app.run()
Beispiel #21
0
async def shell():
    global crow
    input_field = TextArea(height=1,
                           prompt='> ',
                           style='class:input-field',
                           multiline=False,
                           wrap_lines=False)

    captures = VSplit([capture1, capture2])
    container = HSplit([
        captures, output_field,
        Window(height=1,
               char='/',
               style='class:line',
               content=FormattedTextControl(text='druid////'),
               align=WindowAlign.RIGHT), input_field
    ])

    def cwrite(xs):
        global crow
        try:
            crow.write(xs)
        except:
            crowreconnect()

    def accept(buff):
        try:
            myprint('\n> ' + input_field.text + '\n')
            druidparser(cwrite, input_field.text)
        except ValueError as err:
            print(err)
            get_app().exit()

    input_field.accept_handler = accept

    kb = KeyBindings()

    @kb.add('c-c', eager=True)
    @kb.add('c-q', eager=True)
    def _(event):
        event.app.exit()

    style = Style([
        ('capture-field', '#747369'),
        ('output-field', '#d3d0c8'),
        ('input-field', '#f2f0ec'),
        ('line', '#747369'),
    ])

    application = Application(
        layout=Layout(container, focused_element=input_field),
        key_bindings=kb,
        style=style,
        mouse_support=True,
        full_screen=True,
    )
    result = await application.run_async()
Beispiel #22
0
    def __init__(self,
                 options,
                 default_index=0,
                 header_filter=lambda x: x,
                 match_filter=lambda x: x):

        self.info_window = InfoWindow()
        self.help_window = HelpWindow()
        self.message_toolbar = MessageToolbar(style="class:message_toolbar")
        self.error_toolbar = MessageToolbar(style="class:error_toolbar")
        self.status_line = MessageToolbar(style="class:status_line")
        self.status_line_format = user._tui_status_line_format

        self.options_list = OptionsList(
            options,
            default_index,
            header_filter,
            match_filter,
            custom_filter=~has_focus(self.help_window))
        self.options_list.search_buffer.on_text_changed += self.update

        cmd, cmd_key_bindings = command_key_bindings(self)
        self.command_line_prompt = CommandLinePrompt(commands=cmd)
        key_bindings = merge_key_bindings(
            [general_key_bindings(self), cmd_key_bindings])

        _root_container = HSplit([
            HSplit([
                Window(content=BufferControl(
                    input_processors=[BeforeInput('> ')],
                    buffer=self.options_list.search_buffer)),
                self.options_list,
                self.info_window,
            ]),
            self.help_window,
            self.error_toolbar,
            self.message_toolbar,
            self.status_line,
            self.command_line_prompt.window,
        ])

        self.set_help_text()
        self.layout = Layout(_root_container)

        super(Picker, self).__init__(
            input=None,
            output=None,
            editing_mode=EditingMode.EMACS
            if user._tui_edit_mode == 'emacs' else EditingMode.VI,
            layout=self.layout,
            style=Style.from_dict(user_styles.get_user_styles()),
            key_bindings=key_bindings,
            include_default_pygments_style=False,
            full_screen=True,
            enable_page_navigation_bindings=True)
        self.update()
Beispiel #23
0
 def update_layout(self):
     if self.overview_visible:
         self.layout = Layout(
             VSplit([
                 HSplit(self.server_windows + [self.help_bar]),
                 HSplit([
                     self.overview_window,
                     Window(FormattedTextControl(text="[Ins ][Home][PgUp]\n[Del ][End ][PgDn]"),
                            style="bg:#202020 fg:ansigray", height=2, align=WindowAlign.CENTER,
                            dont_extend_height=True),
                 ]),
             ]),
         )
     else:
         self.layout = Layout(
             VSplit([
                 HSplit(self.server_windows + [self.help_bar]),
             ]),
         )
Beispiel #24
0
 def run(self):
     app = Application(
         layout=Layout(self.container,
                       focused_element=self.container.input_area),
         key_bindings=self.key_bindings,
         style=self.styles,
         mouse_support=False,
         full_screen=True,
     )
     return app.run()
Beispiel #25
0
def build_cluster_status():
    ctx = context()
    build_cluster_status_command()
    # building pods container
    bad_pod_text_control = FormattedTextControl(
        text=lambda: CONTENT_VENDERER['pod_text'])
    bad_pod_win = Win(content=bad_pod_text_control)
    bad_pod_title = ctx.obj['watch_bad_pod_title']
    bad_pod_container = HSplit([
        Win(
            height=1,
            content=Title(bad_pod_title),
        ),
        bad_pod_win,
    ])
    # building nodes container
    bad_node_text_control = FormattedTextControl(
        text=lambda: CONTENT_VENDERER['node_text'])
    bad_node_window = Win(content=bad_node_text_control)
    bad_node_container = HSplit([
        Win(
            height=1,
            content=Title('bad nodes'),
        ),
        bad_node_window,
    ])
    parts = [bad_pod_container, bad_node_container]
    global_urls = ctx.obj.get('global_urls')
    if global_urls:
        ingress_text_control = FormattedTextControl(
            text=lambda: CONTENT_VENDERER['ingress_text'])
        ingress_window = Win(content=ingress_text_control,
                             height=lambda: tell_screen_height(0.4))
        ingress_container = HSplit([
            Win(height=1, content=Title('bad url requests')),
            ingress_window,
        ])
        parts.append(ingress_container)

    # building root container
    root_container = HSplit(parts)
    kb = KeyBindings()

    @kb.add('c-c', eager=True)
    @kb.add('c-q', eager=True)
    def _(event):
        event.app.exit()

    app = Application(
        key_bindings=kb,
        layout=Layout(root_container),
        full_screen=True,
    )
    app.create_background_task(refresh_admin_content())
    return app
Beispiel #26
0
    def create_application(self):
        self.application = Application(
            layout=Layout(self.root_container),
            key_bindings=self.kb,

            # Let's add mouse support!
            mouse_support=True,

            # Using an alternate screen buffer means as much as: "run full screen".
            # It switches the terminal to an alternate screen.
            full_screen=True)
Beispiel #27
0
 def __init__(self, *args, **kwargs):
     console = kwargs.get('console')
     if console is None:
         raise Exception("No root console passed to the application")
     #console.__class__ = type("ConsoleTextArea", (TextArea, console.__class__), {})
     #console.scrollbar = True
     root_container = HSplit([
         console,
     ])
     kwargs['layout'] = Layout(root_container, focused_element=console)
     super(FrameworkApp, self).__init__(*args, **kwargs)
Beispiel #28
0
def buildcontainers():
    body_container = HSplit([
        top_right_win,
        Window(height=1, char='-', style='class:line'), bottom_right_win
    ])

    root_container = VSplit([
        left_win,
        Window(width=1, char='|', style="class:line"), body_container
    ])
    initiallayout = Layout(root_container, focused_element=left_win)
    return initiallayout
Beispiel #29
0
    def __init__(self, loop, txClbk, vehListClk, vehObjClk, cmdProcessClk,
                 prntr, settingsDir, isGUI, wxAppPersistMgr):
        BaseModule.__init__(self, loop, txClbk, vehListClk, vehObjClk,
                            cmdProcessClk, prntr, settingsDir, isGUI,
                            wxAppPersistMgr)
        self.tabs = []  # all the vehicles, one in each tab

        # commands
        self.shortName = "terminal"

        self.tabbar = []

        self.style_extensions = {
            # Tabs
            'tabbar': 'noinherit',
            'tabbar.tab': '',
            'tabbar.tab.active': 'bold noinherit reverse',
        }

        self.current_style = Style.from_dict(self.style_extensions)

        # make the screen
        self.hscreen = []
        self.hscreen.append(
            Window(height=1,
                   content=FormattedTextControl(self.tabbar,
                                                style='class:tabbar'),
                   align=WindowAlign.LEFT))
        self.hscreen.append(Window(height=1, char='-', style='class:line'))
        self.hscreen.append(Window(content=None, wrap_lines=True))
        self.hscreen.append(Window(height=1, char='-', style='class:line'))
        self.hscreen.append(Window(height=1, content=None))

        self.root_container = HSplit(self.hscreen)
        self.layout = Layout(self.root_container)

        self.application = Application(layout=self.layout,
                                       key_bindings=KB,
                                       full_screen=True,
                                       style=self.current_style)

        # event linkages
        self.application.nextTab = self.nextTab

        # initial layout
        self.tabbar.append(('class:tabbar.tab', ' {0} '.format("tmp")))
        self.tabbar.append(('class:tabbar', ' '))
        self.hscreen[0].content = FormattedTextControl(self.tabbar,
                                                       style='class:tabbar')
        self.hscreen[2].content = BufferControl(focusable=False)
        self.hscreen[4].content = BufferControl(focusable=True)

        asyncio.ensure_future(self.runUI())
Beispiel #30
0
def main():
    app = Application(layout=Layout(root_container.create(),
                                    focused_element=servers.content),
                      key_bindings=kb,
                      editing_mode=EditingMode.VI,
                      style=style,
                      mouse_support=True,
                      full_screen=True,
                      after_render=on_startup)

    asyncio.get_event_loop().run_until_complete(
        app.run_async().to_asyncio_future())