Cleaner subscriptions draw_item() implementation

This commit is contained in:
Théo Piboubès
2015-08-09 21:07:04 +02:00
parent 0113f81705
commit be7cd1a071
3 changed files with 23 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import requests
from .exceptions import SubredditError, AccountError
from .page import BasePage, Navigator, BaseController
from .submission import SubmissionPage
from .subscriptions import SubscriptionPage
from .content import SubredditContent
from .helpers import open_browser, open_editor, strip_subreddit_url
from .docs import SUBMISSION_FILE
@@ -158,6 +159,19 @@ class SubredditPage(BasePage):
page.loop()
self.refresh_content()
@SubredditController.register('s')
def open_subscriptions(self):
"Open user subscriptions page"
if not self.reddit.is_logged_in():
show_notification(self.stdscr, ['Not logged in'])
return
with self.safe_call as s:
page = SubscriptionPage(self.stdscr, self.reddit)
page.loop()
self.refresh_content()
@staticmethod
def draw_item(win, data, inverted=False):