[GRASS-SVN] r59379 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 26 10:02:18 PDT 2014


Author: martinl
Date: 2014-03-26 10:02:18 -0700 (Wed, 26 Mar 2014)
New Revision: 59379

Modified:
   grass/trunk/lib/init/grass.py
   grass/trunk/lib/init/variables.html
Log:
grass.py: add -gtext switch


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2014-03-26 16:31:56 UTC (rev 59378)
+++ grass/trunk/lib/init/grass.py	2014-03-26 17:02:18 UTC (rev 59379)
@@ -126,7 +126,7 @@
 
 
 def fatal(msg):
-    sys.stderr.write(msg + os.linesep)
+    sys.stderr.write("%s: " % _('ERROR') + msg + os.linesep)
     sys.exit(_("Exiting..."))
 
 
@@ -177,6 +177,8 @@
   -c                             %s
   -text                          %s
                                    %s
+  -gtext                         %s
+                                   %s
   -gui                           %s
                                    %s
   --config                       %s
@@ -202,8 +204,10 @@
        _("print this help message"),
        _("show version information and exit"),
        _("create given database, location or mapset if it doesn't exist"),
-       _("use text based interface"),
+       _("use text based interface (skip welcome screen)"),
        _("and set as default"),
+       _("use text based interface (show welcome screen)"),
+       _("and set as default"),
        _("use $DEFAULT_GUI graphical user interface"),
        _("and set as default"),
        _("print GRASS configuration parameters"),
@@ -525,7 +529,7 @@
     # Check if we are running X windows by checking the DISPLAY variable
     if os.getenv('DISPLAY') or windows or macosx:
         # Check if python is working properly
-        if grass_gui == 'wxpython':
+        if grass_gui in ('wxpython', 'gtext'):
             nul = open(os.devnull, 'w')
             p = Popen([os.environ['GRASS_PYTHON']], stdin=subprocess.PIPE,
                       stdout=nul, stderr=nul)
@@ -675,22 +679,22 @@
         if grass_gui == 'text':
             pass
         # Check for GUI
-        elif grass_gui == 'wxpython':
-            gui_startup()
+        elif grass_gui in ('gtext', 'wxpython'):
+            gui_startup(grass_gui == 'gtext')
         else:
             # Shouldn't need this but you never know
-            fatal(_("Invalid user interface specified - <%s>.\n" 
+            fatal(_("Invalid user interface specified - <%s>. " 
                     "Use the --help option to see valid interface names.") % grass_gui)
 
 
-def gui_startup():
-    if grass_gui == 'wxpython':
-        thetest = call([os.getenv('GRASS_PYTHON'),
+def gui_startup(wscreen_only = False):
+    if grass_gui in ('wxpython', 'gtext'):
+        ret = call([os.getenv('GRASS_PYTHON'),
                         gfile(wxpython_base, "gis_set.py")])
 
-    if thetest == 0:
+    if ret == 0:
         pass
-    elif thetest == 1:
+    elif ret == 1:
         # The startup script printed an error message so wait
         # for user to read it
         message(_("Error in GUI startup. If necessary, please "
@@ -701,7 +705,7 @@
 
         os.execlp(cmd_name, "-text")
         sys.exit(1)
-    elif thetest == 2:
+    elif ret == 2:
         # User wants to exit from GRASS
         message(_("Received EXIT message from GUI.\nGRASS is not started. Bye."))
         sys.exit(0)
@@ -861,9 +865,9 @@
 
     if msg:
         if grass_gui == "wxpython":
-            thetest = call([os.getenv('GRASS_PYTHON'),
-                            os.path.join(wxpython_base, "gis_set_error.py"),
-                            msg])
+            call([os.getenv('GRASS_PYTHON'),
+                  os.path.join(wxpython_base, "gis_set_error.py"),
+                  msg])
         else:
             global remove_lockfile
             remove_lockfile = False
@@ -1215,6 +1219,9 @@
         # Check if the -text flag was given
         elif i in ["-text", "--text"]:
             grass_gui = 'text'
+        # Check if the -gtext flag was given
+        elif i in ["-gtext", "--gtext"]:
+            grass_gui = 'gtext'
         # Check if the -gui flag was given
         elif i in ["-gui", "--gui"]:
             grass_gui = default_gui

Modified: grass/trunk/lib/init/variables.html
===================================================================
--- grass/trunk/lib/init/variables.html	2014-03-26 16:31:56 UTC (rev 59378)
+++ grass/trunk/lib/init/variables.html	2014-03-26 17:02:18 UTC (rev 59379)
@@ -137,15 +137,15 @@
     program to use for plotting <em>gnuplot</em> data.</dd>
   
   <dt>GRASS_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>
-    (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a GRASS
-    gisenv variable (see below). If this shell variable exists at
-    GRASS startup, it will determine the GUI used. If it is not
-    defined startup will default to the last GUI used.</dd>
-  
-  
+  <dd>either <tt>text</tt> (text user interface), <tt>gtext</tt> (text
+  user interface with GUI welcome screen), or <tt>gui</tt> (graphical
+  user interface) to define non-/graphical startup. Can also specify
+  the name of the GUI to use, e.g. <tt>wxpython</tt>
+  (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a GRASS
+  gisenv variable (see below). If this shell variable exists at GRASS
+  startup, it will determine the GUI used. If it is not defined
+  startup will default to the last GUI used.</dd>
+    
   <dt>GRASS_HTML_BROWSER</dt>
   <dd>[init.sh, wxgui]<br> defines name of HTML browser. For most
     platforms this should be an executable in your PATH, or the full
@@ -436,13 +436,7 @@
     encoding of query form (utf-8, ascii, iso8859-1, koi8-r)</dd>
   
   <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>
-    (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a shell
-    environment variable. If this shell variable exists at GRASS
-    startup, it will determine the GUI used. If it is not defined
-    startup will default to the last GUI used.</dd>
+  <dd>See <tt>GRASS_GUI</tt> environmental variable for details.</dd>
   
   <dt>LOCATION</dt>
   <dd>full path to location directory</dd>



More information about the grass-commit mailing list