[pyqgis-console] cleaning up code and minor fixes