[GRASS-SVN] r30090 - grass/trunk/general/g.gui

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 12 00:04:13 EST 2008


Author: hamish
Date: 2008-02-12 00:04:13 -0500 (Tue, 12 Feb 2008)
New Revision: 30090

Modified:
   grass/trunk/general/g.gui/description.html
   grass/trunk/general/g.gui/main.c
Log:
* expand and reword help page and some messages;
* reorder GUIs to put tcltk first
* add flag to bypass making the given GUI type permanent
* add, but not activate, rc file option (what to call it?)
* only reset the default if it differs from the given type


Modified: grass/trunk/general/g.gui/description.html
===================================================================
--- grass/trunk/general/g.gui/description.html	2008-02-11 16:34:45 UTC (rev 30089)
+++ grass/trunk/general/g.gui/description.html	2008-02-12 05:04:13 UTC (rev 30090)
@@ -1,21 +1,37 @@
 <h2>DESCRIPTION</h2>
 
 <p>
-This program allows user to start selected graphical user interface (GUI) from command line
-prompt.
+This program allows user to start a selected graphical user interface (GUI)
+from command line prompt.
 
 <p>
 Currently three different GUIs are supported:
 
 <ul>
-<li><b>oldtcltk</b> - Old TCL/TK based GUI aka <a href="d.m.html">Display Manager</a></li>
-<li><b>tcltk</b> - Current TCL/TK based GUI aka <a href="gis.m.html">GIS Manager</a></li>
-<li><b>wxpython</b> - New wxPython based GUI aka <a href="wxGUI.html">wxGUI</a></li>
+<li><b>tcltk</b> - Current TCL/TK based GUI aka the <em>gis.m</em>
+    <a href="gis.m.html">GIS Manager</a></li>
+<li><b>oldtcltk</b> - Old TCL/TK based GUI aka the <em>d.m</em>
+    <a href="d.m.html">Display Manager</a></li>
+<li><b>wxpython</b> - New wxPython based GUI aka
+    <a href="wxGUI.html">wxGUI</a></li>
 </ul>
 
-If GRASS_GUI variable is not set or differs from selected option then
-GRASS_GUI is changed, selected GUI is used as default UI.
+If the <em>g.gisenv</em> <tt>GRASS_GUI</tt> variable is not set or differs
+from the option selected with this module, and the <b>-u</b> flag is not
+set, then the <tt>GRASS_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>, <tt>tcltk</tt>,
+<tt>oldtcltk</tt>, and <tt>wxpython</tt>.
+
+<em>g.gisenv</em> variables are stored in the user's home directory
+in a hidden file called ".grassrc6". They are not shell environment
+variables and the "rc" file is not a classic UNIX run command file,
+it just contains persistent GRASS variables and is not executed.
+
+
 <h2>SEE ALSO</h2>
 
 <em>
@@ -23,7 +39,7 @@
 <a href="http://grass.gdf-hannover.de/wiki/WxPython-based_GUI_for_GRASS">wxGUI wiki-page</a><br>
 <a href="gis.m.html">TCL/TK based GIS Manager (gis.m)</a>,<br>
 <a href="d.m.html">TCL/TK based Display Manager (d.m)</a>,<br><br>
-<a href="g.gisenv.html">g.gisenv</a>, <a href="variables.html">variables list</a>
+<a href="g.gisenv.html">g.gisenv</a>, <a href="variables.html">GRASS variables list</a>
 </em>
 
 

Modified: grass/trunk/general/g.gui/main.c
===================================================================
--- grass/trunk/general/g.gui/main.c	2008-02-11 16:34:45 UTC (rev 30089)
+++ grass/trunk/general/g.gui/main.c	2008-02-12 05:04:13 UTC (rev 30090)
@@ -21,7 +21,8 @@
 
 int main(int argc, char *argv[])
 {
-    struct Option *type;
+    struct Option *type, *rc_file;
+    struct Flag *oneoff;
     struct GModule *module;
     char *gui_type_env;
 
@@ -30,17 +31,17 @@
     module = G_define_module();
     module->keywords = _("general, gui");
     module->description =
-	_("Starts GRASS graphical user interface (GUI).");
+	_("Launches a GRASS graphical user interface (GUI) session.");
 
     type = G_define_option();
     type->key = "type";
     type->type = TYPE_STRING;
     type->required = YES;
     type->description = _("GUI type");
-    type->descriptions = _("oldtcltk;Old TCL/TK based GUI - Display Manager (d.m);"
-			   "tcltk;TCL/TK based GUI - GIS Manager (gis.m);"
-			   "wxpython;wxPython based new generation GUI (wxgui)");
-    type->options = "oldtcltk,tcltk,wxpython";
+    type->descriptions = _("tcltk;TCL/TK based GUI - GIS Manager (gis.m);"
+			   "oldtcltk;Old TCL/TK based GUI - Display Manager (d.m);"
+			   "wxpython;wxPython based next generation GUI (wxgui)");
+    type->options = "tcltk,oldtcltk,wxpython";
     gui_type_env = G__getenv("GRASS_GUI");
     if (gui_type_env && strcmp(gui_type_env, "text")) {
 	type->answer = G_store(gui_type_env);
@@ -48,17 +49,30 @@
     else {
 	type->answer = "tcltk";
     }
+/*
+    rc_file = G_define_option();
+    rc_file->key = "rc";
+    rc_file->type = TYPE_STRING;
+    rc_file->required = NO;
+    rc_file->description = _("Name of GIS manager settings file (.grc)");
+*/
+    oneoff = G_define_flag();
+    oneoff->key         = 'u';
+    oneoff->description = _("Do not modify default GUI setting");
 
     if (argc > 1 && G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    if (gui_type_env) {
-	if (strcmp(gui_type_env, type->answer)) {
-	    G_message(_("<%s> is now default GUI"), type->answer);
+    if (gui_type_env && !oneoff->answer) {
+	if (strcmp(gui_type_env, type->answer) != 0) {
+	    G_message(_("<%s> is now the default GUI"), type->answer);
 	    G_setenv("GRASS_GUI", type->answer);
 	}
     }
 
+/* TODO: build string to include dmrc= file */
+/*       use G_spawn() ? */
+
     if (strcmp(type->answer, "oldtcltk") == 0) {
 	G_system("d.m");
     }



More information about the grass-commit mailing list