Added 'links from' menu
This commit is contained in:
10
rtv/docs.py
10
rtv/docs.py
@@ -145,3 +145,13 @@ OAUTH_SUCCESS = """\
|
|||||||
<p><span style="font-weight: bold">Reddit Terminal Viewer</span>
|
<p><span style="font-weight: bold">Reddit Terminal Viewer</span>
|
||||||
will now log in, you can close this window.</p>
|
will now log in, you can close this window.</p>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
TIME_ORDER_MENU = """
|
||||||
|
Links from:
|
||||||
|
[1] Past hour
|
||||||
|
[2] Past 24 hours
|
||||||
|
[3] Past week
|
||||||
|
[4] Past month
|
||||||
|
[5] Past year
|
||||||
|
[6] All time
|
||||||
|
"""
|
||||||
23
rtv/page.py
23
rtv/page.py
@@ -93,7 +93,26 @@ class Page(object):
|
|||||||
|
|
||||||
@PageController.register(Command('SORT_TOP'))
|
@PageController.register(Command('SORT_TOP'))
|
||||||
def sort_content_top(self):
|
def sort_content_top(self):
|
||||||
self.refresh_content(order='top')
|
if (self.content.order and 'top' not in self.content.order) or 'front' in self.content.name:
|
||||||
|
self.refresh_content(order='top')
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
ch = self.term.show_notification(
|
||||||
|
docs.TIME_ORDER_MENU.strip('\n').splitlines())
|
||||||
|
if ch not in range(ord('1'), ord('6') + 1):
|
||||||
|
self.term.show_notification('Invalid option')
|
||||||
|
return
|
||||||
|
ord_choices = {
|
||||||
|
ord('1'): 'top-hour',
|
||||||
|
ord('2'): 'top-day',
|
||||||
|
ord('3'): 'top-week',
|
||||||
|
ord('4'): 'top-month',
|
||||||
|
ord('5'): 'top-year',
|
||||||
|
ord('6'): 'top-all',
|
||||||
|
}
|
||||||
|
order = ord_choices[ch]
|
||||||
|
|
||||||
|
self.refresh_content(order=order)
|
||||||
|
|
||||||
@PageController.register(Command('SORT_RISING'))
|
@PageController.register(Command('SORT_RISING'))
|
||||||
def sort_content_rising(self):
|
def sort_content_rising(self):
|
||||||
@@ -107,6 +126,8 @@ class Page(object):
|
|||||||
def sort_content_controversial(self):
|
def sort_content_controversial(self):
|
||||||
self.refresh_content(order='controversial')
|
self.refresh_content(order='controversial')
|
||||||
|
|
||||||
|
##TODO: ADD CONTROVERSIAL SUBSORTS
|
||||||
|
|
||||||
@PageController.register(Command('MOVE_UP'))
|
@PageController.register(Command('MOVE_UP'))
|
||||||
def move_cursor_up(self):
|
def move_cursor_up(self):
|
||||||
self._move_cursor(-1)
|
self._move_cursor(-1)
|
||||||
|
|||||||
Reference in New Issue
Block a user