From 2a935922bf9b97cc2358a35963c0b4dada7a9f6c Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 28 May 2015 20:54:04 -0700 Subject: [PATCH] Upping version, updated readme, changed post keybind. --- CHANGELOG.rst | 16 +++++ README.rst | 164 +++++++++++++++++++++++++++------------------ rtv/__version__.py | 2 +- rtv/docs.py | 35 +++++----- rtv/submission.py | 2 +- rtv/subreddit.py | 2 +- 6 files changed, 136 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 82176a21..e95e69a7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,11 +2,27 @@ RTV Changelog ============= +.. _1.4: http://github.com/michael-lazar/rtv/releases/tag/v1.4 .. _1.3: http://github.com/michael-lazar/rtv/releases/tag/v1.3 .. _1.2.2: http://github.com/michael-lazar/rtv/releases/tag/v1.2.2 .. _1.2.1: http://github.com/michael-lazar/rtv/releases/tag/v1.2.1 .. _1.2: http://github.com/michael-lazar/rtv/releases/tag/v1.2 +----------------- +1.4_ (2015-05-16) +----------------- +Features + +* Unicode support has been vastly improved and is now turned on by default. Ascii only mode can be toggled with the `--ascii` command line flag. +* Added pageup and pagedown with the `m` and `n` keys. +* Support for terminal based webbrowsers such as links and w3m. +* Browsing history is now persistant and stored in `$XDG_CACHE_HOME`. + +Bugfixes + +* Several improvements for handling unicode. +* Fixed crash caused by resizing the window and exiting a submission. + ----------------- 1.3_ (2015-04-22) ----------------- diff --git a/README.rst b/README.rst index f7c4c9cc..0fea9637 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,3 @@ - =========================== RTV: Reddit Terminal Viewer =========================== @@ -16,8 +15,8 @@ RTV is built in **python** using the **curses** library. --------------- * `Installation`_ -* `Configuration`_ * `Usage`_ +* `Configuration`_ * `Changelog`_ * `Contributors`_ * `License`_ @@ -47,61 +46,44 @@ The installation will place a script in the system path $ rtv $ rtv --help +===== +Usage +===== -============= -Configuration -============= - -RTV will read a configuration file located at ``$XDG_CONFIG_HOME/rtv/rtv.cfg`` or ``~/.config/rtv/rtv.cfg`` if ``$XDG_CONFIG_HOME`` is not set. -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: - -.. code-block:: ini - - [rtv] - username=MyUsername - password=MySecretPassword - - # Log file location - log=/tmp/rtv.log - - # Default subreddit - subreddit=CollegeBasketball - - # Default submission link - will be opened every time the program starts - # link=http://www.reddit.com/r/CollegeBasketball/comments/31irjq - - # Enable ascii-only mode and disable unicode characters - # This may be necessary for compatability with some terminal browsers - # ascii=True +RTV supports browsing both subreddits and submission comments. -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. +Navigating is simple and intuitive. +Move the cursor using either the arrow keys or *Vim* style movement. +Move **up** and **down** to scroll through the page. +Move **right** to view the selected submission, and **left** to exit the submission. -.. code-block:: bash +-------------- +Basic Commands +-------------- - $ export RTV_EDITOR=gedit +:``j``/``k`` or ``▲``/``▼``: Move the cursor up/down +:``m``/``n`` or ``PgUp``/``PgDn``: Jump to the previous/next page +:``o`` or ``ENTER``: Open the selected item as a webpage +:``r`` or ``F5``: Refresh page content +:``u``: Log in or switch accounts +:``?``: Show the help screen +:``q``: Quit +---------------------- +Authenticated Commands +---------------------- -===== -Usage -===== +Some actions require that you be logged in to your reddit account. To log in you can either: -RTV currently supports browsing both subreddits and individual submissions. In each mode the controls are slightly different. +1. provide your username as a command line argument ``-u`` (your password will be securely prompted), or +2. press ``u`` while inside of the program ---------------- -Global Commands ---------------- +Once you are logged in your username will appear in the top-right corner of the screen. -:``▲``/``▼`` or ``j``/``k``: Scroll to the prev/next item -:``a``/``z``: Upvote/downvote the selected item -:``ENTER`` or ``o``: Open the selected item in the default web browser -:``r``: Refresh the current page -:``u``: Login and logout of your user account -:``?``: Show the help screen -:``q``: Quit +:``a``/``z``: Upvote/downvote +:``c``: Compose a new post or comment +:``e``: Edit an existing post or comment +:``d``: Delete an existing post or comment -------------- Subreddit Mode @@ -109,16 +91,12 @@ Subreddit Mode In subreddit mode you can browse through the top submissions on either the front page or a specific subreddit. -:``►`` or ``l``: View comments for the selected submission +:``l`` or ``►``: Enter the selected submission :``/``: Open a prompt to switch subreddits :``f``: Open a prompt to search the current subreddit -:``p``: Post a new submission to the current subreddit -:``e``: Edit the selected submission -:``d``: Delete the selected submission - The ``/`` prompt accepts subreddits in the following formats - + * ``/r/python`` * ``/r/python/new`` * ``/r/python+linux`` supports multireddits @@ -131,11 +109,69 @@ Submission Mode In submission mode you can view the self text for a submission and browse comments. -:``◄`` or ``h``: Return to subreddit mode -:``►`` or ``l``: Fold the selected comment, or load additional comments -:``c``: Post a new comment on the selected item -:``e``: Edit the selected comment -:``d``: Delete the selected comment +:``h`` or ``◄``: Return to the subreddit +:``SPACE``: Fold the selected comment, or load additional comments + +============= +Configuration +============= + +------ +Editor +------ + +RTV allows users to compose comments and replies using their preferred text editor (**vi**, **nano**, **gedit**, etc). +You can specify which text editor you would like to use by setting the ``$RTV_EDITOR`` environment variable. + +.. code-block:: bash + + $ export RTV_EDITOR=gedit + +If no editor is specified, RTV will fallback to the system's default ``$EDITOR``, and finally to ``nano``. + +----------- +Web Browser +----------- + +RTV has the capability to open links inside of your web browser. +By default RTV will use the system's browser. +On most systems this corresponds to a graphical browser such as Firefox of Chrome. +If you prefer to stay in the terminal, use ``$BROWSER`` to specify a console-based web browser. +`w3m `_, `lynx `_, and `elinks `_ are all good choices. + +.. code-block:: bash + + $ export BROWSER=w3m + +----------- +Config File +----------- + +RTV will read a configuration placed at ``~/.config/rtv/rtv.cfg`` (or ``$XDG_CONFIG_HOME``). +Each line in the file will replace the corresponding default argument in the launch script. +This can be used to avoid having to re-enter login credentials every time the program is launched. + +Example config: + +.. code-block:: ini + + [rtv] + username=MyUsername + password=MySecretPassword + + # Log file location + log=/tmp/rtv.log + + # Default subreddit + subreddit=CollegeBasketball + + # Default submission link - will be opened every time the program starts + # link=http://www.reddit.com/r/CollegeBasketball/comments/31irjq + + # Turn on ascii-only mode and disable all unicode characters + # This may be necessary for compatibility with some terminal browsers + # ascii=True + ========= Changelog @@ -155,14 +191,14 @@ License Please see `LICENSE `_. -.. |python| image:: https://pypip.in/py_versions/rtv/badge.svg?style=flat-square +.. |python| image:: https://img.shields.io/badge/python-2.7%2C%203.4-blue.svg?style=flat-square :target: https://pypi.python.org/pypi/rtv/ :alt: Supported Python versions -.. |pypi| image:: https://pypip.in/version/rtv/badge.svg?text=version&style=flat-square +.. |pypi| image:: https://img.shields.io/pypi/v/rtv.svg?label=version&style=flat-square :target: https://pypi.python.org/pypi/rtv/ :alt: Latest Version - -.. |downloads| image:: https://pypip.in/download/rtv/badge.svg?period=month&style=flat-square + +.. |downloads| image:: https://img.shields.io/pypi/dm/rtv.svg?period=month&style=flat-square :target: https://pypi.python.org/pypi/rtv/ - :alt: Downloads + :alt: Downloads \ No newline at end of file diff --git a/rtv/__version__.py b/rtv/__version__.py index 6f4fa58f..0f663085 100644 --- a/rtv/__version__.py +++ b/rtv/__version__.py @@ -1 +1 @@ -__version__ = '1.3' +__version__ = '1.4' diff --git a/rtv/docs.py b/rtv/docs.py index 05f88eb9..f25e1782 100644 --- a/rtv/docs.py +++ b/rtv/docs.py @@ -28,30 +28,29 @@ """ HELP = """ -Global Commands - `UP/DOWN` or `j/k` : Scroll to the prev/next item - `a/z` : Upvote/downvote the selected item - `ENTER` or `o` : Open the selected item in the default web browser - `r` : Refresh the current page - `u` : Login/logout of your user account - `?` : Show this help message - `q` : Quit the program +Basic Commands + `j/k` or `UP/DOWN` : Move the cursor up/down + `m/n` or `PgUp/PgDn`: Jump to the previous/next page + `o` or `ENTER` : Open the selected item as a webpage + `r` or `F5` : Refresh page content + `u` : Log in or switch accounts + `?` : Show the help screen + `q` : Quit + +Authenticated Commands + `a/z` : Upvote/downvote + `c` : Compose a new post or comment + `e` : Edit an existing post or comment + `d` : Delete an existing post or comment Subreddit Mode - `RIGHT` or `l` : View comments for the selected submission + `l` or `RIGHT` : Enter the selected submission `/` : Open a prompt to switch subreddits `f` : Open a prompt to search the current subreddit - `p` : Post a new submission to the current subreddit - `e` : Edit the selected submission - `d` : Delete the selected submission Submission Mode - `LEFT` or `h` : Return to subreddit mode - `RIGHT` or `l` : Fold the selected comment, or load additional comments - `c` : Post a new comment on the selected item - `e` : Edit the selected comment - `d` : Delete the selected comment - + `h` or `LEFT` : Return to subreddit mode + `SPACE` : Fold the selected comment, or load additional comments """ COMMENT_FILE = u""" diff --git a/rtv/submission.py b/rtv/submission.py index 453e8f51..29593644 100644 --- a/rtv/submission.py +++ b/rtv/submission.py @@ -45,7 +45,7 @@ def loop(self): cmd = self.stdscr.getch() self.controller.trigger(cmd) - @SubmissionController.register(curses.KEY_RIGHT, 'l') + @SubmissionController.register(curses.KEY_RIGHT, 'l', ' ') def toggle_comment(self): "Toggle the selected comment tree between visible and hidden" diff --git a/rtv/subreddit.py b/rtv/subreddit.py index 57942346..a5b4e4bd 100644 --- a/rtv/subreddit.py +++ b/rtv/subreddit.py @@ -115,7 +115,7 @@ def open_link(self): global history history.add(url) - @SubredditController.register('p') + @SubredditController.register('c') def post_submission(self): "Post a new submission to the given subreddit"