Better debug and exception handling

With this commit:
* `--debug` switch now sets Python's `__debug__ = True` (and
  the lack of it enables `-OO` optimizations),
* ˙sys.excepthook˙ (default exception handler) is replaced by a
  function that first prints a normal traceback, and then issues
  Python debugger if `__debug__` is `True`, so the programmer can
  interactively inspect their error,
* a couple of really pointless try-except blocks,

  ```
  try:
      ...
  except Exception, e:
      print e
  ```
  have been unindented, with potential programmers' errors handled
  by said excepthook. Additionally, the unindented blocks hold the
  following changes:
  * stripped of all trailing whitespace,
  * gtk.gdk.threads_enter/leave() calls have been replaced by
    gtk.gdk.lock context guard.
Print locals() before entering pdb
HACK: Fix gettext line so that installer runs
Use __debug__ variable to check if --debug