Safe call is useless here + some refactoring
This commit is contained in:
@@ -368,21 +368,22 @@ class SubredditContent(BaseContent):
|
||||
return data
|
||||
|
||||
class SubscriptionContent(BaseContent):
|
||||
def __init__(self, subscriptions, loader):
|
||||
self.name = "Subscriptions"
|
||||
def __init__(self, name, subscriptions, loader):
|
||||
self.name = name
|
||||
self._loader = loader
|
||||
self._subscriptions = subscriptions
|
||||
self._subscription_data = []
|
||||
|
||||
@classmethod
|
||||
def get_list(cls, reddit, loader):
|
||||
display_name = "Subscriptions"
|
||||
try:
|
||||
with loader():
|
||||
subscriptions = reddit.get_my_subreddits(limit=None)
|
||||
except praw.errors.APIException:
|
||||
raise SubscriptionError()
|
||||
|
||||
return cls(subscriptions, loader)
|
||||
return cls(display_name, subscriptions, loader)
|
||||
|
||||
def get(self, index, n_cols=70):
|
||||
"""
|
||||
|
||||
@@ -167,10 +167,9 @@ class SubredditPage(BasePage):
|
||||
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()
|
||||
page = SubscriptionPage(self.stdscr, self.reddit)
|
||||
page.loop()
|
||||
self.refresh_content()
|
||||
|
||||
@staticmethod
|
||||
def draw_item(win, data, inverted=False):
|
||||
|
||||
Reference in New Issue
Block a user