From 7e9455b4ca50a2bdfaf9c092b8c177ecc02abd35 Mon Sep 17 00:00:00 2001
From: John Helmert
Date: Sun, 9 Jun 2019 19:31:35 -0500
Subject: [PATCH] Rename rtv to tuir
---
.coveragerc | 2 +-
.gitignore | 2 +-
.gitlab/issue_template/bug_report.md | 4 +-
.travis.yml | 2 +-
AUTHORS.rst | 4 +-
CONTRIBUTING.rst | 20 +++---
LICENSE | 3 +-
MANIFEST.in | 6 +-
README.md | 69 +++++++++----------
THEMES.md | 14 ++--
rtv/__init__.py | 34 ---------
scripts/RELEASE_CHECKLIST.md | 4 +-
scripts/build_manpage.py | 20 +++---
scripts/count_lines.sh | 6 +-
scripts/demo_theme.py | 18 ++---
scripts/initialize_session.py | 10 +--
scripts/inspect_webbrowser.py | 8 +--
scripts/{rtv.1.template => tuir.1.template} | 20 +++---
scripts/update_packages.py | 4 +-
setup.py | 20 +++---
tests/conftest.py | 24 +++----
tests/test_clipboard.py | 4 +-
tests/test_config.py | 22 +++---
tests/test_content.py | 6 +-
tests/test_inbox.py | 10 +--
tests/test_mime_parsers.py | 2 +-
tests/test_oauth.py | 10 +--
tests/test_objects.py | 4 +-
tests/test_packages.py | 2 +-
tests/test_page.py | 2 +-
tests/test_submission.py | 26 +++----
tests/test_subreddit.py | 16 ++---
tests/test_subscription.py | 4 +-
tests/test_terminal.py | 18 ++---
tests/test_theme.py | 6 +-
rtv.1 => tuir.1 | 26 +++----
tuir/__init__.py | 27 ++++++++
{rtv => tuir}/__main__.py | 30 ++++----
{rtv => tuir}/__version__.py | 0
{rtv => tuir}/clipboard.py | 0
{rtv => tuir}/config.py | 64 ++++++++---------
{rtv => tuir}/content.py | 6 +-
{rtv => tuir}/docs.py | 20 +++---
{rtv => tuir}/exceptions.py | 26 +++----
{rtv => tuir}/inbox_page.py | 0
{rtv => tuir}/mime_parsers.py | 4 +-
{rtv => tuir}/oauth.py | 2 +-
{rtv => tuir}/objects.py | 2 +-
{rtv => tuir}/packages/__init__.py | 2 +-
{rtv => tuir}/packages/praw/__init__.py | 0
.../packages/praw/decorator_helpers.py | 0
{rtv => tuir}/packages/praw/decorators.py | 0
{rtv => tuir}/packages/praw/errors.py | 0
{rtv => tuir}/packages/praw/handlers.py | 0
{rtv => tuir}/packages/praw/helpers.py | 0
{rtv => tuir}/packages/praw/internal.py | 0
{rtv => tuir}/packages/praw/multiprocess.py | 0
{rtv => tuir}/packages/praw/objects.py | 0
{rtv => tuir}/packages/praw/praw.ini | 0
{rtv => tuir}/packages/praw/settings.py | 0
{rtv => tuir}/page.py | 4 +-
{rtv => tuir}/submission_page.py | 0
{rtv => tuir}/subreddit_page.py | 0
{rtv => tuir}/subscription_page.py | 0
{rtv => tuir}/templates/index.html | 4 +-
{rtv => tuir}/templates/mailcap | 14 ++--
.../rtv.cfg => tuir/templates/tuir.cfg | 22 +++---
{rtv => tuir}/terminal.py | 24 +++----
{rtv => tuir}/theme.py | 6 +-
{rtv => tuir}/themes/colorblind-dark.cfg | 0
{rtv => tuir}/themes/default.cfg.example | 0
{rtv => tuir}/themes/molokai.cfg | 0
{rtv => tuir}/themes/papercolor.cfg | 0
{rtv => tuir}/themes/solarized-dark.cfg | 0
{rtv => tuir}/themes/solarized-light.cfg | 0
version.py | 2 +-
76 files changed, 352 insertions(+), 359 deletions(-)
delete mode 100644 rtv/__init__.py
rename scripts/{rtv.1.template => tuir.1.template} (73%)
rename rtv.1 => tuir.1 (80%)
create mode 100644 tuir/__init__.py
rename {rtv => tuir}/__main__.py (92%)
rename {rtv => tuir}/__version__.py (100%)
rename {rtv => tuir}/clipboard.py (100%)
rename {rtv => tuir}/config.py (83%)
rename {rtv => tuir}/content.py (99%)
rename {rtv => tuir}/docs.py (93%)
rename {rtv => tuir}/exceptions.py (68%)
rename {rtv => tuir}/inbox_page.py (100%)
rename {rtv => tuir}/mime_parsers.py (98%)
rename {rtv => tuir}/oauth.py (99%)
rename {rtv => tuir}/objects.py (99%)
rename {rtv => tuir}/packages/__init__.py (89%)
rename {rtv => tuir}/packages/praw/__init__.py (100%)
rename {rtv => tuir}/packages/praw/decorator_helpers.py (100%)
rename {rtv => tuir}/packages/praw/decorators.py (100%)
rename {rtv => tuir}/packages/praw/errors.py (100%)
rename {rtv => tuir}/packages/praw/handlers.py (100%)
rename {rtv => tuir}/packages/praw/helpers.py (100%)
rename {rtv => tuir}/packages/praw/internal.py (100%)
rename {rtv => tuir}/packages/praw/multiprocess.py (100%)
rename {rtv => tuir}/packages/praw/objects.py (100%)
rename {rtv => tuir}/packages/praw/praw.ini (100%)
rename {rtv => tuir}/packages/praw/settings.py (100%)
rename {rtv => tuir}/page.py (99%)
rename {rtv => tuir}/submission_page.py (100%)
rename {rtv => tuir}/subreddit_page.py (100%)
rename {rtv => tuir}/subscription_page.py (100%)
rename {rtv => tuir}/templates/index.html (89%)
rename {rtv => tuir}/templates/mailcap (85%)
rename rtv/templates/rtv.cfg => tuir/templates/tuir.cfg (90%)
rename {rtv => tuir}/terminal.py (97%)
rename {rtv => tuir}/theme.py (99%)
rename {rtv => tuir}/themes/colorblind-dark.cfg (100%)
rename {rtv => tuir}/themes/default.cfg.example (100%)
rename {rtv => tuir}/themes/molokai.cfg (100%)
rename {rtv => tuir}/themes/papercolor.cfg (100%)
rename {rtv => tuir}/themes/solarized-dark.cfg (100%)
rename {rtv => tuir}/themes/solarized-light.cfg (100%)
diff --git a/.coveragerc b/.coveragerc
index d5400c0..f727ab0 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,5 +1,5 @@
[run]
-source = rtv
+source = tuir
omit =
*/__main__.py
*/packages/praw/*
diff --git a/.gitignore b/.gitignore
index f0c21d5..76052c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,6 @@
*.log
build
dist
-rtv.egg-info
+tuir.egg-info
tests/refresh-token
venv/
diff --git a/.gitlab/issue_template/bug_report.md b/.gitlab/issue_template/bug_report.md
index 2b180c3..1aedb8a 100644
--- a/.gitlab/issue_template/bug_report.md
+++ b/.gitlab/issue_template/bug_report.md
@@ -12,5 +12,5 @@ A clear description of what the bug is and how to reproduce it.
**Describe your environment**
- If a stack trace was displayed on the command line, paste the entire output here.
-- Otherwise, run ``$rtv --debug-info`` and paste the entire output here.
-- Include any other information that might be relevant to the issue (For example, your operating system, your terminal emulator, how you installed rtv, etc.)
+- Otherwise, run ``$tuir --debug-info`` and paste the entire output here.
+- Include any other information that might be relevant to the issue (For example, your operating system, your terminal emulator, how you installed tuir, etc.)
diff --git a/.travis.yml b/.travis.yml
index 532e045..11038f9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,7 +24,7 @@ install:
- pip install .[test]
- pip install .
script:
- - pylint --rcfile .pylintrc -E rtv/
+ - pylint --rcfile .pylintrc -E tuir/
- coverage run -m py.test -v
after_success:
- coveralls
diff --git a/AUTHORS.rst b/AUTHORS.rst
index 8077652..16b7bf0 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -1,5 +1,5 @@
================
-RTV Contributors
+RTV/TUIR Contributors
================
Thanks to the following people for their contributions to this project.
@@ -59,4 +59,4 @@ Thanks to the following people for their contributions to this project.
* `Adam Talsma `_
* `geheimnisse `_
* `Alexander Terry `_
-* `peterpans01 `_
\ No newline at end of file
+* `peterpans01 `_
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 217555a..5ffc0db 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -5,7 +5,7 @@ Contributor Guidelines
Before you start
================
-- Post an issue on the `tracker `_ describing the bug or feature you would like to add
+- Post an issue on the `tracker `_ describing the bug or feature you would like to add
- If an issue already exists, leave a comment to let others know that you intend to work on it
Considerations
@@ -70,36 +70,36 @@ This both speeds up the tests and helps to maintain consistency across runs.
.. code-block:: bash
- $ pip install rtv[test]
+ $ pip install tuir[test]
-2. Set your ``$PYTHONPATH`` to point to the directory of your RTV repository.
+2. Set your ``$PYTHONPATH`` to point to the directory of your TUIR repository.
.. code-block:: bash
- $ export PYTHONPATH=~/code/rtv/
+ $ export PYTHONPATH=~/code/tuir/
3. Run the tests using the existing cassettes
.. code-block:: bash
- $ python -m pytest ~/code/rtv/tests/
+ $ python -m pytest ~/code/tuir/tests/
================================ test session starts ================================
platform linux -- Python 3.4.0, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
- rootdir: ~/code/rtv/, inifile:
+ rootdir: ~/code/tuir/, inifile:
plugins: xdist-1.14, cov-2.2.0
collected 113 items
4. By default, the cassettes will act as read-only.
If you have written a new test and would like to record a cassette, you must provide your own refresh token.
- The easiest thing to do is to use the token generated by RTV when you log in.
- This is usually stored as *~/.local/share/rtv/refresh-token*.
+ The easiest thing to do is to use the token generated by TUIR when you log in.
+ This is usually stored as *~/.local/share/tuir/refresh-token*.
.. code-block:: bash
- $ python -m pytest ~/code/rtv/tests/ --record-mode once --refresh-token ~/.local/share/rtv/refresh-token
+ $ python -m pytest ~/code/tuir/tests/ --record-mode once --refresh-token ~/.local/share/tuir/refresh-token
================================ test session starts ================================
platform linux -- Python 3.4.0, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
- rootdir: ~/code/rtv/, inifile:
+ rootdir: ~/code/tuir/, inifile:
plugins: xdist-1.14, cov-2.2.0
collected 113 items
diff --git a/LICENSE b/LICENSE
index c058a6a..f7a8404 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,7 @@
The MIT License (MIT)
-Copyright (c) 2015 michael-lazar
+Portions Copyright (c) 2015 michael-lazar
+Portions Copyright (c) 2019 John Helmert
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/MANIFEST.in b/MANIFEST.in
index 696abb8..9aaefc5 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -3,6 +3,6 @@ include CHANGELOG.rst
include AUTHORS.rst
include README.md
include LICENSE
-include rtv.1
-include rtv/templates/*
-include rtv/themes/*
+include tuir.1
+include tuir/templates/*
+include tuir/themes/*
diff --git a/README.md b/README.md
index 0cf7b15..8bf868a 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,34 @@
-Reddit Terminal Viewer (RTV)
+Terminal UI for Reddit (TUIR)
A text-based interface (TUI) to view and interact with Reddit from your terminal.
- This fork of rtv is currently maintained by John Helmert III (ajak) and was maintained by Michael Lazar in this respository until commit 7923890 on Jun 3, 2019.
+ TUIR is a fork of rtv, which was maintained by Michael Lazar in this respository until Jun 3, 2019.
-
+
+
-
-
+
+
-->
## Table of Contents
@@ -88,21 +88,21 @@ $ pkg install rtv
### From source
```bash
-$ git clone https://gitlab.com/ajak/rtv.git
-$ cd rtv
+$ git clone https://gitlab.com/ajak/tuir.git
+$ cd tuir
$ python setup.py install
```
### Windows
-RTV is not supported on Windows, due to a lack of resources and interest. Sorry!
+TUIR is not supported on Windows, due to a lack of resources and interest. Sorry!
## Usage
To run the program, type:
```bash
-$ rtv --help
+$ tuir --help
```
### Controls
@@ -130,17 +130,17 @@ See [CONTROLS](CONTROLS.md) for the full list of commands.
### Configuration File
-Configuration files are stored in the ``{HOME}/.config/rtv/`` directory.
+Configuration files are stored in the ``{HOME}/.config/tuir/`` directory.
-Check out [rtv.cfg](rtv/templates/rtv.cfg) for the full list of configurable options. You can clone this file into your home directory by running:
+Check out [tuir.cfg](tuir/templates/tuir.cfg) for the full list of configurable options. You can clone this file into your home directory by running:
```bash
-$ rtv --copy-config
+$ tuir --copy-config
```
### Viewing Media Links
-You can use [mailcap](https://en.wikipedia.org/wiki/Media_type#Mailcap) to configure how RTV will open different types of links.
+You can use [mailcap](https://en.wikipedia.org/wiki/Media_type#Mailcap) to configure how TUIR will open different types of links.
@@ -149,30 +149,30 @@ You can use [mailcap](https://en.wikipedia.org/wiki/Media_type#Mailcap) to confi
A mailcap file allows you to associate different MIME media types, like ``image/jpeg`` or ``video/mp4``, with shell commands. This feature is disabled by default because it takes a few extra steps to configure. To get started, copy the default mailcap template to your home directory.
```bash
-$ rtv --copy-mailcap
+$ tuir --copy-mailcap
```
-This template contains examples for common MIME types that work with popular reddit websites like *imgur*, *youtube*, and *gfycat*. Open the mailcap template and follow the [instructions](rtv/templates/mailcap) listed inside.
+This template contains examples for common MIME types that work with popular reddit websites like *imgur*, *youtube*, and *gfycat*. Open the mailcap template and follow the [instructions](tuir/templates/mailcap) listed inside.
-Once you've setup your mailcap file, enable it by launching rtv with the ``rtv --enable-media`` flag (or set it in your **rtv.cfg**)
+Once you've setup your mailcap file, enable it by launching tuir with the ``tuir --enable-media`` flag (or set it in your **tuir.cfg**)
### Environment Variables
-The default programs that RTV interacts with can be configured through environment variables:
+The default programs that TUIR interacts with can be configured through environment variables:
- | $RTV_EDITOR |
+ $TUIR_EDITOR |
A program used to compose text submissions and comments, e.g. vim, emacs, gedit
If not specified, will fallback to $VISUAL and $EDITOR in that order. |
- | $RTV_BROWSER |
+ $TUIR_BROWSER |
A program used to open links to external websites, e.g. firefox, google-chrome, w3m, lynx
If not specified, will fallback to $BROWSER, or your system's default browser. |
- | $RTV_URLVIEWER |
+ $TUIR_URLVIEWER |
A tool used to extract hyperlinks from blocks of text, e.g. urlview, urlscan
If not specified, will fallback to urlview if it is installed. |
@@ -180,12 +180,12 @@ The default programs that RTV interacts with can be configured through environme
### Clipboard
-RTV supports copying submission links to the OS clipboard. On macOS this is supported out of the box.
+TUIR supports copying submission links to the OS clipboard. On macOS this is supported out of the box.
On Linux systems you will need to install either [xsel](http://www.vergenet.net/~conrad/software/xsel/) or [xclip](https://sourceforge.net/projects/xclip/).
## Themes
-Themes can be used to customize the look and feel of RTV
+Themes can be used to customize the look and feel of TUIR
@@ -210,24 +210,24 @@ Themes can be used to customize the look and feel of RTV
-You can list all installed themes with the ``--list-themes`` command, and select one with ``--theme``. You can save your choice permanently in your [rtv.cfg](rtv/templates/rtv.cfg) file. You can also use the F2 & F3 keys inside of RTV to cycle through all available themes.
+You can list all installed themes with the ``--list-themes`` command, and select one with ``--theme``. You can save your choice permanently in your [tuir.cfg](tuir/templates/tuir.cfg) file. You can also use the F2 & F3 keys inside of TUIR to cycle through all available themes.
For instructions on writing and installing your own themes, see [THEMES.md](THEMES.md).
## FAQ
- Why am I getting an error during installation/when launching rtv?
+ Why am I getting an error during installation/when launching tuir?
> If your distro ships with an older version of python 2.7 or python-requests,
> you may experience SSL errors or other package incompatibilities. The
- > easiest way to fix this is to install rtv using python 3. If you
+ > easiest way to fix this is to install tuir using python 3. If you
> don't already have pip3, see http://stackoverflow.com/a/6587528 for setup
> instructions. Then do
>
> ```bash
- > $ sudo pip uninstall rtv
- > $ sudo pip3 install -U rtv
+ > $ sudo pip uninstall tuir
+ > $ sudo pip3 install -U tuir
> ```
@@ -237,7 +237,7 @@ For instructions on writing and installing your own themes, see [THEMES.md](THEM
> This type of text usually shows up when python is unable to render
> unicode properly.
>
- > 1. Try starting RTV in ascii-only mode with ``rtv --ascii``
+ > 1. Try starting TUIR in ascii-only mode with ``tuir --ascii``
> 2. Make sure that the terminal/font that you're using supports unicode
> 3. Try [setting the LOCALE to utf-8](https://perlgeek.de/en/article/set-up-a-clean-utf8-environment)
> 4. Your python may have been built against the wrong curses library,
@@ -250,11 +250,11 @@ For instructions on writing and installing your own themes, see [THEMES.md](THEM
> This project is structured to be run as a python *module*. This means that
> you need to launch it using python's ``-m`` flag. See the example below, which
- > assumes that you have cloned the repository into the directory **~/rtv_project**.
+ > assumes that you have cloned the repository into the directory **~/tuir_project**.
>
> ```bash
- > $ cd ~/rtv_project
- > $ python3 -m rtv
+ > $ cd ~/tuir_project
+ > $ python3 -m tuir
> ```
@@ -266,4 +266,3 @@ Before writing any code, please read the [Contributor Guidelines](CONTRIBUTING.r
## License
This project is distributed under the [MIT](LICENSE) license.
-
diff --git a/THEMES.md b/THEMES.md
index 401f0f9..8de2efe 100644
--- a/THEMES.md
+++ b/THEMES.md
@@ -2,12 +2,12 @@
## Installing Themes
-You can install custom themes by copying them into your **~/.config/rtv/themes/**
+You can install custom themes by copying them into your **~/.config/tuir/themes/**
directory. The name of the theme will match the name of the file.
```
-$ cp my-custom-theme.cfg ~/.config/rtv/themes/
-$ rtv --theme my-custom-theme
+$ cp my-custom-theme.cfg ~/.config/tuir/themes/
+$ tuir --theme my-custom-theme
```
If you've created a cool theme and would like to share it with the community,
@@ -31,7 +31,7 @@ Color support on modern terminals can be split into 4 categories:
The 16 system colors, along with the default foreground and background,
can usually be customized through your terminal's profile settings. The
6x6x6 color palette and grayscale colors are constant RGB values across
-all terminals. RTV's default theme only uses the 8 primary system colors,
+all terminals. TUIR's default theme only uses the 8 primary system colors,
which is why it matches the "look and feel" of the terminal that you're
running it in.
@@ -62,9 +62,9 @@ it will be set automatically by you terminal. Often, problems with
terminal colors can be traced back to somebody hardcoding
``TERM=xterm-256color`` in their .bashrc file.
-## Understanding RTV Themes
+## Understanding TUIR Themes
-Here's an example of what an RTV theme file looks like:
+Here's an example of what an TUIR theme file looks like:
```
[theme]
@@ -162,7 +162,7 @@ Attributes can be mixed together using the + symbol. For example,
### Modifiers
-RTV themes use special "modifer" elements to define the default
+TUIR themes use special "modifer" elements to define the default
application style. This allows you to do things like set the default
background color without needing to set ```` on every
single element. The three modifier elements are:
diff --git a/rtv/__init__.py b/rtv/__init__.py
deleted file mode 100644
index 79be411..0000000
--- a/rtv/__init__.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-r"""
-________ __________________________
-___ __ \__________ /_____ /__(_)_ /_
-__ /_/ / _ \ __ /_ __ /__ /_ __/
-_ _, _// __/ /_/ / / /_/ / _ / / /_
-/_/ |_| \___/\__,_/ \__,_/ /_/ \__/
-
-
-________ _____ ______
-___ __/__________________ ______(_)____________ ___ /
-__ / _ _ \_ ___/_ __ `__ \_ /__ __ \ __ `/_ /
-_ / / __/ / _ / / / / / / _ / / / /_/ /_ /
-/_/ \___//_/ /_/ /_/ /_//_/ /_/ /_/\__,_/ /_/
-
-
-___ ______
-__ | / /__(_)_______ ______________
-__ | / /__ /_ _ \_ | /| / / _ \_ ___/
-__ |/ / _ / / __/_ |/ |/ // __/ /
-_____/ /_/ \___/____/|__/ \___//_/
-
-
-(RTV)
-"""
-
-from __future__ import unicode_literals
-
-from .__version__ import __version__
-
-__title__ = 'Reddit Terminal Viewer'
-__author__ = 'Michael Lazar'
-__license__ = 'The MIT License (MIT)'
-__copyright__ = '(c) 2016 Michael Lazar'
diff --git a/scripts/RELEASE_CHECKLIST.md b/scripts/RELEASE_CHECKLIST.md
index bfdf37e..6452957 100644
--- a/scripts/RELEASE_CHECKLIST.md
+++ b/scripts/RELEASE_CHECKLIST.md
@@ -2,7 +2,7 @@ Release Checklist
-----------------
1. Switch to the master branch and stash any uncommited changes.
-2. Bump the version number in [rtv/\_\_version\_\_.py](rtv/__version__.py).
+2. Bump the version number in [tuir/\_\_version\_\_.py](tuir/__version__.py).
3. Update the release notes in the [CHANGELOG.rst](CHANGELOG.rst).
4. Update the contributor list by running [``scripts/build_authors.py``](scripts/build_authors.py).
5. Re-generate the manpage by running [``scripts/build_manpage.py``](scripts/build_manpage.py).
@@ -11,7 +11,7 @@ Release Checklist
8. Clean out any old build/release files by running [``scripts/pip_clean.py``](scripts/pip_clean.py).
9. Build the source tarball and binary wheel: ``$ python3 setup.py sdist bdist_wheel``
10. Upload the packages to PyPI: ``$ twine upload dist/*``
-11. Verify that the upload was successful: ``$ pip install rtv --upgrade --force-reinstall``
+11. Verify that the upload was successful: ``$ pip install tuir --upgrade --force-reinstall``
12. Smoke test the new release on Python 2 and Python 3.
12. Create a new release on Github and copy the release notes from the changelog.
13. Use Github to delete any old branches that have been merged.
diff --git a/scripts/build_manpage.py b/scripts/build_manpage.py
index eb95d64..890786e 100755
--- a/scripts/build_manpage.py
+++ b/scripts/build_manpage.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
-Internal tool used to automatically generate an up-to-date version of the rtv
+Internal tool used to automatically generate an up-to-date version of the tuir
man page. Currently this script should be manually ran after each version bump.
In the future, it would be nice to have this functionality built into setup.py.
@@ -17,8 +17,8 @@ _filepath = os.path.dirname(os.path.relpath(__file__))
ROOT = os.path.abspath(os.path.join(_filepath, '..'))
sys.path.insert(0, ROOT)
-import rtv
-from rtv import config
+import tuir
+from tuir import config
def main():
@@ -30,7 +30,7 @@ def main():
data = {}
print('Fetching version')
- data['version'] = rtv.__version__
+ data['version'] = tuir.__version__
print('Fetching release date')
data['release_date'] = datetime.utcnow().strftime('%B %d, %Y')
print('Fetching synopsis')
@@ -65,18 +65,18 @@ def main():
options += '\n'.join(('.TP', flag, description, '\n'))
data['options'] = options
print('Fetching license')
- data['license'] = rtv.__license__
+ data['license'] = tuir.__license__
print('Fetching copyright')
- data['copyright'] = rtv.__copyright__
+ data['copyright'] = tuir.__copyright__
# Escape dashes is all of the sections
data = {k: v.replace('-', r'\-') for k, v in data.items()}
- print('Reading from %s/scripts/rtv.1.template' % ROOT)
- with open(os.path.join(ROOT, 'scripts/rtv.1.template')) as fp:
+ print('Reading from %s/scripts/tuir.1.template' % ROOT)
+ with open(os.path.join(ROOT, 'scripts/tuir.1.template')) as fp:
template = fp.read()
print('Populating template')
out = template.format(**data)
- print('Writing to %s/rtv.1' % ROOT)
- with open(os.path.join(ROOT, 'rtv.1'), 'w') as fp:
+ print('Writing to %s/tuir.1' % ROOT)
+ with open(os.path.join(ROOT, 'tuir.1'), 'w') as fp:
fp.write(out)
diff --git a/scripts/count_lines.sh b/scripts/count_lines.sh
index 7e27681..f12cfc3 100755
--- a/scripts/count_lines.sh
+++ b/scripts/count_lines.sh
@@ -8,8 +8,8 @@ echo "$(wc -l tests/*.py)"
echo -e "\nScripts: "
echo "$(wc -l scripts/*)"
echo -e "\nTemplates: "
-echo "$(wc -l rtv/templates/*)"
+echo "$(wc -l tuir/templates/*)"
echo -e "\nCode: "
-echo "$(wc -l rtv/*.py)"
+echo "$(wc -l tuir/*.py)"
echo -e "\nCombined: "
-echo "$(cat tests/*.py scripts/* rtv/templates/* rtv/*.py | wc -l) total lines"
+echo "$(cat tests/*.py scripts/* tuir/templates/* tuir/*.py | wc -l) total lines"
diff --git a/scripts/demo_theme.py b/scripts/demo_theme.py
index da5492a..0a86c13 100755
--- a/scripts/demo_theme.py
+++ b/scripts/demo_theme.py
@@ -15,15 +15,15 @@ from collections import Counter
from vcr import VCR
from six.moves.urllib.parse import urlparse, parse_qs
-from rtv.theme import Theme, ThemeList
-from rtv.config import Config
-from rtv.packages import praw
-from rtv.oauth import OAuthHelper
-from rtv.terminal import Terminal
-from rtv.objects import curses_session
-from rtv.subreddit_page import SubredditPage
-from rtv.submission_page import SubmissionPage
-from rtv.subscription_page import SubscriptionPage
+from tuir.theme import Theme, ThemeList
+from tuir.config import Config
+from tuir.packages import praw
+from tuir.oauth import OAuthHelper
+from tuir.terminal import Terminal
+from tuir.objects import curses_session
+from tuir.subreddit_page import SubredditPage
+from tuir.submission_page import SubmissionPage
+from tuir.subscription_page import SubscriptionPage
try:
from unittest import mock
diff --git a/scripts/initialize_session.py b/scripts/initialize_session.py
index 1a8eb84..e169be1 100644
--- a/scripts/initialize_session.py
+++ b/scripts/initialize_session.py
@@ -3,10 +3,10 @@ Initialize an authenticated instance of PRAW to interact with.
$ python -i initialize_session.py
"""
-from rtv.docs import AGENT
-from rtv.packages import praw
-from rtv.content import RequestHeaderRateLimiter
-from rtv.config import Config
+from tuir.docs import AGENT
+from tuir.packages import praw
+from tuir.content import RequestHeaderRateLimiter
+from tuir.config import Config
config = Config()
config.load_refresh_token()
@@ -27,4 +27,4 @@ reddit.refresh_access_information(config.refresh_token)
inbox = reddit.get_inbox()
items = [next(inbox) for _ in range(20)]
-pass
\ No newline at end of file
+pass
diff --git a/scripts/inspect_webbrowser.py b/scripts/inspect_webbrowser.py
index 35ef49a..cfaf167 100755
--- a/scripts/inspect_webbrowser.py
+++ b/scripts/inspect_webbrowser.py
@@ -11,11 +11,11 @@ os.environ['BROWSER'] = 'firefox'
# If we want to override the $BROWSER variable that the python webbrowser
# references, it needs to be done before the webbrowser module is imported
# for the first time.
-RTV_BROWSER, BROWSER = os.environ.get('RTV_BROWSER'), os.environ.get('BROWSER')
-if RTV_BROWSER:
- os.environ['BROWSER'] = RTV_BROWSER
+TUIR_BROWSER, BROWSER = os.environ.get('TUIR_BROWSER'), os.environ.get('BROWSER')
+if TUIR_BROWSER:
+ os.environ['BROWSER'] = TUIR_BROWSER
-print('RTV_BROWSER=%s' % RTV_BROWSER)
+print('TUIR_BROWSER=%s' % TUIR_BROWSER)
print('BROWSER=%s' % BROWSER)
import webbrowser
diff --git a/scripts/rtv.1.template b/scripts/tuir.1.template
similarity index 73%
rename from scripts/rtv.1.template
rename to scripts/tuir.1.template
index 9c36dc6..5182c0c 100644
--- a/scripts/rtv.1.template
+++ b/scripts/tuir.1.template
@@ -1,6 +1,6 @@
-.TH "RTV" "1" "{release_date}" "Version {version}" "Usage and Commands"
+.TH "TUIR" "1" "{release_date}" "Version {version}" "Usage and Commands"
.SH NAME
-RTV - Reddit Terminal Viewer
+TUIR - Terminal UI for Reddit
.SH SYNOPSIS
{synopsis}
.SH DESCRIPTION
@@ -17,32 +17,32 @@ Press \fBright\fR to view the selected submission and \fBleft\fR to return.
Press \fB?\fR to open the help screen.
.SH FILES
.TP
-.BR $XDG_CONFIG_HOME/rtv/rtv.cfg
+.BR $XDG_CONFIG_HOME/tuir/tuir.cfg
The configuration file can be used to customize default program settings.
.TP
-.BR $XDG_DATA_HOME/rtv/refresh-token
+.BR $XDG_DATA_HOME/tuir/refresh-token
After you login to reddit, your most recent OAuth refresh token will be stored
for future sessions.
.TP
-.BR $XDG_DATA_HOME/rtv/history.log
+.BR $XDG_DATA_HOME/tuir/history.log
This file stores URLs that have been recently opened in order to
visually highlight them as "seen".
.SH ENVIRONMENT
.TP
-.BR RTV_EDITOR
+.BR TUIR_EDITOR
Text editor to use when editing comments and submissions. Will fallback to
\fI$EDITOR\fR.
.TP
-.BR RTV_URLVIEWER
+.BR TUIR_URLVIEWER
Url viewer to use to extract links from comments. Requires a compatible
program to be installed.
.TP
-.BR RTV_BROWSER
+.BR TUIR_BROWSER
Web browser to use when opening links. Will fallback to \fI$BROWSER\fR.
.SH AUTHOR
Michael Lazar (2017).
-John Helmert (2019).
+John Helmert III (2019).
.SH BUGS
-Report bugs to \fIhttps://gitlab.com/ajak/rtv/issues\fR
+Report bugs to \fIhttps://gitlab.com/ajak/tuir/issues\fR
.SH LICENSE
{license}
diff --git a/scripts/update_packages.py b/scripts/update_packages.py
index 0f0815f..2c6594d 100755
--- a/scripts/update_packages.py
+++ b/scripts/update_packages.py
@@ -29,13 +29,13 @@ def main():
commit = p.stdout.read().strip()
print('Found commit %s' % commit)
regex = 's/^__praw_hash__ =.*$/__praw_hash__ = \'%s\'/g' % commit
- packages_root = os.path.join(ROOT, 'rtv', 'packages', '__init__.py')
+ packages_root = os.path.join(ROOT, 'tuir', 'packages', '__init__.py')
print('Updating commit hash in %s' % packages_root)
subprocess.check_call(['sed', '-i', '', regex, packages_root])
# Overwrite the project files
src = os.path.join(tmpdir, 'praw')
- dest = os.path.join(ROOT, 'rtv', 'packages', 'praw')
+ dest = os.path.join(ROOT, 'tuir', 'packages', 'praw')
print('Copying package files to %s' % dest)
shutil.rmtree(dest, ignore_errors=True)
shutil.copytree(src, dest)
diff --git a/setup.py b/setup.py
index 5171bc5..3a10481 100644
--- a/setup.py
+++ b/setup.py
@@ -44,30 +44,30 @@ def long_description():
setuptools.setup(
- name='rtv',
+ name='tuir',
version=version,
- description='A simple terminal viewer for Reddit (Reddit Terminal Viewer)',
+ description='A simple terminal viewer for Reddit (Terminal UI for Reddit)',
long_description=long_description(),
long_description_content_type='text/markdown',
- url='https://gitlab.com/ajak/rtv',
+ url='https://gitlab.com/ajak/tuir',
author='John Helmert III',
author_email='jchelmertt3@gmail.com',
license='MIT',
keywords='reddit terminal praw curses',
packages=[
- 'rtv',
- 'rtv.packages',
- 'rtv.packages.praw'
+ 'tuir',
+ 'tuir.packages',
+ 'tuir.packages.praw'
],
package_data={
- 'rtv': ['templates/*', 'themes/*'],
- 'rtv.packages.praw': ['praw.ini']
+ 'tuir': ['templates/*', 'themes/*'],
+ 'tuir.packages.praw': ['praw.ini']
},
- data_files=[("share/man/man1", ["rtv.1"])],
+ data_files=[("share/man/man1", ["tuir.1"])],
install_requires=install_requires,
tests_require=tests_require,
extras_require=extras_require,
- entry_points={'console_scripts': ['rtv=rtv.__main__:main']},
+ entry_points={'console_scripts': ['tuir=tuir.__main__:main']},
classifiers=[
'Intended Audience :: End Users/Desktop',
'Environment :: Console :: Curses',
diff --git a/tests/conftest.py b/tests/conftest.py
index b1bc16f..faa8141 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -11,15 +11,15 @@ import pytest
from vcr import VCR
from six.moves.urllib.parse import urlparse, parse_qs
-from rtv.oauth import OAuthHelper, OAuthHandler, OAuthHTTPServer
-from rtv.content import RequestHeaderRateLimiter
-from rtv.config import Config
-from rtv.packages import praw
-from rtv.terminal import Terminal
-from rtv.subreddit_page import SubredditPage
-from rtv.submission_page import SubmissionPage
-from rtv.subscription_page import SubscriptionPage
-from rtv.inbox_page import InboxPage
+from tuir.oauth import OAuthHelper, OAuthHandler, OAuthHTTPServer
+from tuir.content import RequestHeaderRateLimiter
+from tuir.config import Config
+from tuir.packages import praw
+from tuir.terminal import Terminal
+from tuir.subreddit_page import SubredditPage
+from tuir.submission_page import SubmissionPage
+from tuir.subscription_page import SubscriptionPage
+from tuir.inbox_page import InboxPage
try:
from unittest import mock
@@ -40,7 +40,7 @@ for name in ['vcr.matchers', 'vcr.stubs']:
def pytest_addoption(parser):
parser.addoption('--record-mode', dest='record_mode', default='none')
parser.addoption('--refresh-token', dest='refresh_token',
- default='~/.local/share/rtv/refresh-token')
+ default='~/.local/share/tuir/refresh-token')
class MockStdscr(mock.MagicMock):
@@ -184,9 +184,9 @@ def reddit(vcr, request):
os.remove(filename)
with vcr.use_cassette(cassette_name):
- with patch('rtv.packages.praw.Reddit.get_access_information'):
+ with patch('tuir.packages.praw.Reddit.get_access_information'):
handler = RequestHeaderRateLimiter()
- reddit = praw.Reddit(user_agent='rtv test suite',
+ reddit = praw.Reddit(user_agent='tuir test suite',
decode_html_entities=False,
disable_update_check=True,
handler=handler)
diff --git a/tests/test_clipboard.py b/tests/test_clipboard.py
index 7dc77df..96aec4e 100644
--- a/tests/test_clipboard.py
+++ b/tests/test_clipboard.py
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
import pytest
-from rtv.clipboard import copy
-from rtv.exceptions import ProgramError
+from tuir.clipboard import copy
+from tuir.exceptions import ProgramError
try:
diff --git a/tests/test_config.py b/tests/test_config.py
index 759c7dd..6965785 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -5,7 +5,7 @@ import os
import codecs
from tempfile import NamedTemporaryFile
-from rtv.config import Config, copy_default_config, copy_default_mailcap
+from tuir.config import Config, copy_default_config, copy_default_mailcap
try:
from unittest import mock
@@ -17,7 +17,7 @@ def test_copy_default_config():
"""Make sure the default config file was included in the package"""
with NamedTemporaryFile(suffix='.cfg') as fp:
- with mock.patch('rtv.config.six.moves.input', return_value='y'):
+ with mock.patch('tuir.config.six.moves.input', return_value='y'):
copy_default_config(fp.name)
assert fp.read()
# Check that the permissions were changed
@@ -29,7 +29,7 @@ def test_copy_default_config_cancel():
"""Pressing ``n`` should cancel the copy"""
with NamedTemporaryFile(suffix='.cfg') as fp:
- with mock.patch('rtv.config.six.moves.input', return_value='n'):
+ with mock.patch('tuir.config.six.moves.input', return_value='n'):
copy_default_config(fp.name)
assert not fp.read()
@@ -38,7 +38,7 @@ def test_copy_config_interrupt():
"""Pressing ``Ctrl-C`` should cancel the copy"""
with NamedTemporaryFile(suffix='.cfg') as fp:
- with mock.patch('rtv.config.six.moves.input') as func:
+ with mock.patch('tuir.config.six.moves.input') as func:
func.side_effect = KeyboardInterrupt
copy_default_config(fp.name)
assert not fp.read()
@@ -48,7 +48,7 @@ def test_copy_default_mailcap():
"""Make sure the example mailcap file was included in the package"""
with NamedTemporaryFile() as fp:
- with mock.patch('rtv.config.six.moves.input', return_value='y'):
+ with mock.patch('tuir.config.six.moves.input', return_value='y'):
copy_default_mailcap(fp.name)
assert fp.read()
# Check that the permissions were changed
@@ -79,7 +79,7 @@ def test_config_interface():
def test_config_get_args():
"""Ensure that command line arguments are parsed properly"""
- args = ['rtv',
+ args = ['tuir',
'https://reddit.com/permalink •',
'-s', 'cfb',
'--log', 'logfile.log',
@@ -95,7 +95,7 @@ def test_config_get_args():
'--no-flash',
'--no-autologin']
- with mock.patch('sys.argv', ['rtv']):
+ with mock.patch('sys.argv', ['tuir']):
config_dict = Config.get_args()
config = Config(**config_dict)
assert config.config == {}
@@ -124,14 +124,14 @@ def test_config_get_args():
def test_config_link_deprecated():
# Should still be able to specify the link using the old "-l"
- args = ['rtv', '-l', 'https://reddit.com/option']
+ args = ['tuir', '-l', 'https://reddit.com/option']
with mock.patch('sys.argv', args):
config_dict = Config.get_args()
config = Config(**config_dict)
assert config['link'] == 'https://reddit.com/option'
# But the positional argument should take preference
- args = ['rtv', 'https://reddit.com/arg', '-l', 'https://reddit.com/option']
+ args = ['tuir', 'https://reddit.com/arg', '-l', 'https://reddit.com/option']
with mock.patch('sys.argv', args):
config_dict = Config.get_args()
config = Config(**config_dict)
@@ -172,9 +172,9 @@ def test_config_from_file():
assert config.config == {}
assert config.keymap._keymap == default_keymap
- # [rtv]
+ # [tuir]
rows = ['{0}={1}'.format(key, val) for key, val in args.items()]
- data = '\n'.join(['[rtv]'] + rows)
+ data = '\n'.join(['[tuir]'] + rows)
fp.write(codecs.encode(data, 'utf-8'))
# [bindings]
diff --git a/tests/test_content.py b/tests/test_content.py
index 31f24d2..7da3fa2 100644
--- a/tests/test_content.py
+++ b/tests/test_content.py
@@ -8,9 +8,9 @@ from collections import OrderedDict
import six
import pytest
-from rtv import exceptions
-from rtv.packages import praw
-from rtv.content import (
+from tuir import exceptions
+from tuir.packages import praw
+from tuir.content import (
Content, SubmissionContent, SubredditContent, SubscriptionContent,
RequestHeaderRateLimiter)
diff --git a/tests/test_inbox.py b/tests/test_inbox.py
index 53cfc4c..63b52a2 100644
--- a/tests/test_inbox.py
+++ b/tests/test_inbox.py
@@ -2,12 +2,12 @@
from __future__ import unicode_literals
import pytest
-from rtv.packages.praw.errors import InvalidUser
+from tuir.packages.praw.errors import InvalidUser
-from rtv import exceptions
-from rtv.docs import FOOTER_INBOX
-from rtv.inbox_page import InboxPage
-from rtv.submission_page import SubmissionPage
+from tuir import exceptions
+from tuir.docs import FOOTER_INBOX
+from tuir.inbox_page import InboxPage
+from tuir.submission_page import SubmissionPage
try:
from unittest import mock
diff --git a/tests/test_mime_parsers.py b/tests/test_mime_parsers.py
index d61598d..a8735a5 100644
--- a/tests/test_mime_parsers.py
+++ b/tests/test_mime_parsers.py
@@ -6,7 +6,7 @@ from collections import OrderedDict
import pytest
-from rtv.mime_parsers import parsers, ImgurApiMIMEParser
+from tuir.mime_parsers import parsers, ImgurApiMIMEParser
RegexpType = type(re.compile(''))
diff --git a/tests/test_oauth.py b/tests/test_oauth.py
index ce6e73c..5f76512 100644
--- a/tests/test_oauth.py
+++ b/tests/test_oauth.py
@@ -3,9 +3,9 @@ from __future__ import unicode_literals
import requests
-from rtv.oauth import OAuthHelper, OAuthHandler
-from rtv.exceptions import InvalidRefreshToken
-from rtv.packages.praw.errors import OAuthException
+from tuir.oauth import OAuthHelper, OAuthHandler
+from tuir.exceptions import InvalidRefreshToken
+from tuir.packages.praw.errors import OAuthException
try:
@@ -128,8 +128,8 @@ def test_oauth_authorize(oauth, reddit, stdscr, refresh_token):
# Because we use `from .helpers import open_browser` we have to patch the
# function in the destination oauth module and not the helpers module
with mock.patch('uuid.UUID.hex', new_callable=mock.PropertyMock) as uuid, \
- mock.patch('rtv.terminal.Terminal.open_browser') as open_browser, \
- mock.patch('rtv.oauth.OAuthHTTPServer') as http_server, \
+ mock.patch('tuir.terminal.Terminal.open_browser') as open_browser, \
+ mock.patch('tuir.oauth.OAuthHTTPServer') as http_server, \
mock.patch.object(oauth.reddit, 'user'), \
mock.patch('time.sleep'):
diff --git a/tests/test_objects.py b/tests/test_objects.py
index dde5c3f..0c8dd4c 100644
--- a/tests/test_objects.py
+++ b/tests/test_objects.py
@@ -11,8 +11,8 @@ import pytest
import requests
from six.moves import reload_module
-from rtv import exceptions
-from rtv.objects import Controller, Navigator, Command, KeyMap, \
+from tuir import exceptions
+from tuir.objects import Controller, Navigator, Command, KeyMap, \
curses_session, patch_webbrowser
try:
diff --git a/tests/test_packages.py b/tests/test_packages.py
index 5e069ee..c46f88a 100644
--- a/tests/test_packages.py
+++ b/tests/test_packages.py
@@ -1,4 +1,4 @@
-from rtv import packages
+from tuir import packages
def test_praw3_package():
diff --git a/tests/test_page.py b/tests/test_page.py
index 09a5212..33d8a4e 100644
--- a/tests/test_page.py
+++ b/tests/test_page.py
@@ -5,7 +5,7 @@ import curses
import pytest
-from rtv.page import Page, PageController, logged_in
+from tuir.page import Page, PageController, logged_in
try:
from unittest import mock
diff --git a/tests/test_submission.py b/tests/test_submission.py
index b50a6d4..b247384 100644
--- a/tests/test_submission.py
+++ b/tests/test_submission.py
@@ -6,8 +6,8 @@ from collections import OrderedDict
import pytest
-from rtv.submission_page import SubmissionPage
-from rtv.docs import FOOTER_SUBMISSION
+from tuir.submission_page import SubmissionPage
+from tuir.docs import FOOTER_SUBMISSION
try:
from unittest import mock
@@ -262,9 +262,9 @@ def test_submission_vote(submission_page, refresh_token):
submission_page.oauth.authorize()
# Test voting on the submission
- with mock.patch('rtv.packages.praw.objects.Submission.upvote') as upvote, \
- mock.patch('rtv.packages.praw.objects.Submission.downvote') as downvote, \
- mock.patch('rtv.packages.praw.objects.Submission.clear_vote') as clear_vote:
+ with mock.patch('tuir.packages.praw.objects.Submission.upvote') as upvote, \
+ mock.patch('tuir.packages.praw.objects.Submission.downvote') as downvote, \
+ mock.patch('tuir.packages.praw.objects.Submission.clear_vote') as clear_vote:
data = submission_page.get_selected_item()
data['object'].archived = False
@@ -338,8 +338,8 @@ def test_submission_save(submission_page, refresh_token):
submission_page.oauth.authorize()
# Test save on the submission
- with mock.patch('rtv.packages.praw.objects.Submission.save') as save, \
- mock.patch('rtv.packages.praw.objects.Submission.unsave') as unsave:
+ with mock.patch('tuir.packages.praw.objects.Submission.save') as save, \
+ mock.patch('tuir.packages.praw.objects.Submission.unsave') as unsave:
data = submission_page.content.get(submission_page.nav.absolute_index)
@@ -370,8 +370,8 @@ def test_submission_comment_save(submission_page, terminal, refresh_token):
submission_page.controller.trigger('j')
# Test save on the comment submission
- with mock.patch('rtv.packages.praw.objects.Comment.save') as save, \
- mock.patch('rtv.packages.praw.objects.Comment.unsave') as unsave:
+ with mock.patch('tuir.packages.praw.objects.Comment.save') as save, \
+ mock.patch('tuir.packages.praw.objects.Comment.unsave') as unsave:
data = submission_page.content.get(submission_page.nav.absolute_index)
@@ -398,7 +398,7 @@ def test_submission_comment(submission_page, terminal, refresh_token):
submission_page.oauth.authorize()
# Leave a comment
- with mock.patch('rtv.packages.praw.objects.Submission.add_comment') as add_comment, \
+ with mock.patch('tuir.packages.praw.objects.Submission.add_comment') as add_comment, \
mock.patch.object(terminal, 'open_editor') as open_editor, \
mock.patch('time.sleep'):
open_editor.return_value.__enter__.return_value = 'comment text'
@@ -430,7 +430,7 @@ def test_submission_delete(submission_page, terminal, refresh_token):
# Spoof the author and try to delete again
data = submission_page.content.get(submission_page.nav.absolute_index)
data['author'] = submission_page.reddit.user.name
- with mock.patch('rtv.packages.praw.objects.Comment.delete') as delete, \
+ with mock.patch('tuir.packages.praw.objects.Comment.delete') as delete, \
mock.patch.object(terminal.stdscr, 'getch') as getch, \
mock.patch('time.sleep'):
getch.return_value = ord('y')
@@ -454,7 +454,7 @@ def test_submission_edit(submission_page, terminal, refresh_token):
# Spoof the submission and try to edit again
data = submission_page.content.get(submission_page.nav.absolute_index)
data['author'] = submission_page.reddit.user.name
- with mock.patch('rtv.packages.praw.objects.Submission.edit') as edit, \
+ with mock.patch('tuir.packages.praw.objects.Submission.edit') as edit, \
mock.patch.object(terminal, 'open_editor') as open_editor, \
mock.patch('time.sleep'):
open_editor.return_value.__enter__.return_value = 'submission text'
@@ -470,7 +470,7 @@ def test_submission_edit(submission_page, terminal, refresh_token):
# Spoof the author and edit the comment
data = submission_page.content.get(submission_page.nav.absolute_index)
data['author'] = submission_page.reddit.user.name
- with mock.patch('rtv.packages.praw.objects.Comment.edit') as edit, \
+ with mock.patch('tuir.packages.praw.objects.Comment.edit') as edit, \
mock.patch.object(terminal, 'open_editor') as open_editor, \
mock.patch('time.sleep'):
open_editor.return_value.__enter__.return_value = 'comment text'
diff --git a/tests/test_subreddit.py b/tests/test_subreddit.py
index f6d5739..b333c2b 100644
--- a/tests/test_subreddit.py
+++ b/tests/test_subreddit.py
@@ -7,9 +7,9 @@ from collections import OrderedDict
import six
import pytest
-from rtv import __version__
-from rtv.subreddit_page import SubredditPage
-from rtv.packages.praw.errors import NotFound, HTTPException
+from tuir import __version__
+from tuir.subreddit_page import SubredditPage
+from tuir.packages.praw.errors import NotFound, HTTPException
from requests.exceptions import ReadTimeout
try:
@@ -103,13 +103,13 @@ def test_subreddit_title(subreddit_page, terminal, capsys):
subreddit_page.draw()
out, _ = capsys.readouterr()
assert isinstance(out, six.text_type)
- assert out == '\x1b]2;hello ? - rtv {}\x07'.format(__version__)
+ assert out == '\x1b]2;hello ? - tuir {}\x07'.format(__version__)
terminal.config['ascii'] = False
subreddit_page.draw()
out, _ = capsys.readouterr()
assert isinstance(out, six.text_type)
- assert out == '\x1b]2;hello ❤ - rtv {}\x07'.format(__version__)
+ assert out == '\x1b]2;hello ❤ - tuir {}\x07'.format(__version__)
with mock.patch.dict('os.environ', {'DISPLAY': ''}):
subreddit_page.draw()
@@ -313,7 +313,7 @@ def test_subreddit_open(subreddit_page, terminal, config):
assert terminal.open_link.called
config.history.add.assert_called_with(data['url_full'])
- # Open the selected link within rtv
+ # Open the selected link within tuir
data = subreddit_page.content.get(subreddit_page.nav.absolute_index)
with mock.patch.object(subreddit_page, 'open_submission'), \
mock.patch.object(config.history, 'add'):
@@ -404,7 +404,7 @@ def test_subreddit_open_subscriptions(subreddit_page, refresh_token):
assert subreddit_page.selected_page
assert subreddit_page.active
- with mock.patch('rtv.page.Page.loop') as loop:
+ with mock.patch('tuir.page.Page.loop') as loop:
subreddit_page.handle_selected_page()
assert loop.called
@@ -435,7 +435,7 @@ def test_subreddit_open_multireddits(subreddit_page, refresh_token):
assert subreddit_page.selected_page
assert subreddit_page.active
- with mock.patch('rtv.page.Page.loop') as loop:
+ with mock.patch('tuir.page.Page.loop') as loop:
subreddit_page.handle_selected_page()
assert loop.called
diff --git a/tests/test_subscription.py b/tests/test_subscription.py
index dba6afd..9c57043 100644
--- a/tests/test_subscription.py
+++ b/tests/test_subscription.py
@@ -5,7 +5,7 @@ import curses
import pytest
-from rtv.subscription_page import SubscriptionPage
+from tuir.subscription_page import SubscriptionPage
try:
from unittest import mock
@@ -56,7 +56,7 @@ def test_subscription_page_construct(reddit, terminal, config, oauth,
def test_subscription_refresh(subscription_page):
- with mock.patch('rtv.terminal.Terminal.flash') as flash:
+ with mock.patch('tuir.terminal.Terminal.flash') as flash:
# Refresh content - invalid order
subscription_page.refresh_content(order='top')
assert flash.called
diff --git a/tests/test_terminal.py b/tests/test_terminal.py
index d3dda17..68426be 100644
--- a/tests/test_terminal.py
+++ b/tests/test_terminal.py
@@ -10,10 +10,10 @@ from textwrap import dedent
import six
import pytest
-from rtv.theme import Theme
-from rtv.docs import (HELP, REPLY_FILE, COMMENT_EDIT_FILE, TOKEN,
+from tuir.theme import Theme
+from tuir.docs import (HELP, REPLY_FILE, COMMENT_EDIT_FILE, TOKEN,
SUBMISSION_FILE, SUBMISSION_EDIT_FILE, MESSAGE_FILE)
-from rtv.exceptions import TemporaryFileError, BrowserError
+from tuir.exceptions import TemporaryFileError, BrowserError
try:
from unittest import mock
@@ -29,13 +29,13 @@ def test_terminal_properties(terminal, config):
assert isinstance(terminal.gilded, six.text_type)
terminal._display = None
- with mock.patch('rtv.terminal.sys') as sys, \
+ with mock.patch('tuir.terminal.sys') as sys, \
mock.patch.dict('os.environ', {'DISPLAY': ''}):
sys.platform = 'linux'
assert terminal.display is False
terminal._display = None
- with mock.patch('rtv.terminal.sys') as sys, \
+ with mock.patch('tuir.terminal.sys') as sys, \
mock.patch('os.environ', {'DISPLAY': ''}), \
mock.patch('webbrowser._tryorder', new=[]):
sys.platform = 'darwin'
@@ -367,7 +367,7 @@ def test_terminal_open_link_mailcap(terminal):
mock_mime_parser = MockMimeParser()
with mock.patch.object(terminal, 'open_browser'), \
- mock.patch('rtv.terminal.mime_parsers') as mime_parsers:
+ mock.patch('tuir.terminal.mime_parsers') as mime_parsers:
mime_parsers.parsers = [mock_mime_parser]
# Pass through to open_browser if media is disabled
@@ -490,7 +490,7 @@ def test_terminal_open_browser_display(terminal):
def test_terminal_open_browser_display_no_response(terminal):
terminal._display = True
- with mock.patch('rtv.terminal.Process', autospec=True) as Process:
+ with mock.patch('tuir.terminal.Process', autospec=True) as Process:
Process.return_value.is_alive.return_value = 1
terminal.open_browser('http://www.test.com')
assert isinstance(terminal.loader.exception, BrowserError)
@@ -738,7 +738,7 @@ def test_terminal_get_link_page_text(terminal):
{'href': 'https://www.reddit.com', 'text': 'Reddit Homepage'},
{'href': 'https://www.duckduckgo.com', 'text': 'Search Engine'},
{
- 'href': 'https://gitlab.com/ajak/rtv',
+ 'href': 'https://gitlab.com/ajak/tuir',
'text': 'This project\'s homepage'
}
]
@@ -747,7 +747,7 @@ def test_terminal_get_link_page_text(terminal):
assert text == dedent("""\
[0] [Reddit Homepage](https://www.reddit.com)
[1] [Search Engine](https://www.duckduckgo.com)
- [2] [This project's home…](https://gitlab.com/ajak/rtv)
+ [2] [This project's home…](https://gitlab.com/ajak/tuir)
""")
diff --git a/tests/test_theme.py b/tests/test_theme.py
index f14a27a..9d0102f 100644
--- a/tests/test_theme.py
+++ b/tests/test_theme.py
@@ -7,9 +7,9 @@ from tempfile import mkdtemp, NamedTemporaryFile
import pytest
-from rtv.theme import Theme
-from rtv.config import DEFAULT_THEMES
-from rtv.exceptions import ConfigError
+from tuir.theme import Theme
+from tuir.config import DEFAULT_THEMES
+from tuir.exceptions import ConfigError
try:
from unittest import mock
diff --git a/rtv.1 b/tuir.1
similarity index 80%
rename from rtv.1
rename to tuir.1
index 7f94db4..de0e5d2 100644
--- a/rtv.1
+++ b/tuir.1
@@ -1,10 +1,10 @@
-.TH "RTV" "1" "June 08, 2019" "Version 1.27.0" "Usage and Commands"
+.TH "TUIR" "1" "June 10, 2019" "Version 1.27.0" "Usage and Commands"
.SH NAME
-RTV - Reddit Terminal Viewer
+TUIR - Terminal UI for Reddit
.SH SYNOPSIS
-rtv [URL] [\-s SUBREDDIT]
+tuir [URL] [\-s SUBREDDIT]
.SH DESCRIPTION
-RTV (Reddit Terminal Viewer) is a terminal interface to view and interact with reddit.
+TUIR (Terminal UI for Reddit) is a terminal interface to view and interact with reddit.
.SH OPTIONS
.TP
\fBURL\fR
@@ -56,7 +56,7 @@ Remove any saved user data before launching
.TP
\fB\-\-copy\-config\fR
-Copy the default configuration to {HOME}/.config/rtv/rtv.cfg
+Copy the default configuration to {HOME}/.config/tuir/tuir.cfg
.TP
\fB\-\-copy\-mailcap\fR
@@ -89,32 +89,32 @@ Press \fBright\fR to view the selected submission and \fBleft\fR to return.
Press \fB?\fR to open the help screen.
.SH FILES
.TP
-.BR $XDG_CONFIG_HOME/rtv/rtv.cfg
+.BR $XDG_CONFIG_HOME/tuir/tuir.cfg
The configuration file can be used to customize default program settings.
.TP
-.BR $XDG_DATA_HOME/rtv/refresh-token
+.BR $XDG_DATA_HOME/tuir/refresh-token
After you login to reddit, your most recent OAuth refresh token will be stored
for future sessions.
.TP
-.BR $XDG_DATA_HOME/rtv/history.log
+.BR $XDG_DATA_HOME/tuir/history.log
This file stores URLs that have been recently opened in order to
visually highlight them as "seen".
.SH ENVIRONMENT
.TP
-.BR RTV_EDITOR
+.BR TUIR_EDITOR
Text editor to use when editing comments and submissions. Will fallback to
\fI$EDITOR\fR.
.TP
-.BR RTV_URLVIEWER
+.BR TUIR_URLVIEWER
Url viewer to use to extract links from comments. Requires a compatible
program to be installed.
.TP
-.BR RTV_BROWSER
+.BR TUIR_BROWSER
Web browser to use when opening links. Will fallback to \fI$BROWSER\fR.
.SH AUTHOR
Michael Lazar (2017).
-John Helmert (2019).
+John Helmert III (2019).
.SH BUGS
-Report bugs to \fIhttps://gitlab.com/ajak/rtv/issues\fR
+Report bugs to \fIhttps://gitlab.com/ajak/tuir/issues\fR
.SH LICENSE
The MIT License (MIT)
diff --git a/tuir/__init__.py b/tuir/__init__.py
new file mode 100644
index 0000000..49f6bdd
--- /dev/null
+++ b/tuir/__init__.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+r"""
+
+ ______ _ __ __ ______ ____
+ /_ __/__ _________ ___ (_)___ ____ _/ / / / / / _/ / __/___ _____
+ / / / _ \/ ___/ __ `__ \/ / __ \/ __ `/ / / / / // / / /_/ __ \/ ___/
+ / / / __/ / / / / / / / / / / / /_/ / / / /_/ // / / __/ /_/ / /
+/_/ \___/_/ /_/ /_/ /_/_/_/ /_/\__,_/_/ \____/___/ /_/ \____/_/
+
+ ____ __ ___ __
+ / __ \___ ____/ /___/ (_) /_
+ / /_/ / _ \/ __ / __ / / __/
+ / _, _/ __/ /_/ / /_/ / / /_
+/_/ |_|\___/\__,_/\__,_/_/\__/
+
+
+(TUIR)
+"""
+
+from __future__ import unicode_literals
+
+from .__version__ import __version__
+
+__title__ = 'Terminal UI for Reddit'
+__author__ = 'Michael Lazar'
+__license__ = 'The MIT License (MIT)'
+__copyright__ = '(c) 2016 Michael Lazar, portions (c) 2019 John Helmert III'
diff --git a/rtv/__main__.py b/tuir/__main__.py
similarity index 92%
rename from rtv/__main__.py
rename to tuir/__main__.py
index a0b050a..5ea9944 100755
--- a/rtv/__main__.py
+++ b/tuir/__main__.py
@@ -13,7 +13,7 @@ import warnings
import six
import requests
-# Need to check for curses compatibility before performing the rtv imports
+# Need to check for curses compatibility before performing the tuir imports
try:
import curses
except ImportError:
@@ -28,9 +28,9 @@ except ImportError:
# references, it needs to be done before the webbrowser module is imported
# for the first time.
webbrowser_import_warning = ('webbrowser' in sys.modules)
-RTV_BROWSER, BROWSER = os.environ.get('RTV_BROWSER'), os.environ.get('BROWSER')
-if RTV_BROWSER:
- os.environ['BROWSER'] = RTV_BROWSER
+TUIR_BROWSER, BROWSER = os.environ.get('TUIR_BROWSER'), os.environ.get('BROWSER')
+if TUIR_BROWSER:
+ os.environ['BROWSER'] = TUIR_BROWSER
from . import docs
from . import packages
@@ -50,8 +50,8 @@ _logger = logging.getLogger(__name__)
# Pycharm debugging note:
-# You can use pycharm to debug a curses application by launching rtv in a
-# console window (python -m rtv) and using pycharm to attach to the remote
+# You can use pycharm to debug a curses application by launching tuir in a
+# console window (python -m tuir) and using pycharm to attach to the remote
# process. On Ubuntu, you may need to allow ptrace permissions by setting
# ptrace_scope to 0 in /etc/sysctl.d/10-ptrace.conf.
# http://blog.mellenthin.de/archives/2010/10/18/gdb-attach-fails
@@ -68,7 +68,7 @@ def main():
# Set the terminal title
if os.getenv('DISPLAY'):
- title = 'rtv {0}'.format(__version__)
+ title = 'tuir {0}'.format(__version__)
sys.stdout.write('\x1b]2;{0}\x07'.format(title))
sys.stdout.flush()
@@ -150,8 +150,8 @@ def main():
user_agent = docs.AGENT.format(version=__version__)
debug_info = [
- 'rtv version: rtv {}'.format(__version__),
- 'rtv module path: {}'.format(os.path.abspath(__file__)),
+ 'tuir version: tuir {}'.format(__version__),
+ 'tuir module path: {}'.format(os.path.abspath(__file__)),
'python version: {}'.format(sys.version.replace('\n', ' ')),
'python executable: {}'.format(sys.executable),
'praw version: {}'.format(praw_info),
@@ -163,10 +163,10 @@ def main():
('EDITOR', os.getenv('EDITOR')),
('LANG', os.getenv('LANG')),
('PAGER', os.getenv('PAGER')),
- ('RTV_BROWSER', RTV_BROWSER),
- ('RTV_EDITOR', os.getenv('RTV_EDITOR')),
- ('RTV_PAGER', os.getenv('RTV_PAGER')),
- ('RTV_URLVIEWER', os.getenv('RTV_URLVIEWER')),
+ ('TUIR_BROWSER', TUIR_BROWSER),
+ ('TUIR_EDITOR', os.getenv('TUIR_EDITOR')),
+ ('TUIR_PAGER', os.getenv('TUIR_PAGER')),
+ ('TUIR_URLVIEWER', os.getenv('TUIR_URLVIEWER')),
('TERM', os.getenv('TERM')),
('VISUAL', os.getenv('VISUAL')),
('XDG_CONFIG_HOME', os.getenv('XDG_CONFIG_HOME')),
@@ -263,8 +263,8 @@ def main():
exit_message = '\n'.join([
debug_text,
traceback.format_exc(),
- 'rtv has crashed. Please report this traceback at:',
- 'https://gitlab.com/ajak/rtv/issues\n'])
+ 'tuir has crashed. Please report this traceback at:',
+ 'https://gitlab.com/ajak/tuir/issues\n'])
sys.stderr.write(exit_message)
return 1 # General error exception code
except KeyboardInterrupt:
diff --git a/rtv/__version__.py b/tuir/__version__.py
similarity index 100%
rename from rtv/__version__.py
rename to tuir/__version__.py
diff --git a/rtv/clipboard.py b/tuir/clipboard.py
similarity index 100%
rename from rtv/clipboard.py
rename to tuir/clipboard.py
diff --git a/rtv/config.py b/tuir/config.py
similarity index 83%
rename from rtv/config.py
rename to tuir/config.py
index fb2def4..1f8ddbc 100644
--- a/rtv/config.py
+++ b/tuir/config.py
@@ -16,21 +16,21 @@ from .objects import KeyMap
PACKAGE = os.path.dirname(__file__)
HOME = os.path.expanduser('~')
TEMPLATES = os.path.join(PACKAGE, 'templates')
-DEFAULT_CONFIG = os.path.join(TEMPLATES, 'rtv.cfg')
+DEFAULT_CONFIG = os.path.join(TEMPLATES, 'tuir.cfg')
DEFAULT_MAILCAP = os.path.join(TEMPLATES, 'mailcap')
DEFAULT_THEMES = os.path.join(PACKAGE, 'themes')
XDG_CONFIG_HOME = os.getenv('XDG_CONFIG_HOME', os.path.join(HOME, '.config'))
XDG_DATA_HOME = os.getenv('XDG_DATA_HOME', os.path.join(HOME, '.local', 'share'))
-CONFIG = os.path.join(XDG_CONFIG_HOME, 'rtv', 'rtv.cfg')
+CONFIG = os.path.join(XDG_CONFIG_HOME, 'tuir', 'tuir.cfg')
MAILCAP = os.path.join(HOME, '.mailcap')
-TOKEN = os.path.join(XDG_DATA_HOME, 'rtv', 'refresh-token')
-HISTORY = os.path.join(XDG_DATA_HOME, 'rtv', 'history.log')
-THEMES = os.path.join(XDG_CONFIG_HOME, 'rtv', 'themes')
+TOKEN = os.path.join(XDG_DATA_HOME, 'tuir', 'refresh-token')
+HISTORY = os.path.join(XDG_DATA_HOME, 'tuir', 'history.log')
+THEMES = os.path.join(XDG_CONFIG_HOME, 'tuir', 'themes')
def build_parser():
parser = argparse.ArgumentParser(
- prog='rtv', description=docs.SUMMARY,
+ prog='tuir', description=docs.SUMMARY,
epilog=docs.CONTROLS,
usage=docs.USAGE,
formatter_class=argparse.RawDescriptionHelpFormatter)
@@ -72,7 +72,7 @@ def build_parser():
help='Remove any saved user data before launching')
parser.add_argument(
'--copy-config', dest='copy_config', action='store_const', const=True,
- help='Copy the default configuration to {HOME}/.config/rtv/rtv.cfg')
+ help='Copy the default configuration to {HOME}/.config/tuir/tuir.cfg')
parser.add_argument(
'--copy-mailcap', dest='copy_mailcap', action='store_const', const=True,
help='Copy an example mailcap configuration to {HOME}/.mailcap')
@@ -80,7 +80,7 @@ def build_parser():
'--enable-media', dest='enable_media', action='store_const', const=True,
help='Open external links using programs defined in the mailcap config')
parser.add_argument(
- '-V', '--version', action='version', version='rtv ' + __version__)
+ '-V', '--version', action='version', version='tuir ' + __version__)
parser.add_argument(
'--no-flash', dest='flash', action='store_const', const=False,
help='Disable screen flashing')
@@ -99,7 +99,7 @@ def copy_default_mailcap(filename=MAILCAP):
def copy_default_config(filename=CONFIG):
"""
- Copy the default rtv user configuration to the specified file.
+ Copy the default tuir user configuration to the specified file.
"""
return _copy_settings_file(DEFAULT_CONFIG, filename, 'config')
@@ -241,7 +241,7 @@ class Config(object):
@classmethod
def get_file(cls, filename=None):
"""
- Load settings from an rtv configuration file.
+ Load settings from an tuir configuration file.
"""
if filename is None:
@@ -252,36 +252,36 @@ class Config(object):
with codecs.open(filename, encoding='utf-8') as fp:
config.read_file(fp)
- return cls._parse_rtv_file(config)
+ return cls._parse_tuir_file(config)
@staticmethod
- def _parse_rtv_file(config):
+ def _parse_tuir_file(config):
- rtv = {}
- if config.has_section('rtv'):
- rtv = dict(config.items('rtv'))
+ tuir = {}
+ if config.has_section('tuir'):
+ tuir = dict(config.items('tuir'))
# convert non-string params to their typed representation
params = {
- 'ascii': partial(config.getboolean, 'rtv'),
- 'monochrome': partial(config.getboolean, 'rtv'),
- 'persistent': partial(config.getboolean, 'rtv'),
- 'autologin': partial(config.getboolean, 'rtv'),
- 'clear_auth': partial(config.getboolean, 'rtv'),
- 'enable_media': partial(config.getboolean, 'rtv'),
- 'history_size': partial(config.getint, 'rtv'),
- 'oauth_redirect_port': partial(config.getint, 'rtv'),
- 'oauth_scope': lambda x: rtv[x].split(','),
- 'max_comment_cols': partial(config.getint, 'rtv'),
- 'max_pager_cols': partial(config.getint, 'rtv'),
- 'hide_username': partial(config.getboolean, 'rtv'),
- 'flash': partial(config.getboolean, 'rtv'),
- 'force_new_browser_window': partial(config.getboolean, 'rtv')
+ 'ascii': partial(config.getboolean, 'tuir'),
+ 'monochrome': partial(config.getboolean, 'tuir'),
+ 'persistent': partial(config.getboolean, 'tuir'),
+ 'autologin': partial(config.getboolean, 'tuir'),
+ 'clear_auth': partial(config.getboolean, 'tuir'),
+ 'enable_media': partial(config.getboolean, 'tuir'),
+ 'history_size': partial(config.getint, 'tuir'),
+ 'oauth_redirect_port': partial(config.getint, 'tuir'),
+ 'oauth_scope': lambda x: tuir[x].split(','),
+ 'max_comment_cols': partial(config.getint, 'tuir'),
+ 'max_pager_cols': partial(config.getint, 'tuir'),
+ 'hide_username': partial(config.getboolean, 'tuir'),
+ 'flash': partial(config.getboolean, 'tuir'),
+ 'force_new_browser_window': partial(config.getboolean, 'tuir')
}
for key, func in params.items():
- if key in rtv:
- rtv[key] = func(key)
+ if key in tuir:
+ tuir[key] = func(key)
bindings = {}
if config.has_section('bindings'):
@@ -290,7 +290,7 @@ class Config(object):
for name, keys in bindings.items():
bindings[name] = [key.strip() for key in keys.split(',')]
- return rtv, bindings
+ return tuir, bindings
@staticmethod
def _ensure_filepath(filename):
diff --git a/rtv/content.py b/tuir/content.py
similarity index 99%
rename from rtv/content.py
rename to tuir/content.py
index e9c6564..205e517 100644
--- a/rtv/content.py
+++ b/tuir/content.py
@@ -1041,7 +1041,7 @@ class RequestHeaderRateLimiter(DefaultHandler):
# In PRAW's convention, these variables were bound to the
# class so the cache could be shared among all of the ``reddit``
- # instances. In RTV's use-case there is only ever a single reddit
+ # instances. In TUIR's use-case there is only ever a single reddit
# instance so it made sense to clean up the globals and transfer them
# to method variables
self.cache = {}
@@ -1150,8 +1150,8 @@ class RequestHeaderRateLimiter(DefaultHandler):
_cache_key = (url, (items[0], items[1], items[3], items[4]))
if kwargs['request'].method != 'GET':
- # I added this check for RTV, I have no idea why PRAW would ever
- # want to cache POST/PUT/DELETE requests
+ # I [michael-lazar] added this check for RTV, I have no idea
+ # why PRAW would ever want to cache POST/PUT/DELETE requests
_cache_ignore = True
if _cache_ignore:
diff --git a/rtv/docs.py b/tuir/docs.py
similarity index 93%
rename from rtv/docs.py
rename to tuir/docs.py
index bdbc51b..573b8da 100644
--- a/rtv/docs.py
+++ b/tuir/docs.py
@@ -2,19 +2,19 @@
from __future__ import unicode_literals
AGENT = """\
-desktop:https://github.com/ajak/rtv:{version}\
-(by /u/civilization_phaze_3)\
+desktop:https://gitlab.com/ajak/tuir:{version}\
+(by /u/ajak__)\
"""
SUMMARY = """
-RTV (Reddit Terminal Viewer) is a terminal interface to view and interact with reddit.
+TUIR (Terminal UI for Reddit) is a terminal interface to view and interact with reddit.
"""
USAGE = """\
-rtv [URL] [-s SUBREDDIT]
+tuir [URL] [-s SUBREDDIT]
- $ rtv https://www.reddit.com/r/programming/comments/7h9l31
- $ rtv -s linux
+ $ tuir https://www.reddit.com/r/programming/comments/7h9l31
+ $ tuir -s linux
"""
CONTROLS = """
@@ -24,9 +24,9 @@ Press `?` to open the help screen.
HELP = """\
====================================
-Reddit Terminal Viewer
+Terminal UI for Reddit
-https://github.com/ajak/rtv
+https://github.com/ajak/tuir
====================================
[Basic Commands]
@@ -196,7 +196,7 @@ Enter your message below this instruction block:
OAUTH_ACCESS_DENIED = """\
Access Denied
- Reddit Terminal Viewer was
+
Terminal UI for Reddit was
denied access and will continue to operate in unauthenticated mode,
you can close this window.
"""
@@ -214,7 +214,7 @@ OAUTH_INVALID = """\
OAUTH_SUCCESS = """\
Access Granted
- Reddit Terminal Viewer
+
Terminal UI for Reddit
will now log in, you can close this window.
"""
diff --git a/rtv/exceptions.py b/tuir/exceptions.py
similarity index 68%
rename from rtv/exceptions.py
rename to tuir/exceptions.py
index a082f85..1c0e1cf 100644
--- a/rtv/exceptions.py
+++ b/tuir/exceptions.py
@@ -10,23 +10,23 @@ class ConfigError(Exception):
"There was a problem with the configuration"
-class RTVError(Exception):
- "Base RTV error class"
+class TUIRError(Exception):
+ "Base TUIR error class"
-class AccountError(RTVError):
+class AccountError(TUIRError):
"Could not access user account"
-class SubmissionError(RTVError):
+class SubmissionError(TUIRError):
"Submission could not be loaded"
-class SubredditError(RTVError):
+class SubredditError(TUIRError):
"Subreddit could not be loaded"
-class NoSubmissionsError(RTVError):
+class NoSubmissionsError(TUIRError):
"No submissions for the given page"
def __init__(self, name):
@@ -35,29 +35,29 @@ class NoSubmissionsError(RTVError):
super(NoSubmissionsError, self).__init__(message)
-class SubscriptionError(RTVError):
+class SubscriptionError(TUIRError):
"Content could not be fetched"
-class InboxError(RTVError):
+class InboxError(TUIRError):
"Content could not be fetched"
-class ProgramError(RTVError):
+class ProgramError(TUIRError):
"Problem executing an external program"
-class BrowserError(RTVError):
+class BrowserError(TUIRError):
"Could not open a web browser tab"
-class TemporaryFileError(RTVError):
+class TemporaryFileError(TUIRError):
"Indicates that an error has occurred and the file should not be deleted"
-class MailcapEntryNotFound(RTVError):
+class MailcapEntryNotFound(TUIRError):
"A valid mailcap entry could not be coerced from the given url"
-class InvalidRefreshToken(RTVError):
+class InvalidRefreshToken(TUIRError):
"The refresh token is corrupt and cannot be used to login"
diff --git a/rtv/inbox_page.py b/tuir/inbox_page.py
similarity index 100%
rename from rtv/inbox_page.py
rename to tuir/inbox_page.py
diff --git a/rtv/mime_parsers.py b/tuir/mime_parsers.py
similarity index 98%
rename from rtv/mime_parsers.py
rename to tuir/mime_parsers.py
index 9d7eae8..c9428b2 100644
--- a/rtv/mime_parsers.py
+++ b/tuir/mime_parsers.py
@@ -202,9 +202,9 @@ class ImgurApiMIMEParser(BaseMIMEParser):
page has an associated hash and can either contain an album, a gallery,
or single image.
- The default client token for RTV is shared among users and allows a maximum
+ The default client token for TUIR is shared among users and allows a maximum
global number of requests per day of 12,500. If we find that this limit is
- not sufficient for all of rtv's traffic, this method will be revisited.
+ not sufficient for all of tuir's traffic, this method will be revisited.
Reference:
https://apidocs.imgur.com
diff --git a/rtv/oauth.py b/tuir/oauth.py
similarity index 99%
rename from rtv/oauth.py
rename to tuir/oauth.py
index efa04a2..304fca2 100644
--- a/rtv/oauth.py
+++ b/tuir/oauth.py
@@ -167,7 +167,7 @@ class OAuthHelper(object):
else:
if not autologin:
# Only show the welcome message if explicitly logging
- # in, not when RTV first launches.
+ # in, not when TUIR first launches.
message = 'Welcome {}!'.format(self.reddit.user.name)
self.term.show_notification(message)
diff --git a/rtv/objects.py b/tuir/objects.py
similarity index 99%
rename from rtv/objects.py
rename to tuir/objects.py
index 8c568a8..5259dbe 100644
--- a/rtv/objects.py
+++ b/tuir/objects.py
@@ -165,7 +165,7 @@ class LoadScreen(object):
"""
EXCEPTION_MESSAGES = [
- (exceptions.RTVError, '{0}'),
+ (exceptions.TUIRError, '{0}'),
(praw.errors.OAuthException, 'OAuth Error'),
(praw.errors.OAuthScopeRequired, 'Not logged in'),
(praw.errors.LoginRequired, 'Not logged in'),
diff --git a/rtv/packages/__init__.py b/tuir/packages/__init__.py
similarity index 89%
rename from rtv/packages/__init__.py
rename to tuir/packages/__init__.py
index d1061f4..4551943 100644
--- a/rtv/packages/__init__.py
+++ b/tuir/packages/__init__.py
@@ -21,6 +21,6 @@ except ImportError:
if not praw.__version__.startswith('3.'):
raise RuntimeError('Invalid PRAW version ({0}) detected, '
- 'rtv requires PRAW version 3'.format(praw.__version__))
+ 'tuir requires PRAW version 3'.format(praw.__version__))
sys.modules['%s.praw' % __name__] = praw
__praw_bundled__ = False
diff --git a/rtv/packages/praw/__init__.py b/tuir/packages/praw/__init__.py
similarity index 100%
rename from rtv/packages/praw/__init__.py
rename to tuir/packages/praw/__init__.py
diff --git a/rtv/packages/praw/decorator_helpers.py b/tuir/packages/praw/decorator_helpers.py
similarity index 100%
rename from rtv/packages/praw/decorator_helpers.py
rename to tuir/packages/praw/decorator_helpers.py
diff --git a/rtv/packages/praw/decorators.py b/tuir/packages/praw/decorators.py
similarity index 100%
rename from rtv/packages/praw/decorators.py
rename to tuir/packages/praw/decorators.py
diff --git a/rtv/packages/praw/errors.py b/tuir/packages/praw/errors.py
similarity index 100%
rename from rtv/packages/praw/errors.py
rename to tuir/packages/praw/errors.py
diff --git a/rtv/packages/praw/handlers.py b/tuir/packages/praw/handlers.py
similarity index 100%
rename from rtv/packages/praw/handlers.py
rename to tuir/packages/praw/handlers.py
diff --git a/rtv/packages/praw/helpers.py b/tuir/packages/praw/helpers.py
similarity index 100%
rename from rtv/packages/praw/helpers.py
rename to tuir/packages/praw/helpers.py
diff --git a/rtv/packages/praw/internal.py b/tuir/packages/praw/internal.py
similarity index 100%
rename from rtv/packages/praw/internal.py
rename to tuir/packages/praw/internal.py
diff --git a/rtv/packages/praw/multiprocess.py b/tuir/packages/praw/multiprocess.py
similarity index 100%
rename from rtv/packages/praw/multiprocess.py
rename to tuir/packages/praw/multiprocess.py
diff --git a/rtv/packages/praw/objects.py b/tuir/packages/praw/objects.py
similarity index 100%
rename from rtv/packages/praw/objects.py
rename to tuir/packages/praw/objects.py
diff --git a/rtv/packages/praw/praw.ini b/tuir/packages/praw/praw.ini
similarity index 100%
rename from rtv/packages/praw/praw.ini
rename to tuir/packages/praw/praw.ini
diff --git a/rtv/packages/praw/settings.py b/tuir/packages/praw/settings.py
similarity index 100%
rename from rtv/packages/praw/settings.py
rename to tuir/packages/praw/settings.py
diff --git a/rtv/page.py b/tuir/page.py
similarity index 99%
rename from rtv/page.py
rename to tuir/page.py
index cfe4b28..ae518a3 100644
--- a/rtv/page.py
+++ b/tuir/page.py
@@ -237,7 +237,7 @@ class Page(object):
Move the cursor to the last item on the page.
"""
- # If the page is empty, don't try to go to the bottom, rtv will
+ # If the page is empty, don't try to go to the bottom, tuir will
# crash when rendering
if self.content.range[1] < 0:
return
@@ -725,7 +725,7 @@ class Page(object):
# Setting the terminal title will break emacs or systems without
# X window.
if os.getenv('DISPLAY') and not os.getenv('INSIDE_EMACS'):
- title += ' - rtv {0}'.format(__version__)
+ title += ' - tuir {0}'.format(__version__)
title = self.term.clean(title)
if six.PY3:
# In py3 you can't write bytes to stdout
diff --git a/rtv/submission_page.py b/tuir/submission_page.py
similarity index 100%
rename from rtv/submission_page.py
rename to tuir/submission_page.py
diff --git a/rtv/subreddit_page.py b/tuir/subreddit_page.py
similarity index 100%
rename from rtv/subreddit_page.py
rename to tuir/subreddit_page.py
diff --git a/rtv/subscription_page.py b/tuir/subscription_page.py
similarity index 100%
rename from rtv/subscription_page.py
rename to tuir/subscription_page.py
diff --git a/rtv/templates/index.html b/tuir/templates/index.html
similarity index 89%
rename from rtv/templates/index.html
rename to tuir/templates/index.html
index 4a3e26a..ba2e205 100644
--- a/rtv/templates/index.html
+++ b/tuir/templates/index.html
@@ -1,7 +1,7 @@
- RTV OAuth2 Helper
+ TUIR OAuth2 Helper