Throw up a message box on quirk function loading problems

This commit is contained in:
Kiooeht 2011-06-17 09:07:03 -07:00
parent 88a5c958b4
commit 4a24f8fe27

View file

@ -1,4 +1,5 @@
import os, sys, imp, re
from PyQt4 import QtGui, QtCore
class PythonQuirks(object):
def __init__(self):
@ -23,6 +24,10 @@ class PythonQuirks(object):
try: module = imp.load_source(name, filename)
except Exception, e:
print "Error loading %s: %s (in pyquirks.py)" % (name, e)
msgbox = QtGui.QMessageBox()
msgbox.setWindowTitle("Error!")
msgbox.setText("Error loading %s: %s (in pyquirks.py)" % (name, e))
msgbox.exec_()
else:
if hasattr(module, 'setup'):
module.setup()
@ -45,6 +50,10 @@ class PythonQuirks(object):
raise Exception
except:
print "Quirk malformed: %s" % (obj.command)
msgbox = QtGui.QMessageBox()
msgbox.setWindowTitle("Error!")
msgbox.setText("Quirk malformed: %s" % (obj.command))
msgbox.exec_()
else:
self.quirks[obj.command+"("] = obj