-# actual frontends
-if qtAvailable():
- from PyQt4 import QtGui
- from qt_dialogue import PositionSelection
- app = QtGui.QApplication(sys.argv)
-
- def error(message):
- QtGui.QMessageBox.critical(None, 'Fatal error', message)
-
- def setup(internalResolutions, externalResolutions):
- return PositionSelection(internalResolutions, externalResolutions).run()
+# Qt frontend
+class QtFrontend:
+ def __init__(self):
+ from PyQt4 import QtGui
+ self.app = QtGui.QApplication(sys.argv)
+ print("Qt loaded")
+
+ def error(self, message):
+ from PyQt4 import QtGui
+ QtGui.QMessageBox.critical(None, 'Fatal error', message)
+
+ def setup(self, situation):
+ from qt_dialogue import PositionSelection
+ return PositionSelection(situation).run()
+
+ @staticmethod
+ def isAvailable():
+ try:
+ import PyQt4
+ return True
+ except ImportError:
+ return False