Correct the shebangs to !/usr/bin/python2.7

Since we require Python 2.7, we need to tell the Python interpreter so.
This will cause any confusion and it will hopefully make packager's life
easier.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Import print_function from __future__

This uses the new py3k print syntax. Since we are already requiring
Python 2.7, it is safe to assume that this will be always available to
us. Also, this makes any future porting to py3k efforts easier.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Import py3k like division from the __future__

And also simplify the syntax to raise to a power instead of just
multiplying. I think this is less error prone.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Use != instead of <>

There were a few places where an old and deprecated syntax was used.
This commit replaces it all.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Remove usage of has_key() method

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Correct a tab into spaces

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Remove trailing whitespace from the .py files

This was done with `sed -i 's/[ \t]*$//' *.py`.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Correct whitespace arround ',', '=' and '=='

This is just to adhere to PEP8, which is a good practice to make code
more readable.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Fix bad indentation

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Add a missing datetime to imports

It is needed for one of the debug statements.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Absolute_import modules and remove unused imports

This was done in order to prepare for py3k port. Python 3 uses only
absolute imports and Python 2.7 supports that as well.

I took an opportunity to remove unused imports in order to clean up the
headers. This will lower the barrier for pottential contributors by
removing the unnecessary confusion when there is a random `import gtk`
in the header.

I renamed the main `rapid.py` file in order to avoid any possible
clashes. However, since it is about 4k SLOC, it should be split in the
future either way.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Refactor the executables.

Now the main executable is a bit cleaner and returns anything returned
by the rapid.rapidbin.start() function. The import is also now
independent of the actual module layout or names.

Also, add a shebang, which optimizes the python pseudo-bytecode a bit.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Some thumbnail generation improvement

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>