def _create_app(self):
pymux = self.pymux<EOL>def on_focus_changed():<EOL><INDENT>"""<STR_LIT>"""<EOL>vi_state = app.vi_state<EOL>if app.current_buffer.read_only():<EOL><INDENT>vi_state.input_mode = InputMode.NAVIGATION<EOL><DEDENT>else:<EOL><INDENT>vi_state.input_mode = InputMode.INSERT<EOL><DEDENT><DEDENT>app = Application(<EOL>output=self.output,<EOL>input=self.input,<EOL>color_depth=self.color_depth,<EOL>layout=Layout(container=self.layout_manager.layout),<EOL>key_bindings=pymux.key_bindings_manager.key_bindings,<EOL>mouse_support=Condition(lambda: pymux.enable_mouse_support),<EOL>full_screen=True,<EOL>style=self.pymux.style,<EOL>style_transformation=ConditionalStyleTransformation(<EOL>SwapLightAndDarkStyleTransformation(),<EOL>Condition(lambda: self.pymux.swap_dark_and_light),<EOL>),<EOL>on_invalidate=(lambda _: pymux.invalidate()))<EOL>def sync_vi_state(_):<EOL><INDENT>VI = EditingMode.VI<EOL>EMACS = EditingMode.EMACS<EOL>if self.confirm_text or self.prompt_command or self.command_mode:<EOL><INDENT>app.editing_mode = VI if pymux.status_keys_vi_mode else EMACS<EOL><DEDENT>else:<EOL><INDENT>app.editing_mode = VI if pymux.mode_keys_vi_mode else EMACS<EOL><DEDENT><DEDENT>app.key_processor.before_key_press += sync_vi_state<EOL>app.key_processor.after_key_press += sync_vi_state<EOL>app.key_processor.after_key_press += self.sync_focus<EOL>app.max_render_postpone_time = <NUM_LIT>  <EOL>def key_pressed(_):<EOL><INDENT>self.message = None<EOL><DEDENT>app.key_processor.before_key_press += key_pressed<EOL>with set_app(app):<EOL><INDENT>pymux.invalidate()<EOL>pymux.startup()<EOL><DEDENT>return app<EOL>
Create `Application` instance for this .