diff --git a/rtv/config.py b/rtv/config.py index 8bad1ff..c59a16d 100644 --- a/rtv/config.py +++ b/rtv/config.py @@ -2,4 +2,4 @@ Global configuration settings """ -unicode = False +unicode = True \ No newline at end of file diff --git a/rtv/curses_helpers.py b/rtv/curses_helpers.py index faefd78..fb8f0f7 100644 --- a/rtv/curses_helpers.py +++ b/rtv/curses_helpers.py @@ -10,21 +10,25 @@ from .docs import HELP from .helpers import strip_textpad, clean from .exceptions import EscapeInterrupt -__all__ = ['ESCAPE', 'UARROW', 'DARROW', 'BULLET', 'show_notification', - 'show_help', 'LoadScreen', 'Color', 'text_input', 'curses_session', +__all__ = ['ESCAPE', 'get_gold', 'show_notification', 'show_help', + 'LoadScreen', 'Color', 'text_input', 'curses_session', 'prompt_input', 'add_line', 'get_arrow'] -ESCAPE = 27 - -# Curses does define constants for these (e.g. curses.ACS_BULLET) +# Curses does define constants for symbols (e.g. curses.ACS_BULLET) # However, they rely on using the curses.addch() function, which has been # found to be buggy and a PITA to work with. By defining them as unicode # points they can be added via the more reliable curses.addstr(). # http://bugs.python.org/issue21088 -UARROW = u'\u25b2' if config.unicode else '^' -DARROW = u'\u25bc' if config.unicode else 'v' -BULLET = u'\u2022' if config.unicode else 'o' -GOLD = u'\u272A' if config.unicode else '*' +ESCAPE = 27 + +def get_gold(): + """ + Return the guilded symbol. + """ + + symbol = u'\u272A' if config.unicode else '*' + attr = curses.A_BOLD | Color.YELLOW + return symbol, attr def get_arrow(likes): """ @@ -32,11 +36,14 @@ def get_arrow(likes): """ if likes is None: - symbol, attr = BULLET, curses.A_BOLD + symbol = u'\u2022' if config.unicode else 'o' + attr = curses.A_BOLD elif likes: - symbol, attr = UARROW, curses.A_BOLD | Color.GREEN + symbol = u'\u25b2' if config.unicode else '^' + attr = curses.A_BOLD | Color.GREEN else: - symbol, attr = DARROW, curses.A_BOLD | Color.RED + symbol = u'\u25bc' if config.unicode else 'v' + attr = curses.A_BOLD | Color.RED return symbol, attr diff --git a/rtv/submission.py b/rtv/submission.py index 98738a7..310aa25 100644 --- a/rtv/submission.py +++ b/rtv/submission.py @@ -8,7 +8,7 @@ import praw.errors from .content import SubmissionContent from .page import BasePage, Navigator, BaseController from .helpers import open_browser, open_editor -from .curses_helpers import (GOLD, Color, LoadScreen, get_arrow, add_line, +from .curses_helpers import (Color, LoadScreen, get_arrow, get_gold, add_line, show_notification, text_input) from .docs import COMMENT_FILE @@ -171,7 +171,7 @@ class SubmissionPage(BasePage): add_line(win, u' {score} {created} '.format(**data)) if data['gold']: - text, attr = GOLD, (curses.A_BOLD | Color.YELLOW) + text, attr = get_gold() add_line(win, text, attr=attr) n_body = len(data['split_body']) @@ -246,7 +246,7 @@ class SubmissionPage(BasePage): add_line(win, u' {comments} '.format(**data)) if data['gold']: - text, attr = GOLD, (curses.A_BOLD | Color.YELLOW) + text, attr = get_gold() add_line(win, text, attr=attr) if data['nsfw']: diff --git a/rtv/subreddit.py b/rtv/subreddit.py index 7782cab..5794234 100644 --- a/rtv/subreddit.py +++ b/rtv/subreddit.py @@ -13,7 +13,7 @@ from .content import SubredditContent from .helpers import open_browser, open_editor from .docs import SUBMISSION_FILE from .history import load_history, save_history -from .curses_helpers import (GOLD, Color, LoadScreen, add_line, get_arrow, +from .curses_helpers import (Color, LoadScreen, add_line, get_arrow, get_gold, show_notification, prompt_input) __all__ = ['history', 'SubredditController', 'SubredditPage'] @@ -186,7 +186,7 @@ class SubredditPage(BasePage): add_line(win, u' {created} {comments} '.format(**data)) if data['gold']: - text, attr = GOLD, (curses.A_BOLD | Color.YELLOW) + text, attr = get_gold() add_line(win, text, attr=attr) if data['nsfw']: