Accidentally disabled the unicode vote symbols.

This commit is contained in:
Michael Lazar
2015-05-13 00:24:49 -07:00
parent bf2d464081
commit c419a3fd23
4 changed files with 25 additions and 18 deletions

View File

@@ -2,4 +2,4 @@
Global configuration settings Global configuration settings
""" """
unicode = False unicode = True

View File

@@ -10,21 +10,25 @@ from .docs import HELP
from .helpers import strip_textpad, clean from .helpers import strip_textpad, clean
from .exceptions import EscapeInterrupt from .exceptions import EscapeInterrupt
__all__ = ['ESCAPE', 'UARROW', 'DARROW', 'BULLET', 'show_notification', __all__ = ['ESCAPE', 'get_gold', 'show_notification', 'show_help',
'show_help', 'LoadScreen', 'Color', 'text_input', 'curses_session', 'LoadScreen', 'Color', 'text_input', 'curses_session',
'prompt_input', 'add_line', 'get_arrow'] 'prompt_input', 'add_line', 'get_arrow']
ESCAPE = 27 # Curses does define constants for symbols (e.g. curses.ACS_BULLET)
# Curses does define constants for these (e.g. curses.ACS_BULLET)
# However, they rely on using the curses.addch() function, which has been # 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 # 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(). # points they can be added via the more reliable curses.addstr().
# http://bugs.python.org/issue21088 # http://bugs.python.org/issue21088
UARROW = u'\u25b2' if config.unicode else '^' ESCAPE = 27
DARROW = u'\u25bc' if config.unicode else 'v'
BULLET = u'\u2022' if config.unicode else 'o' def get_gold():
GOLD = u'\u272A' if config.unicode else '*' """
Return the guilded symbol.
"""
symbol = u'\u272A' if config.unicode else '*'
attr = curses.A_BOLD | Color.YELLOW
return symbol, attr
def get_arrow(likes): def get_arrow(likes):
""" """
@@ -32,11 +36,14 @@ def get_arrow(likes):
""" """
if likes is None: if likes is None:
symbol, attr = BULLET, curses.A_BOLD symbol = u'\u2022' if config.unicode else 'o'
attr = curses.A_BOLD
elif likes: elif likes:
symbol, attr = UARROW, curses.A_BOLD | Color.GREEN symbol = u'\u25b2' if config.unicode else '^'
attr = curses.A_BOLD | Color.GREEN
else: 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 return symbol, attr

View File

@@ -8,7 +8,7 @@ import praw.errors
from .content import SubmissionContent from .content import SubmissionContent
from .page import BasePage, Navigator, BaseController from .page import BasePage, Navigator, BaseController
from .helpers import open_browser, open_editor 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) show_notification, text_input)
from .docs import COMMENT_FILE from .docs import COMMENT_FILE
@@ -171,7 +171,7 @@ class SubmissionPage(BasePage):
add_line(win, u' {score} {created} '.format(**data)) add_line(win, u' {score} {created} '.format(**data))
if data['gold']: if data['gold']:
text, attr = GOLD, (curses.A_BOLD | Color.YELLOW) text, attr = get_gold()
add_line(win, text, attr=attr) add_line(win, text, attr=attr)
n_body = len(data['split_body']) n_body = len(data['split_body'])
@@ -246,7 +246,7 @@ class SubmissionPage(BasePage):
add_line(win, u' {comments} '.format(**data)) add_line(win, u' {comments} '.format(**data))
if data['gold']: if data['gold']:
text, attr = GOLD, (curses.A_BOLD | Color.YELLOW) text, attr = get_gold()
add_line(win, text, attr=attr) add_line(win, text, attr=attr)
if data['nsfw']: if data['nsfw']:

View File

@@ -13,7 +13,7 @@ from .content import SubredditContent
from .helpers import open_browser, open_editor from .helpers import open_browser, open_editor
from .docs import SUBMISSION_FILE from .docs import SUBMISSION_FILE
from .history import load_history, save_history 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) show_notification, prompt_input)
__all__ = ['history', 'SubredditController', 'SubredditPage'] __all__ = ['history', 'SubredditController', 'SubredditPage']
@@ -186,7 +186,7 @@ class SubredditPage(BasePage):
add_line(win, u' {created} {comments} '.format(**data)) add_line(win, u' {created} {comments} '.format(**data))
if data['gold']: if data['gold']:
text, attr = GOLD, (curses.A_BOLD | Color.YELLOW) text, attr = get_gold()
add_line(win, text, attr=attr) add_line(win, text, attr=attr)
if data['nsfw']: if data['nsfw']: