[GRASS-SVN] r47294 - in grass/trunk: demolocation general/g.gui gui/wxpython/docs lib/init lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 28 08:22:53 EDT 2011


Author: martinl
Date: 2011-07-28 05:22:53 -0700 (Thu, 28 Jul 2011)
New Revision: 47294

Modified:
   grass/trunk/demolocation/grassrc.tmpl
   grass/trunk/general/g.gui/g.gui.html
   grass/trunk/general/g.gui/main.c
   grass/trunk/gui/wxpython/docs/wxGUI.html
   grass/trunk/lib/init/grass.py
   grass/trunk/lib/init/variables.html
   grass/trunk/lib/python/core.py
Log:
rename gisenv variable GRASS_GUI to GUI (gisenv variable has no
prefix)


Modified: grass/trunk/demolocation/grassrc.tmpl
===================================================================
--- grass/trunk/demolocation/grassrc.tmpl	2011-07-28 10:57:50 UTC (rev 47293)
+++ grass/trunk/demolocation/grassrc.tmpl	2011-07-28 12:22:53 UTC (rev 47294)
@@ -3,4 +3,4 @@
 MAPSET: PERMANENT
 GRASS_DB_ENCODING: utf-8
 DEBUG: 0
-GRASS_GUI: text
+GUI: text

Modified: grass/trunk/general/g.gui/g.gui.html
===================================================================
--- grass/trunk/general/g.gui/g.gui.html	2011-07-28 10:57:50 UTC (rev 47293)
+++ grass/trunk/general/g.gui/g.gui.html	2011-07-28 12:22:53 UTC (rev 47294)
@@ -15,14 +15,14 @@
 The old <em>gis.m</em> and <em>d.m</em> Tcl/Tk GUIs from GRASS 6 have been removed.
 <p>
 If the <b>-u</b> update flag is given or the <em>g.gisenv</em>
-<tt>GRASS_GUI</tt> variable is missing, then the <tt>GRASS_GUI</tt>
-variable is permanently changed and the selected GUI will be used
-as the default UI from then on.
+<tt>GUI</tt> variable is missing, then the <tt>GUI</tt> variable is
+permanently changed and the selected GUI will be used as the default
+UI from then on.
 
 
 <h2>NOTES</h2>
 
-Valid values for GRASS_GUI are <tt>text</tt> and <tt>wxpython</tt>.
+Valid values for GUI variable are <tt>text</tt> and <tt>wxpython</tt>.
 
 <em>g.gisenv</em> variables are stored in the user's home directory in
 a hidden file called "<tt>.grass7/rc</tt>". They are not shell

Modified: grass/trunk/general/g.gui/main.c
===================================================================
--- grass/trunk/general/g.gui/main.c	2011-07-28 10:57:50 UTC (rev 47293)
+++ grass/trunk/general/g.gui/main.c	2011-07-28 12:22:53 UTC (rev 47294)
@@ -8,7 +8,7 @@
  *
  * PURPOSE:      Start GRASS GUI from command line.
  *
- * COPYRIGHT:    (C) 2008, 2010 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2008, 2010-2011 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -73,7 +73,7 @@
 	update->answer = TRUE;
 
 
