From b272b1b07b2da5d590dff49fe6ef58a661dd026f Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Wed, 15 Feb 2017 09:35:03 +0100 Subject: [PATCH] Added a way to quit application with 'q' more or less properly --- bin/ModulesInformationV2.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/ModulesInformationV2.py b/bin/ModulesInformationV2.py index 23ac6a45..a849a5d7 100755 --- a/bin/ModulesInformationV2.py +++ b/bin/ModulesInformationV2.py @@ -2,8 +2,7 @@ # -*-coding:UTF-8 -* from asciimatics.widgets import Frame, ListBox, Layout, Divider, Text, \ - Button, TextBox, Widget, Label -from asciimatics.effects import Cycle, Print, Stars + Button, Label from asciimatics.scene import Scene from asciimatics.screen import Screen from asciimatics.exceptions import ResizeScreenError, NextScene, StopApplication @@ -117,6 +116,11 @@ class CListBox(ListBox): current_selected_queue = self.queue_name self._frame.save() raise NextScene("action_choice") + + # Quit if press q + elif event.key_code == ord('q'): + ListView._quit() + else: # Ignore any other key press. return event @@ -785,3 +789,5 @@ if __name__ == "__main__": sys.exit(0) except ResizeScreenError as e: pass + except StopApplication: + sys.exit(0)