Skip to content

Commit

Permalink
updated readme file to rst format
Browse files Browse the repository at this point in the history
  • Loading branch information
bprinty committed Dec 10, 2016
1 parent d317f91 commit 130aee0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 48 deletions.
99 changes: 52 additions & 47 deletions README.md → README.rst
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
=========
animation
===============================
=========

Tools for terminal-based wait animations


Installation
------------
============

```bash
git clone http://github.com/bprinty/animation.git
cd animation
python setup.py install
```
.. code-block:: bash
git clone http://github.com/bprinty/animation.git
cd animation
python setup.py install
Documentation
-------------
=============

Documentation for the package can be found at [Read The Docs](http://animation.readthedocs.org/).
Documentation for the package can be found at `Read The Docs <http://animation.readthedocs.org/>`_.


Usage
-----
=====

The animation module provides decorators for doing terminal-based wait animations. To add a wait animation to a function that requires some processing time, simply decorate the function with the wait animation you want to use.

Here is an example of how to use it in a project:

```python
import animation
import time
.. code-block:: python
import animation
import time
@animation.simple_wait
def long_running_function():
... 5 seconds later ...
return
@animation.simple_wait
def long_running_function():
... 5 seconds later ...
return
```
This will print an animated waiting message like this (the elipses at the end of the text grow and shrink while the function executes):

```bash
waiting ...
```
.. code-block:: bash
waiting ...
The animation types provided by default are:

Expand All @@ -54,42 +57,44 @@ The animation types provided by default are:

And you can use any of these built-in animations like so:

```python
import animation
import time
.. code-block:: python
import animation
import time
@animation.wait('bar')
def long_running_function():
... 5 seconds later ...
return
@animation.wait('bar')
def long_running_function():
... 5 seconds later ...
return
@animation.wait('spinner')
def long_running_function():
... 5 seconds later ...
return
@animation.wait('spinner')
def long_running_function():
... 5 seconds later ...
return
```
In addition to these default types, the module also supports custom animations. For example, to create an animation with a counter-clockwise spinning wheel:

```python
wheel = ('-', '/', '|', '\\')
@animation.wait(wheel)
def long_running_function():
... 5 seconds later ...
return
```
.. code-block:: python
wheel = ('-', '/', '|', '\\')
@animation.wait(wheel)
def long_running_function():
... 5 seconds later ...
return
If you want to manually start and stop the wait animation, you can use the ```animation.Wait``` class:

```python
wait = animation.Wait()
wait.start()
long_running_function()
wait.stop()
```
.. code-block:: python
wait = animation.Wait()
wait.start()
long_running_function()
wait.stop()
Questions/Feedback
------------------

File an issue in the [GitHub issue tracker](https://github.com/bprinty/animation/issues).
File an issue in the `GitHub issue tracker <https://github.com/bprinty/animation/issues>`_.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# files
# -----
with open('README.md') as readme_file:
with open('README.rst') as readme_file:
readme = readme_file.read()


Expand Down

0 comments on commit 130aee0

Please sign in to comment.