-    gui_type_env = G__getenv("GRASS_GUI");
+    gui_type_env = G__getenv("GUI");
 
     if (!type->answer) {
 	if (gui_type_env && strcmp(gui_type_env, "text")) {
@@ -86,7 +86,7 @@
 
     if (((gui_type_env && update->answer) &&
 	 strcmp(gui_type_env, type->answer) != 0) || !gui_type_env) {
-	G_setenv("GRASS_GUI", type->answer);
+	G_setenv("GUI", type->answer);
 	G_message(_("<%s> is now the default GUI"), type->answer);
     }
     else {

Modified: grass/trunk/gui/wxpython/docs/wxGUI.html
===================================================================
--- grass/trunk/gui/wxpython/docs/wxGUI.html	2011-07-28 10:57:50 UTC (rev 47293)
+++ grass/trunk/gui/wxpython/docs/wxGUI.html	2011-07-28 12:22:53 UTC (rev 47294)
@@ -10,12 +10,14 @@
    g.gui -u wxpython 
 </pre></div>
 
-or define in your <tt>.grass7/rc</tt> file 'GRASS_GUI' variable
+Alternatively define in your <tt>.grass7/rc</tt> file 'GUI' variable
 
 <div class="code"><pre>
-    GRASS_GUI: wxpython
+    GUI: wxpython
 </pre></div>
 
+or set up shell environmental variable <tt>GRASS_GUI</tt>.
+
 The GUI can be quit by selecting the 'File->Exit' menu item. The GUI
 can be restarted from the GRASS command line prompt by typing
 

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2011-07-28 10:57:50 UTC (rev 47293)
+++ grass/trunk/lib/init/grass.py	2011-07-28 12:22:53 UTC (rev 47294)
@@ -243,11 +243,16 @@
 	# Check for a reference to the GRASS user interface in the grassrc file
 	if os.access(gisrc, os.R_OK):
 	    kv = read_gisrc()
-	    if not kv.has_key('GRASS_GUI'):
+            if 'GRASS_GUI' in os.environ:
+                grass_gui = os.environ['GRASS_GUI']
+            elif 'GUI' in kv:
+                grass_gui = kv['GUI']
+            elif 'GRASS_GUI' in kv:
+                # For backward compatibility (GRASS_GUI renamed to GUI)
+                grass_gui = kv['GRASS_GUI']
+            else:
 		# Set the GRASS user interface to the default if needed
 		grass_gui = default_gui
-            else:
-                grass_gui = kv['GRASS_GUI']
     
     if not grass_gui:
 	grass_gui = default_gui
@@ -257,8 +262,9 @@
     
     # FIXME oldtcltk, gis.m, d.m no longer exist
     if grass_gui in ['d.m', 'gis.m', 'oldtcltk', 'tcltk']:
+        warning(_("GUI '%s' not supported in this version") % grass_gui)
 	grass_gui = default_gui
-
+    
 def get_locale():
     global locale
     locale = None
@@ -445,7 +451,7 @@
     # file name that should not match another file
     if os.access(gisrc, os.F_OK):
 	kv = read_gisrc()
-	kv['GRASS_GUI'] = grass_gui
+	kv['GUI'] = grass_gui
 	write_gisrc(kv)
 
 def non_interactive(arg, geofile = None):
@@ -952,7 +958,7 @@
 # Create the session grassrc file
 create_gisrc()
 
-# Ensure GRASS_GUI is set
+# Ensure GUI is set
 read_gui()
 
 # Get Locale name

Modified: grass/trunk/lib/init/variables.html
===================================================================
--- grass/trunk/lib/init/variables.html	2011-07-28 10:57:50 UTC (rev 47293)
+++ grass/trunk/lib/init/variables.html	2011-07-28 12:22:53 UTC (rev 47294)
@@ -395,7 +395,7 @@
   <dd>[d.what.vect/forms library]<br>
     encoding of query form (utf-8, ascii, iso8859-1, koi8-r)</dd>
   
-  <dt>GRASS_GUI</dt>
+  <dt>GUI</dt>
   <dd>either <tt>text</tt> or <tt>gui</tt> to define non-/graphical startup.
     <br><br> Can also specify the name of the GUI to use,
     e.g. <tt>wxpython</tt>

Modified: grass/trunk/lib/python/core.py
===================================================================
--- grass/trunk/lib/python/core.py	2011-07-28 10:57:50 UTC (rev 47293)
+++ grass/trunk/lib/python/core.py	2011-07-28 12:22:53 UTC (rev 47294)
@@ -144,7 +144,7 @@
     LOCATION_NAME='spearfish60';
     MAPSET='glynn';
     GRASS_DB_ENCODING='ascii';
-    GRASS_GUI='text';
+    GUI='text';
     MONITOR='x0';
     \endcode
     
@@ -199,7 +199,7 @@
     LOCATION_NAME='spearfish60';
     MAPSET='glynn';
     GRASS_DB_ENCODING='ascii';
-    GRASS_GUI='text';
+    GUI='text';
     MONITOR='x0';
     \endcode
     



More information about the grass-commit mailing list