From 0cfa7bd2a8741fbd530c7492655861f9f55227b4 Mon Sep 17 00:00:00 2001 From: Gustavo Zambonin Date: Fri, 16 Oct 2015 15:46:15 -0300 Subject: [PATCH 1/5] page.py: quit without prompt restored docs.py: reflect change on docs --- rtv/docs.py | 2 +- rtv/page.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rtv/docs.py b/rtv/docs.py index 6d09d90..0e9b7f1 100644 --- a/rtv/docs.py +++ b/rtv/docs.py @@ -29,7 +29,7 @@ Basic Commands `r` or `F5` : Refresh page content `u` : Log in or switch accounts `?` : Show the help screen - `q` : Quit + `q/Q` : Quit/Force quit Authenticated Commands `a/z` : Upvote/downvote diff --git a/rtv/page.py b/rtv/page.py index 0219164..0c9b8d7 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -275,6 +275,10 @@ class BasePage(object): elif ch != 'n': curses.flash() + @BaseController.register('Q') + def force_exit(self): + sys.exit() + @BaseController.register('?') def help(self): show_help(self._content_window) From 998748e1f14e1802c1e0ce7cd43bb68d6d322181 Mon Sep 17 00:00:00 2001 From: Gustavo Zambonin Date: Fri, 16 Oct 2015 15:47:36 -0300 Subject: [PATCH 2/5] subscription.py: do not sort by hot/new/etc. (#161) --- rtv/subscription.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rtv/subscription.py b/rtv/subscription.py index 2dbd5d5..cdd8b50 100644 --- a/rtv/subscription.py +++ b/rtv/subscription.py @@ -34,11 +34,16 @@ class SubscriptionPage(BasePage): self.controller.trigger(cmd) @SubscriptionController.register(curses.KEY_F5, 'r') - def refresh_content(self): + def refresh_content(self, order=None): "Re-download all subscriptions and reset the page index" - self.content = SubscriptionContent.from_user(self.reddit, self.loader) - self.nav = Navigator(self.content.get) + if order: + # reddit.get_my_subreddits() does not support sorting by order + curses.flash() + else: + self.content = SubscriptionContent.from_user(self.reddit, + self.loader) + self.nav = Navigator(self.content.get) @SubscriptionController.register(curses.KEY_ENTER, 10, curses.KEY_RIGHT) def store_selected_subreddit(self): From 34f2b67d4e778c73813266fb17945ce951708df8 Mon Sep 17 00:00:00 2001 From: Gustavo Zambonin Date: Fri, 16 Oct 2015 21:44:15 -0300 Subject: [PATCH 3/5] README: reflect force quit change --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index eb59227..dbd04f0 100644 --- a/README.rst +++ b/README.rst @@ -67,7 +67,7 @@ Basic Commands :``r`` or ``F5``: Refresh page content :``u``: Log in or switch accounts :``?``: Show the help screen -:``q``: Quit +:``q\Q``: Quit/Force quit ---------------------- Authenticated Commands From f7d6b9c299af570e1a0b27dc729d78aa5d480c23 Mon Sep 17 00:00:00 2001 From: Gustavo Zambonin Date: Fri, 16 Oct 2015 21:45:10 -0300 Subject: [PATCH 4/5] README: formatting changes --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index dbd04f0..453fdfe 100644 --- a/README.rst +++ b/README.rst @@ -67,7 +67,7 @@ Basic Commands :``r`` or ``F5``: Refresh page content :``u``: Log in or switch accounts :``?``: Show the help screen -:``q\Q``: Quit/Force quit +:``q``/``Q``: Quit/Force quit ---------------------- Authenticated Commands From 63ef032a4e99bcc85fa9ae15c7d48d395973325f Mon Sep 17 00:00:00 2001 From: Gustavo Zambonin Date: Fri, 16 Oct 2015 21:50:40 -0300 Subject: [PATCH 5/5] page.py: inbox won't be checked if not logged in. #163 --- rtv/page.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtv/page.py b/rtv/page.py index 0c9b8d7..ca02500 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -443,6 +443,10 @@ class BasePage(object): Checks the inbox for unread messages and displays a notification. """ + if not self.reddit.is_oauth_session(): + show_notification(self.stdscr, ['Not logged in']) + return + inbox = len(list(self.reddit.get_unread(limit=1))) try: if inbox > 0: