Commit 06abdca4 authored by Taylor Hanayik's avatar Taylor Hanayik
Browse files

indicate when background jobs are running

parent 6962d155
......@@ -42,12 +42,33 @@ def runCommand(propObj, button):
if a propObj has a run method, then this funnction will call it
and run it on the idle loop.
"""
if hasattr(propObj, "run"):
idle.run(propObj.run, onFinish=updateStatus)
def enableButton():
button.Enable()
button.SetLabel("Run")
layoutFrom(button)
updateStatus()
def disableButton():
button.SetLabel("Running")
layoutFrom(button)
button.Disable()
updateStatus("BUSY")
def onFinish():
enableButton()
if hasattr(propObj, "run"):
"""
idle.run will return immediately, so it will start
the new thread and then call disableButton
"""
idle.run(propObj.run, onFinish=onFinish)
disableButton()
else:
print(propObj, " has no attribute: run")
def updateStatus(msg="IDLE"):
"""
if a frame has a statusbar then set its text with msg.
......
......@@ -208,11 +208,11 @@ class FsleyesImage(wx.Panel):
def reset(self):
self.overlayList.clear()
def add_image(self, new_img, valid, context, name):
def add_image(self, new_img, valid=None, context=None, name=None):
self.reset()
img = fslimage.Image(new_img)
self.overlayList.append(img)
def add_mask(self, new_img):
def add_mask(self, new_img, valid=None, context=None, name=None):
img = fslimage.Image(new_img)
self.overlayList.append(img, cmap='red', alpha=30)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment