From 6572a97db05ec466841a4859edf7c0fdc71030f3 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Sun, 24 Jan 2016 13:36:28 +0000
Subject: [PATCH] X/Y/Z canvas centre command line argument is now working. Its
 semantics will change soon though.

---
 fsl/fsleyes/fsleyes_parseargs.py |  5 +++--
 fsl/tools/fsleyes.py             | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/fsl/fsleyes/fsleyes_parseargs.py b/fsl/fsleyes/fsleyes_parseargs.py
index 5b6ba9843..7d46c7710 100644
--- a/fsl/fsleyes/fsleyes_parseargs.py
+++ b/fsl/fsleyes/fsleyes_parseargs.py
@@ -564,8 +564,9 @@ HELP = td.TypeDict({
     # TODO how about other overlay types?
     'Main.voxelLoc'        : 'Location to show (voxel coordinates of '
                              'first overlay)',
-    'Main.worldLoc'        : 'Location to show (world coordinates, '
-                             'takes precedence over --voxelloc)',
+    'Main.worldLoc'        : 'Location to show (world coordinates of '
+                             'first overlay, takes precedence over '
+                             '--voxelloc)', 
     'Main.selectedOverlay' : 'Selected overlay (default: last)',
     'Main.autoDisplay'     : 'Automatically configure display settings to '
                              'overlays (unless any display settings are '
diff --git a/fsl/tools/fsleyes.py b/fsl/tools/fsleyes.py
index 8ed4d6352..d1e13da77 100644
--- a/fsl/tools/fsleyes.py
+++ b/fsl/tools/fsleyes.py
@@ -30,6 +30,7 @@ import fsl.fsleyes.displaycontext    as displaycontext
 import fsl.fsleyes.perspectives      as perspectives
 import fsl.fsleyes.overlay           as fsloverlay
 import fsl.utils.status              as status
+import fsl.utils.async               as async
 
 
 log = logging.getLogger(__name__)
@@ -240,7 +241,18 @@ def interface(parent, args, ctx):
 
         fsleyes_parseargs.applySceneArgs(
             args, overlayList, displayCtx, viewOpts)
- 
+
+        def centre():
+            if args.xcentre:
+                viewPanel.getXCanvas().centreDisplayAt(*args.xcentre)
+            if args.ycentre:
+                viewPanel.getYCanvas().centreDisplayAt(*args.ycentre)
+            if args.zcentre:
+                viewPanel.getZCanvas().centreDisplayAt(*args.zcentre)
+
+        if isinstance(viewPanel, views.OrthoPanel):
+            async.idle(centre)
+            
     return frame
 
     
-- 
GitLab