display_help function added
This commit is contained in:
@@ -6,7 +6,7 @@ import six
|
|||||||
|
|
||||||
from .content import SubmissionContent
|
from .content import SubmissionContent
|
||||||
from .page import BasePage
|
from .page import BasePage
|
||||||
from .utils import LoadScreen, Color, ESCAPE, display_message, help_msg
|
from .utils import LoadScreen, Color, ESCAPE, display_help
|
||||||
|
|
||||||
class SubmissionPage(BasePage):
|
class SubmissionPage(BasePage):
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class SubmissionPage(BasePage):
|
|||||||
break
|
break
|
||||||
|
|
||||||
elif cmd == ord('?'):
|
elif cmd == ord('?'):
|
||||||
display_message(self.stdscr, help_msg)
|
display_help(self.stdscr)
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
elif cmd == ord('q'):
|
elif cmd == ord('q'):
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from .errors import SubredditNameError
|
|||||||
from .page import BasePage
|
from .page import BasePage
|
||||||
from .submission import SubmissionPage
|
from .submission import SubmissionPage
|
||||||
from .content import SubredditContent
|
from .content import SubredditContent
|
||||||
from .utils import LoadScreen, text_input, display_message, Color, ESCAPE, help_msg
|
from .utils import LoadScreen, text_input, display_message, Color, ESCAPE, display_help
|
||||||
|
|
||||||
class SubredditPage(BasePage):
|
class SubredditPage(BasePage):
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ class SubredditPage(BasePage):
|
|||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
elif cmd == ord('?'):
|
elif cmd == ord('?'):
|
||||||
display_message(self.stdscr, help_msg)
|
display_help(self.stdscr)
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
elif cmd == ord('q'):
|
elif cmd == ord('q'):
|
||||||
|
|||||||
10
rtv/utils.py
10
rtv/utils.py
@@ -34,8 +34,6 @@ Submission Mode
|
|||||||
Left : Exit the submission page and return to the subreddit.
|
Left : Exit the submission page and return to the subreddit.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
help_msg = help_msg.split("\n")
|
|
||||||
|
|
||||||
|
|
||||||
class Color(object):
|
class Color(object):
|
||||||
|
|
||||||
@@ -161,6 +159,14 @@ def display_message(stdscr, message):
|
|||||||
stdscr.refresh()
|
stdscr.refresh()
|
||||||
|
|
||||||
|
|
||||||
|
def display_help(stdscr):
|
||||||
|
"""Display a help message box at the center of the screen and wait for a
|
||||||
|
keypress"""
|
||||||
|
|
||||||
|
help_msgs = help_msg.split("\n")
|
||||||
|
display_message(stdscr, help_msgs)
|
||||||
|
|
||||||
|
|
||||||
class LoadScreen(object):
|
class LoadScreen(object):
|
||||||
|
|
||||||
def __init__(self, stdscr):
|
def __init__(self, stdscr):
|
||||||
|
|||||||
Reference in New Issue
Block a user