Ability to open highlighted subreddit and go back
This commit is contained in:
@@ -169,7 +169,6 @@ class SubredditPage(BasePage):
|
|||||||
|
|
||||||
page = SubscriptionPage(self.stdscr, self.reddit)
|
page = SubscriptionPage(self.stdscr, self.reddit)
|
||||||
page.loop()
|
page.loop()
|
||||||
self.refresh_content()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def draw_item(win, data, inverted=False):
|
def draw_item(win, data, inverted=False):
|
||||||
|
|||||||
@@ -37,16 +37,23 @@ class SubscriptionPage(BasePage):
|
|||||||
def refresh_content(self):
|
def refresh_content(self):
|
||||||
"Re-download all subscriptions and reset the page index"
|
"Re-download all subscriptions and reset the page index"
|
||||||
|
|
||||||
try:
|
self.content = SubscriptionContent.get_list(self.reddit, self.loader)
|
||||||
self.content = SubscriptionContent.get_list(self.reddit, self.loader)
|
self.nav = Navigator(self.content.get)
|
||||||
except AccountError:
|
|
||||||
show_notification(self.stdscr, ['Not logged in'])
|
@SubscriptionController.register(curses.KEY_ENTER, 10)
|
||||||
except SubredditError:
|
def open_selected_subreddit(self):
|
||||||
show_notification(self.stdscr, ['Invalid subreddit'])
|
"Open the selected subreddit"
|
||||||
except requests.HTTPError:
|
|
||||||
show_notification(self.stdscr, ['Could not reach subreddit'])
|
from .subreddit import SubredditPage
|
||||||
else:
|
data = self.content.get(self.nav.absolute_index)
|
||||||
self.nav = Navigator(self.content.get)
|
page = SubredditPage(self.stdscr, self.reddit, data['name'][2:]) # Strip the leading /r
|
||||||
|
page.loop()
|
||||||
|
|
||||||
|
@SubscriptionController.register(curses.KEY_LEFT)
|
||||||
|
def close_subscriptions(self):
|
||||||
|
"Close subscriptions and return to the subreddit page"
|
||||||
|
|
||||||
|
self.active = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def draw_item(win, data, inverted=False):
|
def draw_item(win, data, inverted=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user