diff --git a/README.rst b/README.rst index eb59227..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``: Quit +:``q``/``Q``: Quit/Force quit ---------------------- Authenticated Commands 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..ca02500 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) @@ -439,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: 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):