Python prompt_toolkit.keys.Keys.F10 Examples

The following are 4 code examples of prompt_toolkit.keys.Keys.F10(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module prompt_toolkit.keys.Keys , or try the search function .
Example #1
Source File: bindings.py    From kafka-shell with Apache License 2.0 6 votes vote down vote up
def get_bindings(settings):
    bindings = KeyBindings()

    @bindings.add(Keys.F2)
    def _(event):
        settings.set_next_cluster()

    @bindings.add(Keys.F3)
    def _(event):
        settings.set_enable_fuzzy_search(not settings.enable_fuzzy_search)

    @bindings.add(Keys.F9)
    def _(event):
        settings.set_enable_help(not settings.enable_help)

    @bindings.add(Keys.F10)
    def _(event):
        current.get_app().exit(exception=EOFError)

    return bindings 
Example #2
Source File: test_keys.py    From aws-shell with Apache License 2.0 5 votes vote down vote up
def test_F10(self):
        self.feed_key(Keys.F10)
        assert self.aws_shell.cli.is_exiting 
Example #3
Source File: main.py    From Slack-Gitsin with GNU General Public License v3.0 5 votes vote down vote up
def get_bottom_toolbar_tokens(cli):
    return [(Token.Toolbar, ' F10 : Exit ')] 
Example #4
Source File: main.py    From Slack-Gitsin with GNU General Public License v3.0 5 votes vote down vote up
def _(event):
    def exit():
        """ 
            Quit when the `F10` key is pressed
        """
        pid = os.getpid()
        stop()  # stop thread
        os.kill(pid, signal.SIGTERM)  # or signal.SIGKILL
        quit()  # exit the program

    event.cli.run_in_terminal(exit)