25 lines
714 B
Python
25 lines
714 B
Python
def long_running_task(status):
|
|
" status decorator "
|
|
|
|
def lrt_decorator(func):
|
|
|
|
def lrt_wrapper(*args, **kwargs):
|
|
self = args[0]
|
|
self.lb12["text"] = status
|
|
self.bu10.state(['disabled'])
|
|
self.bu11.state(['disabled'])
|
|
self.update_idletasks()
|
|
try:
|
|
rc = func(*args, **kwargs)
|
|
finally:
|
|
# make sure GUI unlocks even after exception
|
|
self.lb12["text"] = "Ready."
|
|
self.bu10.state(['!disabled'])
|
|
self.bu11.state(['!disabled'])
|
|
self.update_idletasks()
|
|
return rc
|
|
|
|
return lrt_wrapper
|
|
|
|
return lrt_decorator
|