1""" 
    2Dummy layout. Used when somebody creates an `Application` without specifying a 
    3`Layout`. 
    4""" 
    5 
    6from __future__ import annotations 
    7 
    8from prompt_toolkit.formatted_text import HTML 
    9from prompt_toolkit.key_binding import KeyBindings 
    10from prompt_toolkit.key_binding.key_processor import KeyPressEvent 
    11 
    12from .containers import Window 
    13from .controls import FormattedTextControl 
    14from .dimension import D 
    15from .layout import Layout 
    16 
    17__all__ = [ 
    18    "create_dummy_layout", 
    19] 
    20 
    21E = KeyPressEvent 
    22 
    23 
    24def create_dummy_layout() -> Layout: 
    25    """ 
    26    Create a dummy layout for use in an 'Application' that doesn't have a 
    27    layout specified. When ENTER is pressed, the application quits. 
    28    """ 
    29    kb = KeyBindings() 
    30 
    31    @kb.add("enter") 
    32    def enter(event: E) -> None: 
    33        event.app.exit() 
    34 
    35    control = FormattedTextControl( 
    36        HTML("No layout specified. Press <reverse>ENTER</reverse> to quit."), 
    37        key_bindings=kb, 
    38    ) 
    39    window = Window(content=control, height=D(min=1)) 
    40    return Layout(container=window, focused_element=window)