Add parameters to terminate() that specify an (optional) error message to display on termination.
This commit is contained in:
parent
0483beb3b8
commit
0ee7dfd435
@ -525,9 +525,14 @@ class Blinkenlights(BlinkenBase, UIBase):
|
|||||||
finally:
|
finally:
|
||||||
s.c.unlock()
|
s.c.unlock()
|
||||||
|
|
||||||
def terminate(s, exitstatus = 0):
|
def terminate(s, exitstatus = 0, errortitle = None, errormsg = None):
|
||||||
s.c.stop()
|
s.c.stop()
|
||||||
UIBase.terminate(s, exitstatus)
|
if errormsg <> None:
|
||||||
|
if errortitle <> None:
|
||||||
|
sys.stderr.write('%s: %s\n'%(errortitle, errormsg))
|
||||||
|
else:
|
||||||
|
sys.stderr.write('%s\n' % errormsg)
|
||||||
|
UIBase.terminate(s, exitstatus = exitstatus, errortitle = errortitle, errormsg = errormsg)
|
||||||
|
|
||||||
def threadException(s, thread):
|
def threadException(s, thread):
|
||||||
s.c.stop()
|
s.c.stop()
|
||||||
|
@ -246,6 +246,13 @@ class VerboseUI(UIBase):
|
|||||||
tf = s.availablethreadframes.pop()
|
tf = s.availablethreadframes.pop()
|
||||||
tf.destroy()
|
tf.destroy()
|
||||||
s.tflock.release()
|
s.tflock.release()
|
||||||
|
|
||||||
|
def terminate(s, exitstatus = 0, errortitle = None, errormsg = None):
|
||||||
|
if errormsg <> None:
|
||||||
|
if errortitle == None:
|
||||||
|
errortitle = "Error"
|
||||||
|
TextOKDialog(errortitle, errormsg)
|
||||||
|
UIBase.terminate(s, exitstatus = exitstatus, errortitle = None, errormsg = None)
|
||||||
|
|
||||||
def threadException(s, thread):
|
def threadException(s, thread):
|
||||||
exceptionstr = s.getThreadExceptionString(thread)
|
exceptionstr = s.getThreadExceptionString(thread)
|
||||||
|
@ -301,8 +301,13 @@ class UIBase:
|
|||||||
def mainException(s):
|
def mainException(s):
|
||||||
s._msg(s.getMainExceptionString())
|
s._msg(s.getMainExceptionString())
|
||||||
|
|
||||||
def terminate(s, exitstatus = 0):
|
def terminate(s, exitstatus = 0, errortitle = None, errormsg = None):
|
||||||
"""Called to terminate the application."""
|
"""Called to terminate the application."""
|
||||||
|
if errormsg <> None:
|
||||||
|
if errortitle <> None:
|
||||||
|
sys.stderr.write('ERROR: %s\n\n%s\n'%(errortitle, errormsg))
|
||||||
|
else:
|
||||||
|
sys.stderr.write('%s\n' % errormsg)
|
||||||
sys.exit(exitstatus)
|
sys.exit(exitstatus)
|
||||||
|
|
||||||
def threadExited(s, thread):
|
def threadExited(s, thread):
|
||||||
|
Loading…
Reference in New Issue
Block a user