Got the prompt working from submissions / subscriptions.

This commit is contained in:
Michael Lazar
2016-08-05 17:56:36 -07:00
parent ddba5aab06
commit 6328407c32
7 changed files with 43 additions and 14 deletions

View File

@@ -66,7 +66,7 @@ class SubredditPage(Page):
if not self.term.loader.exception:
self.nav = Navigator(self.content.get)
@SubredditController.register(Command('SUBREDDIT_PROMPT'))
@SubredditController.register(Command('PROMPT'))
def prompt_subreddit(self):
"Open a prompt to navigate to a different subreddit"
@@ -111,6 +111,12 @@ class SubredditPage(Page):
if data.get('url_type') == 'selfpost':
self.config.history.add(data['url_full'])
if page.subreddit_name is not None:
self.refresh_content(order='ignore',
name=page.subreddit_name)
else:
self.refresh_content()
@SubredditController.register(Command('SUBREDDIT_OPEN_IN_BROWSER'))
def open_link(self):
"Open a link with the webbrowser"
@@ -167,7 +173,11 @@ class SubredditPage(Page):
page.loop()
self.refresh_content()
if page.subreddit_name is not None:
self.refresh_content(order='ignore',
name=page.subreddit_name)
else:
self.refresh_content()
@SubredditController.register(Command('SUBREDDIT_OPEN_SUBSCRIPTIONS'))
@logged_in
@@ -184,9 +194,9 @@ class SubredditPage(Page):
# When the user has chosen a subreddit in the subscriptions list,
# refresh content with the selected subreddit
if page.subreddit_data is not None:
if page.subreddit_name is not None:
self.refresh_content(order='ignore',
name=page.subreddit_data['name'])
name=page.subreddit_name)
@SubredditController.register(Command('SUBREDDIT_OPEN_MULTIREDDITS'))
@logged_in
@@ -203,9 +213,9 @@ class SubredditPage(Page):
# When the user has chosen a subreddit in the subscriptions list,
# refresh content with the selected subreddit
if page.subreddit_data is not None:
if page.subreddit_name is not None:
self.refresh_content(order='ignore',
name=page.subreddit_data['name'])
name=page.subreddit_name)
def _draw_item(self, win, data, inverted):