Fix a few bugs due to the introduction of a new window type and the move to support
both pyqt4 and pyqt5