[GRASS-SVN] r35239 - in grass/trunk/lib: gis init

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 6 09:53:09 EST 2009


Author: neteler
Date: 2009-01-06 09:53:09 -0500 (Tue, 06 Jan 2009)
New Revision: 35239

Modified:
   grass/trunk/lib/gis/parser.c
   grass/trunk/lib/init/README
   grass/trunk/lib/init/functions.sh
   grass/trunk/lib/init/grass-xterm-mac
   grass/trunk/lib/init/grass7.html
   grass/trunk/lib/init/init.bat
   grass/trunk/lib/init/init.sh
   grass/trunk/lib/init/variables.html
Log:
TclTk removed

Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2009-01-06 08:25:03 UTC (rev 35238)
+++ grass/trunk/lib/gis/parser.c	2009-01-06 14:53:09 UTC (rev 35239)
@@ -141,7 +141,6 @@
 static void split_gisprompt(const char *, char *, char *, char *);
 
 static void G_gui(void);
-static void G_tcltk(void);
 static void G_usage_xml(void);
 static void G_usage_html(void);
 static void G_script(void);
@@ -889,13 +888,6 @@
 	    exit(EXIT_SUCCESS);
 	}
 
-	/* If first arg is "--tcltk" then generate
-	 * code for tcltkgrass */
-	if (strcmp(argv[1], "--tcltk") == 0) {
-	    G_tcltk();
-	    exit(EXIT_SUCCESS);
-	}
-
 	/* If first arg is "--script" then then generate
 	 * g.parser boilerplate */
 	if (strcmp(argv[1], "--script") == 0) {
@@ -1861,145 +1853,6 @@
 }
 
 /**
-  \brief Generates tcltk dialog.
-
-  \param[out] fp File to store tcltk code
-**/
-static void generate_tcl(FILE * fp)
-{
-    int new_prompt = uses_new_gisprompt();
-    const char *type;
-    int optn;
-
-    fprintf(fp, "begin_dialog {%s} {\n", st->pgm_name);
-    fprintf(fp, " label {%s}\n", st->module_info.label ? st->module_info.label : "");
-    fprintf(fp, " desc {%s}\n",
-	    st->module_info.description ? st->module_info.description : "");
-    fprintf(fp, " key {%s}\n",
-	    st->module_info.keywords ? st->module_info.keywords : "");
-    fprintf(fp, "}\n");
-
-    optn = 1;
-
-    if (st->n_flags) {
-	struct Flag *flag;
-
-	for (flag = &st->first_flag; flag; flag = flag->next_flag, optn++) {
-	    fprintf(fp, "add_flag %d {\n", optn);
-	    fprintf(fp, " name {%c}\n", flag->key);
-	    fprintf(fp, " desc {%s}\n", flag->description);
-	    fprintf(fp, " answer %d\n", flag->answer);
-	    /* It should be up to the gui as to what
-	       to do with the label and description */
-	    fprintf(fp, " label {%s}\n", flag->label ? flag->label : "");
-	    fprintf(fp, " guisection {%s}\n",
-		    flag->guisection ? flag->guisection : "");
-	    fprintf(fp, "}\n");
-	}
-    }
-
-    if (st->n_opts) {
-	struct Option *opt;
-
-	for (opt = &st->first_option; opt; opt = opt->next_opt, optn++) {
-	    if (opt->key_desc != NULL)
-		type = opt->key_desc;
-	    else
-		switch (opt->type) {
-		case TYPE_INTEGER:
-		    type = "integer";
-		    break;
-		case TYPE_DOUBLE:
-		    type = "float";
-		    break;
-		case TYPE_STRING:
-		    type = "string";
-		    break;
-		default:
-		    type = "string";
-		    break;
-		}
-
-	    fprintf(fp, "add_option %d {\n", optn);
-	    fprintf(fp, " name {%s}\n", opt->key);
-	    fprintf(fp, " type {%s}\n", type);
-	    fprintf(fp, " multi %d\n", opt->multiple);
-	    fprintf(fp, " desc {%s}\n", opt->description);
-	    fprintf(fp, " required %d\n", opt->required);
-	    fprintf(fp, " options {%s}\n", opt->options ? opt->options : "");
-	    fprintf(fp, " descs {%s}\n",
-		    opt->descriptions ? opt->descriptions : "");
-	    fprintf(fp, " answer {%s}\n", opt->answer ? opt->answer : "");
-	    fprintf(fp, " prompt {%s}\n",
-		    opt->gisprompt ? opt->gisprompt : "");
-	    /* It should be up to the gui as to what
-	       to do with the label and description */
-	    fprintf(fp, " label {%s}\n", opt->label ? opt->label : "");
-	    fprintf(fp, " guisection {%s}\n",
-		    opt->guisection ? opt->guisection : "");
-	    fprintf(fp, "}\n");
-	}
-    }
-
-    if (new_prompt) {
-	fprintf(fp, "add_xflag %d {\n", optn);
-	fprintf(fp, " name {overwrite}\n");
-	fprintf(fp, " desc {%s}\n",
-		_("Allow output files to overwrite existing files"));
-	fprintf(fp, " answer %d\n", st->overwrite);
-	fprintf(fp, " label {%s}\n", _("Allow overwrite"));
-	fprintf(fp, " guisection {}\n");
-	fprintf(fp, "}\n");
-	optn++;
-    }
-
-    fprintf(fp, "add_xflag %d {\n", optn);
-    fprintf(fp, " name {quiet}\n");
-    fprintf(fp, " desc {%s}\n", _("Run with minimal output messages"));
-    fprintf(fp, " answer %d\n", st->quiet);
-    fprintf(fp, " label {%s}\n", _("Run quietly"));
-    fprintf(fp, " guisection {}\n");
-    fprintf(fp, "}\n");
-    optn++;
-
-    fprintf(fp, "end_dialog %d\n", optn - 1);
-}
-
-/**
-   \brief Build Tcl/Tk GUI dialog
-**/
-static void G_gui_tcltk(void)
-{
-    FILE *fp;
-
-    if (!st->pgm_name)
-	st->pgm_name = G_program_name();
-    if (!st->pgm_name)
-	st->pgm_name = "??";
-
-#ifdef __MINGW32__
-    if (getenv("GRASS_DEBUG_GUI"))
-	fp = G_popen("tee gui_dump.tcl | %GRASS_WISH%", "w");
-    else
-	fp = G_popen("%GRASS_WISH%", "w");
-#else
-    if (getenv("GRASS_DEBUG_GUI"))
-	fp = G_popen("tee gui_dump.tcl | $GRASS_WISH", "w");
-    else
-	fp = G_popen("$GRASS_WISH", "w");
-#endif
-
-    if (!fp)
-	G_fatal_error(_("Unable to spawn the 'wish' program"));
-
-    fprintf(fp, "source $env(GISBASE)/etc/gui.tcl\n");
-
-    generate_tcl(fp);
-
-    G_pclose(fp);
-}
-
-/**
    \brief Build wxPython GUI dialog
 **/
 static void G_gui_wx(void)
@@ -2019,9 +1872,9 @@
 /**
    \brief Invoke GUI dialog 
 
-   Use G_gui_wx() or G_gui_tcltk() to generate GUI dialog.
+   Use G_gui_wx() to generate GUI dialog.
 
-   G_gui_tcltk() is called by default (if GRASS_GUI is not defined)
+   G_gui_wx() is called by default (if GRASS_GUI is not defined)
 **/
 static void G_gui(void)
 {
@@ -2035,24 +1888,11 @@
     if (gui && strcmp(gui, "wxpython") == 0)
 	G_gui_wx();
     else
-	G_gui_tcltk();
+	G_fatal_error(_("No GUI defined in GRASS_GUI"));
 
     return;
 }
 
-/**
-   \brief Send Tcl/Tk code to tcltkgrass 
-**/
-static void G_tcltk(void)
-{
-    if (!st->pgm_name)
-	st->pgm_name = G_program_name();
-    if (!st->pgm_name)
-	st->pgm_name = "??";
-
-    generate_tcl(stdout);
-}
-
 /**************************************************************************
  *
  * The remaining routines are all local (static) routines used to support

Modified: grass/trunk/lib/init/README
===================================================================
--- grass/trunk/lib/init/README	2009-01-06 08:25:03 UTC (rev 35238)
+++ grass/trunk/lib/init/README	2009-01-06 14:53:09 UTC (rev 35239)
@@ -2,8 +2,7 @@
 
   "grass70" starts up d.m by default (if not first time user).
   "grass70 -text" will start up in text mode.
-  "grass70 -tcltk" or "grass70 -gui" will start up in tcltk mode.
-  "grass70 -wxpython" will start up in wxpython mode.
+  "grass70 -wxpython" or "grass70 -gui" will start up in wxpython mode.
 
   You can use alias "grass70" to "grass70 -text" to use text mode by default.
   Or set env var GRASS_GUI=text.

Modified: grass/trunk/lib/init/functions.sh
===================================================================
--- grass/trunk/lib/init/functions.sh	2009-01-06 08:25:03 UTC (rev 35238)
+++ grass/trunk/lib/init/functions.sh	2009-01-06 14:53:09 UTC (rev 35239)
@@ -96,7 +96,7 @@
 	GRASS_GUI="$DEFAULT_GUI"
     fi
 
-    # gis.m, d.m no longer exist
+    # FIXME oldtcltk, gis.m, d.m no longer exist
     case "$GRASS_GUI" in
     d.m | oldtcltk | gis.m)
 	GRASS_GUI="$DEFAULT_GUI"

Modified: grass/trunk/lib/init/grass-xterm-mac
===================================================================
--- grass/trunk/lib/init/grass-xterm-mac	2009-01-06 08:25:03 UTC (rev 35238)
+++ grass/trunk/lib/init/grass-xterm-mac	2009-01-06 14:53:09 UTC (rev 35239)
@@ -20,25 +20,15 @@
 	GRASS_VERSION="$GRASS_VERSION"
 	GRASS_PAGER="$GRASS_PAGER"
 	DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH"
-	GRASS_WISH="$GRASS_WISH"
-	GRASS_TCLSH="$GRASS_TCLSH"
 	GRASS_HTML_BROWSER="$GRASS_HTML_BROWSER"
 	GRASS_HTML_BROWSER_MACOSX="$GRASS_HTML_BROWSER_MACOSX"
-	export DISPLAY PATH GIS_LOCK GISRC GISBASE GRASS_VERSION GRASS_PAGER DYLD_LIBRARY_PATH GRASS_LD_LIBRARY_PATH GRASS_WISH GRASS_TCLSH GRASS_HTML_BROWSER GRASS_HTML_BROWSER_MACOSX
+	export DISPLAY PATH GIS_LOCK GISRC GISBASE GRASS_VERSION GRASS_PAGER DYLD_LIBRARY_PATH GRASS_LD_LIBRARY_PATH GRASS_HTML_BROWSER GRASS_HTML_BROWSER_MACOSX
 	EOF
 
 	if [ "$GRASS_ADDON_PATH" ] ; then
 	    echo "GRASS_ADDON_PATH=\"$GRASS_ADDON_PATH\""
 	    echo "export GRASS_ADDON_PATH"
 	fi
-	if [ "$TCL_LIBRARY" ] ; then
-	    echo "TCL_LIBRARY=\"$TCL_LIBRARY\""
-	    echo "export TCL_LIBRARY"
-	fi
-	if [ "$TK_LIBRARY" ] ; then
-	    echo "TK_LIBRARY=\"$TK_LIBRARY\""
-	    echo "export TK_LIBRARY"
-	fi
 
 	# get command, ignore all other xterm flags
 	while true ; do

Modified: grass/trunk/lib/init/grass7.html
===================================================================
--- grass/trunk/lib/init/grass7.html	2009-01-06 08:25:03 UTC (rev 35238)
+++ grass/trunk/lib/init/grass7.html	2009-01-06 14:53:09 UTC (rev 35239)
@@ -138,20 +138,13 @@
      • Default value - wxpython
 </DL>
 
-<H3>Tcl/Tk and Python Environment Variables</H3>
+<H3>Python Environment Variables</H3>
 
 <P>
-If you choose to use the wxPython interface or Tcl/Tk modules, then
+If you choose to use the wxPython interface, then
 the following environment variables can be used to override your
-system default <tt>tclsh</tt>, <tt>wish</tt>, and <tt>python</tt> commands.
+system default <tt>python</tt> command.
 
-<DL>
-<DT><B>GRASS_TCLSH</B>
-<DD> Command to use to override <tt>tclsh</tt>
-
-<DT><B>GRASS_WISH</B>
-<DD> Command to use to override <tt>wish</tt>
-
 <DT><B>GRASS_PYTHON</B>
 <DD> Command to use to override <tt>python</tt>
 </DL>
@@ -254,7 +247,7 @@
     to choose the appropriate location and mapset.
 
 <DT><B>grass70 -gui</B>
-<DD> Start GRASS using the Tcl/Tk based user interface. The user will be
+<DD> Start GRASS using the wxPython based user interface. The user will be
     prompted to choose the appropriate location and mapset.
 
 <DT><B>grass70 -text</B>
@@ -266,7 +259,7 @@
    into the given mapset, bypassing the mapset selection menu.
 
 <DT><B>grass70 -gui -</B>
-<DD> Start GRASS using the Tcl/Tk based user interface and try to obtain
+<DD> Start GRASS using the wxPython based user interface and try to obtain
     the location and mapset from environment variables.
 
 </DL>
@@ -381,7 +374,7 @@
 <EM>$WINDOWS_BIN/grass70.bat</EM> - GRASS startup program (MS-Windows)<BR>
 <EM>$GISBASE/etc/Init.sh</EM> - GRASS initialization script called by
     <EM>grass70</EM><BR>
-<EM>$GISBASE/etc/gis_set.tcl</EM> - Tcl/Tk script to set the
+<EM>$GISBASE/etc/wxpython/gis_set.py</EM> - Python script to set the
     location and mapset to use. Called by <EM>Init.sh</EM><BR><BR>
 
 <H2>SEE ALSO</H2>

Modified: grass/trunk/lib/init/init.bat
===================================================================
--- grass/trunk/lib/init/init.bat	2009-01-06 08:25:03 UTC (rev 35238)
+++ grass/trunk/lib/init/init.bat	2009-01-06 14:53:09 UTC (rev 35239)
@@ -52,7 +52,6 @@
 if "%1" == "-text" goto settextmode
 :aftertextcheck
 
-if "%1" == "-tcltk" goto setguimode
 if "%1" == "-gui" goto setguimode
 :afterguicheck
 
@@ -77,8 +76,8 @@
   g.gisenv "set=GRASS_GUI=%GRASS_GUI%"
 )
 
-rem Set tcltk as default if not specified elsewhere
-if "%GRASS_GUI%"=="" set GRASS_GUI=tcltk
+rem Set wxpython as default if not specified elsewhere
+if "%GRASS_GUI%"=="" set GRASS_GUI=wxpython
 
 
 "%WINGISBASE%\etc\clean_temp" > NUL:
@@ -86,21 +85,10 @@
 
 if "%GRASS_GUI%"=="text" goto text
 
-if not "%GRASS_WISH%"=="" (
-  "%GRASS_WISH%" "%WINGISBASE%\etc\gis_set.tcl"
-) else (
-  "%WINGISBASE%\etc\gis_set.tcl"
-)
-
-rem This doesn't seem to work; don't understand return codes from gis_set.tcl PK
-rem if return ok, gis.m start:
+rem if return ok, wxpython start:
 if %errorlevel% == 2 goto exitinit
 
-if not "%GRASS_WISH%"=="" (
-  "%GRASS_WISH%" "%WINGISBASE%\etc\gm\gm.tcl"
-) else (
-  "%WINGISBASE%\etc\gm\gm.tcl"
-)
+"%WINGISBASE%\etc\wxpython\wxgui.py"
 
 "%WINGISBASE%\etc\clean_temp" > NUL:
 
@@ -146,7 +134,7 @@
 
 :setguimode
 
-set GRASS_GUI=tcltk
+set GRASS_GUI=wxpython
 shift
 
 goto afterguicheck

Modified: grass/trunk/lib/init/init.sh
===================================================================
--- grass/trunk/lib/init/init.sh	2009-01-06 08:25:03 UTC (rev 35238)
+++ grass/trunk/lib/init/init.sh	2009-01-06 14:53:09 UTC (rev 35239)
@@ -36,7 +36,7 @@
 fi
 
 # GRASS_SH is normally just for Windows when not started from a bourne 
-# shell. But when starting from Init.sh is still needed for Tcl/Tk.
+# shell. But when starting from Init.sh is still needed for GRASS_GUI (still true for GRASS 7?)
 GRASS_SH=/bin/sh
 export GRASS_SH
 
@@ -118,12 +118,6 @@
         shift
         ;;
 
-    # Check if the -tcltk flag was given
-    -tcltk)
-        GRASS_GUI="tcltk"
-        shift
-        ;;
-
     # Check if the -wxpython flag was given
     -wxpython)
         GRASS_GUI="wxpython"

Modified: grass/trunk/lib/init/variables.html
===================================================================
--- grass/trunk/lib/init/variables.html	2009-01-06 08:25:03 UTC (rev 35238)
+++ grass/trunk/lib/init/variables.html	2009-01-06 14:53:09 UTC (rev 35239)
@@ -233,10 +233,6 @@
   <dd>[wxGUI, Python SWIG]<br>
     set to override Python executable.</dd>
   
-  <dt>GRASS_TCLSH</dt>
-  <dd>[nviz]<br>
-    set tclsh shell name to override 'tclsh'.</dd>
-  
   <dt>GRASS_XTERM</dt>
   <dd>lib/init/grass-xterm-wrapper<br>
     lib/init/grass-xterm-mac<br>
@@ -257,10 +253,6 @@
   <dd>[d.mon]<br>
     defines the width of GRASS monitor, see also GRASS_HEIGHT.</dd>
   
-  <dt>GRASS_WISH</dt>
-  <dd>[nviz, Tcl/Tk programs]<br>
-    set wish shell name to override 'wish'.</dd>
-  
   <dt>GRASS_NO_GLX_PBUFFERS</dt>
   <dd>[nviz]<br>
     set to any value to disable the use of GLX Pbuffers.</dd>



More information about the grass-commit mailing list