summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Stanley <fungi@yuggoth.org>2015-07-22 20:16:21 +0000
committerJames E. Blair <corvus@gnu.org>2015-07-25 09:12:16 -0700
commitff07c4700e19cd3197fd8bac1ab8346b18aaaf15 (patch)
tree85c3eb4c285765f6e6570a16f72521ef206b532e
parent12060b060c23e76ca075114c9d4981c288387ad8 (diff)
downloadpresentty-ff07c4700e19cd3197fd8bac1ab8346b18aaaf15.tar.gz
presentty-ff07c4700e19cd3197fd8bac1ab8346b18aaaf15.tar.xz
presentty-ff07c4700e19cd3197fd8bac1ab8346b18aaaf15.zip
Use the q key to quit gracefully
Relying on ctrl-C user interrupt to exit leaves the terminal in a dirty state, and potentially unusable. Add the ability to exit gracefully by pressing the q key.
-rw-r--r--README.rst2
-rw-r--r--presentty/console.py2
-rw-r--r--presentty/presentty.py2
3 files changed, 6 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index 1855710..1e4a37f 100644
--- a/README.rst
+++ b/README.rst
@@ -56,6 +56,8 @@ In either the presenter's console or the main presentty window, the
left and right arrow keys or page-up and page-down navigate between
slides.
+To exit presentty gracefully, use the 'q' key.
+
Source
------
diff --git a/presentty/console.py b/presentty/console.py
index d29b864..d10dc3e 100644
--- a/presentty/console.py
+++ b/presentty/console.py
@@ -172,6 +172,8 @@ class Screen(urwid.WidgetWrap):
self.console.prev()
elif key == 't':
self.console.timerDialog()
+ elif key == 'q':
+ raise urwid.ExitMainLoop()
else:
return super(Screen, self).keypress(size, key)
return None
diff --git a/presentty/presentty.py b/presentty/presentty.py
index 35e19c1..b7589bf 100644
--- a/presentty/presentty.py
+++ b/presentty/presentty.py
@@ -78,6 +78,8 @@ class Presenter(object):
self.nextSlide()
elif key in ('left', 'page up'):
self.prevSlide()
+ elif key == 'q':
+ raise urwid.ExitMainLoop()
def transitionTo(self, index, forward=True):
self.pos = index