Switched unicode to be the default mode.
This commit is contained in:
@@ -73,9 +73,9 @@ Example config:
|
|||||||
# Default submission link - will be opened every time the program starts
|
# Default submission link - will be opened every time the program starts
|
||||||
# link=http://www.reddit.com/r/CollegeBasketball/comments/31irjq
|
# link=http://www.reddit.com/r/CollegeBasketball/comments/31irjq
|
||||||
|
|
||||||
# Enable unicode characters (experimental)
|
# Enable ascii-only mode and disable unicode characters
|
||||||
# This is known to be unstable with east asian wide character sets
|
# This may be necessary for compatability with some terminal browsers
|
||||||
# unicode=true
|
# ascii=True
|
||||||
|
|
||||||
RTV allows users to compose comments and replys using their preferred text editor (**vi**, **nano**, **gedit**, etc).
|
RTV allows users to compose comments and replys using their preferred text editor (**vi**, **nano**, **gedit**, etc).
|
||||||
Set the environment variable ``RTV_EDITOR`` to specify which editor the program should use.
|
Set the environment variable ``RTV_EDITOR`` to specify which editor the program should use.
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ def load_config():
|
|||||||
if config.has_section('rtv'):
|
if config.has_section('rtv'):
|
||||||
defaults = dict(config.items('rtv'))
|
defaults = dict(config.items('rtv'))
|
||||||
|
|
||||||
if 'unicode' in defaults:
|
if 'ascii' in defaults:
|
||||||
defaults['unicode'] = config.getboolean('rtv', 'unicode')
|
defaults['ascii'] = config.getboolean('rtv', 'ascii')
|
||||||
|
|
||||||
return defaults
|
return defaults
|
||||||
|
|
||||||
@@ -59,8 +59,8 @@ def command_line():
|
|||||||
|
|
||||||
parser.add_argument('-s', dest='subreddit', help='subreddit name')
|
parser.add_argument('-s', dest='subreddit', help='subreddit name')
|
||||||
parser.add_argument('-l', dest='link', help='full link to a submission')
|
parser.add_argument('-l', dest='link', help='full link to a submission')
|
||||||
parser.add_argument('--unicode', action='store_const', const=False,
|
parser.add_argument('--ascii', action='store_true',
|
||||||
help='enable unicode (experimental)')
|
help='enable ascii-only mode')
|
||||||
parser.add_argument('--log', metavar='FILE', action='store',
|
parser.add_argument('--log', metavar='FILE', action='store',
|
||||||
help='Log HTTP requests')
|
help='Log HTTP requests')
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ def main():
|
|||||||
if getattr(args, key, None) is None:
|
if getattr(args, key, None) is None:
|
||||||
setattr(args, key, val)
|
setattr(args, key, val)
|
||||||
|
|
||||||
config.unicode = False if args.unicode is None else args.unicode
|
config.unicode = (not args.ascii)
|
||||||
|
|
||||||
# Squelch SSL warnings for Ubuntu
|
# Squelch SSL warnings for Ubuntu
|
||||||
logging.captureWarnings(True)
|
logging.captureWarnings(True)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import curses
|
|||||||
from curses import textpad, ascii
|
from curses import textpad, ascii
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
|
from . import config
|
||||||
from .docs import HELP
|
from .docs import HELP
|
||||||
from .helpers import strip_textpad, clean
|
from .helpers import strip_textpad, clean
|
||||||
from .exceptions import EscapeInterrupt
|
from .exceptions import EscapeInterrupt
|
||||||
@@ -20,10 +21,10 @@ ESCAPE = 27
|
|||||||
# 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'
|
UARROW = u'\u25b2' if config.unicode else '^'
|
||||||
DARROW = u'\u25bc'
|
DARROW = u'\u25bc' if config.unicode else 'v'
|
||||||
BULLET = u'\u2022'
|
BULLET = u'\u2022' if config.unicode else 'o'
|
||||||
GOLD = u'\u272A'
|
GOLD = u'\u272A' if config.unicode else '*'
|
||||||
|
|
||||||
def get_arrow(likes):
|
def get_arrow(likes):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -477,8 +477,7 @@ class BasePage(object):
|
|||||||
username = self.reddit.user.name
|
username = self.reddit.user.name
|
||||||
s_col = (n_cols - textual_width(username) - 1)
|
s_col = (n_cols - textual_width(username) - 1)
|
||||||
# Only print username if it fits in the empty space on the right
|
# Only print username if it fits in the empty space on the right
|
||||||
if (s_col - 1) >= len(sub_name):
|
if (s_col - 1) >= textual_width(sub_name):
|
||||||
n = (n_cols - s_col - 1)
|
|
||||||
add_line(self._header_window, username, 0, s_col)
|
add_line(self._header_window, username, 0, s_col)
|
||||||
|
|
||||||
self._header_window.refresh()
|
self._header_window.refresh()
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ from .submission import SubmissionPage
|
|||||||
from .content import SubredditContent
|
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 .curses_helpers import (GOLD, Color, LoadScreen, add_line, get_arrow,
|
from .curses_helpers import (GOLD, Color, LoadScreen, add_line, get_arrow,
|
||||||
show_notification, prompt_input)
|
show_notification, prompt_input)
|
||||||
|
|
||||||
@@ -21,7 +22,6 @@ _logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
history = load_history()
|
history = load_history()
|
||||||
|
|
||||||
|
|
||||||
@atexit.register
|
@atexit.register
|
||||||
def save_links():
|
def save_links():
|
||||||
global history
|
global history
|
||||||
|
|||||||
Reference in New Issue
Block a user