Fix compatibility with PyQt5/PyQt4/PySide

I've made some changes that should hopefully make Quamash work with PyQt5, PyQt4 and PySide. We'll know for sure after Travis finishes building.