diff options
Diffstat (limited to 'examples/full-screen')
24 files changed, 28 insertions, 11 deletions
diff --git a/examples/full-screen/buttons.py b/examples/full-screen/buttons.py index 540194d..f741b26 100755 --- a/examples/full-screen/buttons.py +++ b/examples/full-screen/buttons.py @@ -2,6 +2,7 @@ """ A simple example of a few buttons and click handlers. """ + from prompt_toolkit.application import Application from prompt_toolkit.application.current import get_app from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/calculator.py b/examples/full-screen/calculator.py index 1cb513f..1f2b329 100755 --- a/examples/full-screen/calculator.py +++ b/examples/full-screen/calculator.py @@ -3,6 +3,7 @@ A simple example of a calculator program. This could be used as inspiration for a REPL. """ + from prompt_toolkit.application import Application from prompt_toolkit.document import Document from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/dummy-app.py b/examples/full-screen/dummy-app.py index 7ea7506..b9e246b 100755 --- a/examples/full-screen/dummy-app.py +++ b/examples/full-screen/dummy-app.py @@ -2,6 +2,7 @@ """ This is the most simple example possible. """ + from prompt_toolkit import Application app = Application(full_screen=False) diff --git a/examples/full-screen/full-screen-demo.py b/examples/full-screen/full-screen-demo.py index de7379a..af3ef5f 100755 --- a/examples/full-screen/full-screen-demo.py +++ b/examples/full-screen/full-screen-demo.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -""" -""" +""" """ + from pygments.lexers.html import HtmlLexer from prompt_toolkit.application import Application @@ -218,7 +218,7 @@ application = Application( def run(): result = application.run() - print("You said: %r" % result) + print(f"You said: {result!r}") if __name__ == "__main__": diff --git a/examples/full-screen/hello-world.py b/examples/full-screen/hello-world.py index b818018..86102d6 100755 --- a/examples/full-screen/hello-world.py +++ b/examples/full-screen/hello-world.py @@ -2,6 +2,7 @@ """ A simple example of a a text area displaying "Hello World!". """ + from prompt_toolkit.application import Application from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout import Layout diff --git a/examples/full-screen/no-layout.py b/examples/full-screen/no-layout.py index be5c6f8..a9961c0 100644 --- a/examples/full-screen/no-layout.py +++ b/examples/full-screen/no-layout.py @@ -2,6 +2,7 @@ """ An empty full screen application without layout. """ + from prompt_toolkit import Application Application(full_screen=True).run() diff --git a/examples/full-screen/pager.py b/examples/full-screen/pager.py index 799c834..61336a5 100755 --- a/examples/full-screen/pager.py +++ b/examples/full-screen/pager.py @@ -2,6 +2,7 @@ """ A simple application that shows a Pager application. """ + from pygments.lexers.python import PythonLexer from prompt_toolkit.application import Application @@ -28,10 +29,7 @@ def get_statusbar_text(): ("class:status", _pager_py_path + " - "), ( "class:status.position", - "{}:{}".format( - text_area.document.cursor_position_row + 1, - text_area.document.cursor_position_col + 1, - ), + f"{text_area.document.cursor_position_row + 1}:{text_area.document.cursor_position_col + 1}", ), ("class:status", " - Press "), ("class:status.key", "Ctrl-C"), diff --git a/examples/full-screen/scrollable-panes/simple-example.py b/examples/full-screen/scrollable-panes/simple-example.py index a94274f..cdf2674 100644 --- a/examples/full-screen/scrollable-panes/simple-example.py +++ b/examples/full-screen/scrollable-panes/simple-example.py @@ -2,6 +2,7 @@ """ A simple example of a scrollable pane. """ + from prompt_toolkit.application import Application from prompt_toolkit.application.current import get_app from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/scrollable-panes/with-completion-menu.py b/examples/full-screen/scrollable-panes/with-completion-menu.py index fba8d17..e08609d 100644 --- a/examples/full-screen/scrollable-panes/with-completion-menu.py +++ b/examples/full-screen/scrollable-panes/with-completion-menu.py @@ -2,6 +2,7 @@ """ A simple example of a scrollable pane. """ + from prompt_toolkit.application import Application from prompt_toolkit.application.current import get_app from prompt_toolkit.completion import WordCompleter diff --git a/examples/full-screen/simple-demos/alignment.py b/examples/full-screen/simple-demos/alignment.py index b20b43d..10a8044 100755 --- a/examples/full-screen/simple-demos/alignment.py +++ b/examples/full-screen/simple-demos/alignment.py @@ -2,6 +2,7 @@ """ Demo of the different Window alignment options. """ + from prompt_toolkit.application import Application from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout.containers import HSplit, Window, WindowAlign diff --git a/examples/full-screen/simple-demos/autocompletion.py b/examples/full-screen/simple-demos/autocompletion.py index bcbb594..f041637 100755 --- a/examples/full-screen/simple-demos/autocompletion.py +++ b/examples/full-screen/simple-demos/autocompletion.py @@ -6,6 +6,7 @@ completion. Important is to make sure that there is a `CompletionsMenu` in the layout, otherwise the completions won't be visible. """ + from prompt_toolkit.application import Application from prompt_toolkit.buffer import Buffer from prompt_toolkit.completion import WordCompleter diff --git a/examples/full-screen/simple-demos/colorcolumn.py b/examples/full-screen/simple-demos/colorcolumn.py index 054aa44..184b997 100755 --- a/examples/full-screen/simple-demos/colorcolumn.py +++ b/examples/full-screen/simple-demos/colorcolumn.py @@ -2,6 +2,7 @@ """ Colorcolumn example. """ + from prompt_toolkit.application import Application from prompt_toolkit.buffer import Buffer from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/simple-demos/cursorcolumn-cursorline.py b/examples/full-screen/simple-demos/cursorcolumn-cursorline.py index 505b3ee..a6eb5e6 100755 --- a/examples/full-screen/simple-demos/cursorcolumn-cursorline.py +++ b/examples/full-screen/simple-demos/cursorcolumn-cursorline.py @@ -2,6 +2,7 @@ """ Cursorcolumn / cursorline example. """ + from prompt_toolkit.application import Application from prompt_toolkit.buffer import Buffer from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/simple-demos/float-transparency.py b/examples/full-screen/simple-demos/float-transparency.py index 4dc38fc..a7a88c2 100755 --- a/examples/full-screen/simple-demos/float-transparency.py +++ b/examples/full-screen/simple-demos/float-transparency.py @@ -2,6 +2,7 @@ """ Example of the 'transparency' attribute of `Window' when used in a Float. """ + from prompt_toolkit.application import Application from prompt_toolkit.formatted_text import HTML from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/simple-demos/floats.py b/examples/full-screen/simple-demos/floats.py index 0d45be9..4d79c2b 100755 --- a/examples/full-screen/simple-demos/floats.py +++ b/examples/full-screen/simple-demos/floats.py @@ -2,6 +2,7 @@ """ Horizontal split example. """ + from prompt_toolkit.application import Application from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout.containers import Float, FloatContainer, Window diff --git a/examples/full-screen/simple-demos/focus.py b/examples/full-screen/simple-demos/focus.py index 9fe9b8f..fbf965e 100755 --- a/examples/full-screen/simple-demos/focus.py +++ b/examples/full-screen/simple-demos/focus.py @@ -2,6 +2,7 @@ """ Demonstration of how to programmatically focus a certain widget. """ + from prompt_toolkit.application import Application from prompt_toolkit.buffer import Buffer from prompt_toolkit.document import Document diff --git a/examples/full-screen/simple-demos/horizontal-align.py b/examples/full-screen/simple-demos/horizontal-align.py index bb0de12..038823a 100755 --- a/examples/full-screen/simple-demos/horizontal-align.py +++ b/examples/full-screen/simple-demos/horizontal-align.py @@ -2,6 +2,7 @@ """ Horizontal align demo with HSplit. """ + from prompt_toolkit.application import Application from prompt_toolkit.formatted_text import HTML from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/simple-demos/horizontal-split.py b/examples/full-screen/simple-demos/horizontal-split.py index 0427e67..660cd57 100755 --- a/examples/full-screen/simple-demos/horizontal-split.py +++ b/examples/full-screen/simple-demos/horizontal-split.py @@ -2,6 +2,7 @@ """ Horizontal split example. """ + from prompt_toolkit.application import Application from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout.containers import HSplit, Window diff --git a/examples/full-screen/simple-demos/line-prefixes.py b/examples/full-screen/simple-demos/line-prefixes.py index b52cb48..687d436 100755 --- a/examples/full-screen/simple-demos/line-prefixes.py +++ b/examples/full-screen/simple-demos/line-prefixes.py @@ -6,6 +6,7 @@ completion. Important is to make sure that there is a `CompletionsMenu` in the layout, otherwise the completions won't be visible. """ + from prompt_toolkit.application import Application from prompt_toolkit.buffer import Buffer from prompt_toolkit.filters import Condition diff --git a/examples/full-screen/simple-demos/margins.py b/examples/full-screen/simple-demos/margins.py index 467492d..b60ce0c 100755 --- a/examples/full-screen/simple-demos/margins.py +++ b/examples/full-screen/simple-demos/margins.py @@ -5,6 +5,7 @@ Example of Window margins. This is mainly used for displaying line numbers and scroll bars, but it could be used to display any other kind of information as well. """ + from prompt_toolkit.application import Application from prompt_toolkit.buffer import Buffer from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/simple-demos/vertical-align.py b/examples/full-screen/simple-demos/vertical-align.py index 1475d71..13b8504 100755 --- a/examples/full-screen/simple-demos/vertical-align.py +++ b/examples/full-screen/simple-demos/vertical-align.py @@ -2,6 +2,7 @@ """ Vertical align demo with VSplit. """ + from prompt_toolkit.application import Application from prompt_toolkit.formatted_text import HTML from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/simple-demos/vertical-split.py b/examples/full-screen/simple-demos/vertical-split.py index b48d106..2f4b66f 100755 --- a/examples/full-screen/simple-demos/vertical-split.py +++ b/examples/full-screen/simple-demos/vertical-split.py @@ -2,6 +2,7 @@ """ Vertical split example. """ + from prompt_toolkit.application import Application from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout.containers import VSplit, Window diff --git a/examples/full-screen/split-screen.py b/examples/full-screen/split-screen.py index af5403e..17e69c9 100755 --- a/examples/full-screen/split-screen.py +++ b/examples/full-screen/split-screen.py @@ -5,6 +5,7 @@ Simple example of a full screen application with a vertical split. This will show a window on the left for user input. When the user types, the reversed input is shown on the right. Pressing Ctrl-Q will quit the application. """ + from prompt_toolkit.application import Application from prompt_toolkit.buffer import Buffer from prompt_toolkit.key_binding import KeyBindings diff --git a/examples/full-screen/text-editor.py b/examples/full-screen/text-editor.py index 9c0a414..7fb6b0b 100755 --- a/examples/full-screen/text-editor.py +++ b/examples/full-screen/text-editor.py @@ -2,6 +2,7 @@ """ A simple example of a Notepad-like text editor. """ + import datetime from asyncio import Future, ensure_future @@ -53,10 +54,7 @@ def get_statusbar_text(): def get_statusbar_right_text(): - return " {}:{} ".format( - text_field.document.cursor_position_row + 1, - text_field.document.cursor_position_col + 1, - ) + return f" {text_field.document.cursor_position_row + 1}:{text_field.document.cursor_position_col + 1} " search_toolbar = SearchToolbar() |