From 0fdae713a5e80ae475abfd589601a09c511561e4 Mon Sep 17 00:00:00 2001 From: Shawn Hind Date: Fri, 6 Mar 2015 14:48:13 -0500 Subject: [PATCH 1/4] Fix bug with login where invalid password throws unhandeled exception in issue #24 --- rtv/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtv/main.py b/rtv/main.py index 8f7ccd5..c953d3d 100644 --- a/rtv/main.py +++ b/rtv/main.py @@ -2,6 +2,7 @@ import argparse from getpass import getpass import praw from requests.exceptions import ConnectionError, HTTPError +from praw.errors import InvalidUserPass from rtv.errors import SubmissionURLError, SubredditNameError from rtv.utils import curses_session, load_config @@ -94,6 +95,9 @@ def main(): page = SubredditPage(stdscr, reddit, args.subreddit) page.loop() + except InvalidUserPass: + print('Invalid password for username: ' + args.username) + except KeyboardInterrupt: return From 3379a99e0d9502d9205dc30e69fc56f585dc7a25 Mon Sep 17 00:00:00 2001 From: Shawn Hind Date: Fri, 6 Mar 2015 15:15:44 -0500 Subject: [PATCH 2/4] Fixed formatting of error message to be in line with others --- rtv/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtv/main.py b/rtv/main.py index c953d3d..f59f4ec 100644 --- a/rtv/main.py +++ b/rtv/main.py @@ -96,7 +96,7 @@ def main(): page.loop() except InvalidUserPass: - print('Invalid password for username: ' + args.username) + print('Invalid password for username: {}'.format(args.username)) except KeyboardInterrupt: return From d4db2a968913e597937be6716b783cbb8f49f9de Mon Sep 17 00:00:00 2001 From: michael-lazar Date: Fri, 6 Mar 2015 22:20:05 -0800 Subject: [PATCH 3/4] Readme tweaks --- README.rst | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/README.rst b/README.rst index d22d4b1..998c7bd 100644 --- a/README.rst +++ b/README.rst @@ -1,27 +1,28 @@ +.. image:: https://pypip.in/version/rtv/badge.svg?text=version&style=flat + :target: https://pypi.python.org/pypi/rtv/ + :alt: Latest Version + ====================== Reddit Terminal Viewer ====================== -.. image:: https://pypip.in/version/rtv/badge.svg?text=version - :target: https://pypi.python.org/pypi/rtv/ - :alt: Latest Version - -**Reddit Terminal Viewer (RTV)** is a lightweight browser for Reddit (www.reddit.com) built into a terminal window. -RTV is built in Python and utilizes the **curses** library. -It is compatible with a large range of terminal emulators on Linux and OSX systems. +Browse Reddit from your terminal. .. image:: http://i.imgur.com/4a3Yrov.gif +RTV is built in python using the curses library, and is compatable with *most* terminal emulators on Linux and OS X. + ------------ Installation ------------ -The recommended installation method is pip. + +Install using pip .. code-block:: bash $ sudo pip install --pre rtv -Alternatively, clone the repo and install with python. +Or clone the repository .. code-block:: bash @@ -29,7 +30,7 @@ Alternatively, clone the repo and install with python. $ cd rtv $ sudo python setup.py install -As part of the installation, an executable script will be placed in your system path. +The installation will place a script in the system path .. code-block:: bash @@ -44,35 +45,42 @@ RTV currently supports browsing both subreddits and individual submissions. In e **Global Commands** -:``Arrow Keys`` or ``hjkl``: RTV supports both the arrow keys and vim bindings for navigation. Move up and down to scroll through items on the page. -:``r`` or ``F5``: Refresh the current page. -:``q``: Quit the program. -:``o``: Open the url of the selected item in the default web browser. +:``▲``/``▼`` or ``j``/``k``: Scroll to the prev/next item +:``o``: Open the selected item in the default web browser +:``r`` or ``F5``: Refresh the current page +:``q``: Quit **Subreddit Mode** In subreddit mode you can browse through the top submissions on either the front page or a specific subreddit. -:``Right`` or ``Enter``: Open the currently selected submission in a new page. -:``/``: Open a prompt to switch to a different subreddit. For example, pressing ``/`` and typing *python* will open */r/python*. You can return to Reddit's front page by using the alias */r/front*. +:``►`` or ``l``: View comments for the selected submission +:``/``: Open a prompt to switch subreddits + +The ``/`` prompt accepts subreddits in the following formats + +* ``/r/python`` +* ``/r/python/new`` +* ``/r/front`` will redirect to the front page **Submission Mode** In submission mode you can view the self text for a submission and browse comments. -:``Right`` or ``Enter``: Toggle the currently selected comment between hidden and visible. Alternatively, load additional comments identified by *[+] more comments*. -:``Left``: Exit the submission page and return to the subreddit. +:``◄`` or ``h``: Return to subreddit mode +:``►`` or ``l``: Fold the selected comment, or load additional comments ------------- Configuration ------------- -RTV will read a configuration dotfile located at **~/.rtv**. +RTV will read a configuration file located at **~/.rtv**. This can be used to avoid having to re-enter login credentials every time the program is launched. Each line in the file will replace the corresponding default argument in the launch script. -Example config file (**~/.rtv**): +Example config: +**~/.rtv** :: [rtv] From 19cab712be7aa96e12297f4bdaac9969719404c1 Mon Sep 17 00:00:00 2001 From: michael-lazar Date: Fri, 6 Mar 2015 22:21:24 -0800 Subject: [PATCH 4/4] Readme tweaks --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 998c7bd..e42e829 100644 --- a/README.rst +++ b/README.rst @@ -6,12 +6,12 @@ Reddit Terminal Viewer ====================== -Browse Reddit from your terminal. - -.. image:: http://i.imgur.com/4a3Yrov.gif +Browse Reddit from your terminal RTV is built in python using the curses library, and is compatable with *most* terminal emulators on Linux and OS X. +.. image:: http://i.imgur.com/4a3Yrov.gif + ------------ Installation ------------