Fix python2/3 compatibility for self tests

Sort tick intervals from dict keys
Fix encoding of svg output files.

Drops compatibility for very old version of PyQt (<4.06) which can't do custom paint devices