refresh_content() now properly resets the navigator's callback.
This commit is contained in:
@@ -5,7 +5,7 @@ import time
|
|||||||
import praw.errors
|
import praw.errors
|
||||||
|
|
||||||
from .content import SubmissionContent
|
from .content import SubmissionContent
|
||||||
from .page import BasePage
|
from .page import BasePage, Navigator
|
||||||
from .helpers import clean, open_browser, open_editor
|
from .helpers import clean, open_browser, open_editor
|
||||||
from .curses_helpers import (BULLET, UARROW, DARROW, Color, LoadScreen,
|
from .curses_helpers import (BULLET, UARROW, DARROW, Color, LoadScreen,
|
||||||
show_help, show_notification, text_input)
|
show_help, show_notification, text_input)
|
||||||
@@ -95,8 +95,7 @@ class SubmissionPage(BasePage):
|
|||||||
|
|
||||||
url = self.content.name
|
url = self.content.name
|
||||||
self.content = SubmissionContent.from_url(self.reddit, url, self.loader)
|
self.content = SubmissionContent.from_url(self.reddit, url, self.loader)
|
||||||
self.nav.page_index, self.nav.cursor_index = -1, 0
|
self.nav = Navigator(self.content.get, page_index=-1)
|
||||||
self.nav.inverted = False
|
|
||||||
|
|
||||||
def open_link(self):
|
def open_link(self):
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import sys
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from .exceptions import SubredditError
|
from .exceptions import SubredditError
|
||||||
from .page import BasePage
|
from .page import BasePage, Navigator
|
||||||
from .submission import SubmissionPage
|
from .submission import SubmissionPage
|
||||||
from .content import SubredditContent
|
from .content import SubredditContent
|
||||||
from .helpers import clean, open_browser
|
from .helpers import clean, open_browser
|
||||||
@@ -81,16 +81,12 @@ class SubredditPage(BasePage):
|
|||||||
try:
|
try:
|
||||||
self.content = SubredditContent.from_name(
|
self.content = SubredditContent.from_name(
|
||||||
self.reddit, name, self.loader)
|
self.reddit, name, self.loader)
|
||||||
|
|
||||||
except SubredditError:
|
except SubredditError:
|
||||||
show_notification(self.stdscr, ['Invalid subreddit'])
|
show_notification(self.stdscr, ['Invalid subreddit'])
|
||||||
|
|
||||||
except requests.HTTPError:
|
except requests.HTTPError:
|
||||||
show_notification(self.stdscr, ['Could not reach subreddit'])
|
show_notification(self.stdscr, ['Could not reach subreddit'])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.nav.page_index, self.nav.cursor_index = 0, 0
|
self.nav = Navigator(self.content.get)
|
||||||
self.nav.inverted = False
|
|
||||||
|
|
||||||
def prompt_subreddit(self):
|
def prompt_subreddit(self):
|
||||||
"Open a prompt to type in a new subreddit"
|
"Open a prompt to type in a new subreddit"
|
||||||
|
|||||||
Reference in New Issue
Block a user