Skip to content
Snippets Groups Projects
Commit 483f5a7d authored by Paul McCarthy's avatar Paul McCarthy
Browse files

CanvasPanel screenshot shows message while render process is running

parent eeb2aa42
No related branches found
No related tags found
No related merge requests found
...@@ -334,7 +334,7 @@ def buildGUI(args, fslTool, toolCtx, fslEnvActive): ...@@ -334,7 +334,7 @@ def buildGUI(args, fslTool, toolCtx, fslEnvActive):
def runTool(toolName, args, **kwargs): def runTool(toolName, args, **kwargs):
"""Runs the tool with the specified name, with the specified arguments, """Runs the tool with the specified name, with the specified arguments,
in a separate process. in a separate process. Returns the process exit code.
""" """
args = [toolName] + args args = [toolName] + args
...@@ -342,7 +342,7 @@ def runTool(toolName, args, **kwargs): ...@@ -342,7 +342,7 @@ def runTool(toolName, args, **kwargs):
log.debug('Executing {}'.format(' '.join(args))) log.debug('Executing {}'.format(' '.join(args)))
subprocess.call(args, **kwargs) return subprocess.call(args, **kwargs)
def main(): def main():
......
...@@ -43,9 +43,15 @@ messages = TypeDict({ ...@@ -43,9 +43,15 @@ messages = TypeDict({
'AtlasInfoPanel.chooseAnAtlas' : 'Choose an atlas!', 'AtlasInfoPanel.chooseAnAtlas' : 'Choose an atlas!',
'AtlasInfoPanel.atlasDisabled' : 'Atlases are not available', 'AtlasInfoPanel.atlasDisabled' : 'Atlases are not available',
'CanvasPanel.screenshot' : 'Save screenshot', 'CanvasPanel.screenshot' : 'Save screenshot',
'CanvasPanel.screenshot.notSaved' : 'Image {} needs saving before a ' 'CanvasPanel.screenshot.notSaved' : 'Image {} needs saving before a '
'screenshot can be taken.', 'screenshot can be taken.',
'CanvasPanel.screenshot.pleaseWait' : 'Saving screenshot - '
'please wait ...',
'CanvasPanel.screenshot.error' : 'Sorry, there was an error '
'saving the screenshot. Try '
'calling render directly with '
'this command: \n{}',
}) })
...@@ -64,6 +70,7 @@ titles = TypeDict({ ...@@ -64,6 +70,7 @@ titles = TypeDict({
'CanvasPanel.screenshot' : 'Save screenshot', 'CanvasPanel.screenshot' : 'Save screenshot',
'CanvasPanel.screenshot.notSaved' : 'Save image before continuing', 'CanvasPanel.screenshot.notSaved' : 'Save image before continuing',
'CanvasPanel.screenshot.error' : 'Error saving screenshot',
'AtlasInfoPanel' : 'Atlas information', 'AtlasInfoPanel' : 'Atlas information',
'AtlasOverlayPanel' : 'Atlas overlays', 'AtlasOverlayPanel' : 'Atlas overlays',
......
...@@ -139,8 +139,18 @@ def _takeScreenShot(imageList, displayCtx, canvas): ...@@ -139,8 +139,18 @@ def _takeScreenShot(imageList, displayCtx, canvas):
log.debug('Generating screenshot with call ' log.debug('Generating screenshot with call '
'to render: {}'.format(' '.join(argv))) 'to render: {}'.format(' '.join(argv)))
# Run render.py to generate the screenshot # Run render.py to generate the screenshot
fsl.runTool('render', argv) msg = strings.messages['CanvasPanel.screenshot.pleaseWait']
busyDlg = wx.BusyInfo(msg, canvas)
result = fsl.runTool('render', argv)
busyDlg.Destroy()
if result != 0:
title = strings.titles[ 'CanvasPanel.screenshot.error']
msg = strings.messages['CanvasPanel.screenshot.error']
msg = msg.format(' '.join(['render'] + argv))
wx.MessageBox(msg, title, wx.ICON_ERROR | wx.OK)
class CanvasPanel(viewpanel.ViewPanel): class CanvasPanel(viewpanel.ViewPanel):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment