From 6efd1c067710ef2a9ef7b18d952a9f832c7afc6c Mon Sep 17 00:00:00 2001
From: "(no author)" <(no author)@8a9318a1-56ba-4d59-b755-99d26321be01>
Date: Mon, 21 Nov 2011 20:28:43 +0000
Subject: [PATCH] changing how the renderer is selected in compare to make sure
 an interactive or non-interactive renderer is correctly selected

git-svn-id: https://svn.ssec.wisc.edu/repos/glance/trunk@155 8a9318a1-56ba-4d59-b755-99d26321be01
---
 pyglance/glance/compare.py           | 9 +++++++++
 pyglance/glance/gui_figuremanager.py | 2 +-
 pyglance/glance/plot.py              | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pyglance/glance/compare.py b/pyglance/glance/compare.py
index 6504dfb..447a2db 100644
--- a/pyglance/glance/compare.py
+++ b/pyglance/glance/compare.py
@@ -18,6 +18,12 @@ from pycdf import CDFError
 from subprocess import check_call as sh
 from urllib import quote
 
+import matplotlib
+if "gui" in sys.argv[1:] :
+    matplotlib.use('Qt4Agg')
+else :
+    matplotlib.use('Agg')
+
 import glance.io     as io
 import glance.delta  as delta
 import glance.data   as dataobj
@@ -1922,6 +1928,9 @@ python -m glance
         
         colocateToFile_library_call(a_path, b_path, args[2:], tempOptions)
     
+    # Note: the figure plotting in the GUI is dependant on having selected an interactive renderer in the first "use"
+    # statement at the beginning of this module. (It had to be moved into this module to pre-empt other use statempents
+    # from imports of other glance modules.)
     def gui (*args) :
         """start the glance graphical user interface
         
diff --git a/pyglance/glance/gui_figuremanager.py b/pyglance/glance/gui_figuremanager.py
index 6c5501c..2bab616 100644
--- a/pyglance/glance/gui_figuremanager.py
+++ b/pyglance/glance/gui_figuremanager.py
@@ -9,7 +9,7 @@ Copyright (c) 2011 University of Wisconsin SSEC. All rights reserved.
 
 # these first two lines must stay before the pylab import
 import matplotlib
-matplotlib.use('Qt4Agg') # use the Qt Anti-Grain Geometry rendering engine
+#matplotlib.use('Qt4Agg') # use the Qt Anti-Grain Geometry rendering engine
 
 from pylab import *
 
diff --git a/pyglance/glance/plot.py b/pyglance/glance/plot.py
index 55ae9e3..c64c366 100644
--- a/pyglance/glance/plot.py
+++ b/pyglance/glance/plot.py
@@ -15,7 +15,7 @@ if os.path.isdir(PYQT4_HAX):
 
 # these first two lines must stay before the pylab import
 import matplotlib
-matplotlib.use('Qt4Agg') # use the Anti-Grain Geometry rendering engine
+#matplotlib.use('Qt4Agg') # use the Anti-Grain Geometry rendering engine
 
 from pylab import *
 
-- 
GitLab