[GRASS-SVN] r30080 - in grass/trunk/general: . g.gui

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 11 07:33:40 EST 2008


Author: martinl
Date: 2008-02-11 07:33:40 -0500 (Mon, 11 Feb 2008)
New Revision: 30080

Added:
   grass/trunk/general/g.gui/
   grass/trunk/general/g.gui/Makefile
   grass/trunk/general/g.gui/description.html
   grass/trunk/general/g.gui/main.c
Log:
Module g.gui added, common interface for starting GUI from CLI.


Property changes on: grass/trunk/general/g.gui
___________________________________________________________________
Name: svn:ignore
   + *.tmp.html
*OBJ*


Added: grass/trunk/general/g.gui/Makefile
===================================================================
--- grass/trunk/general/g.gui/Makefile	                        (rev 0)
+++ grass/trunk/general/g.gui/Makefile	2008-02-11 12:33:40 UTC (rev 30080)
@@ -0,0 +1,10 @@
+MODULE_TOPDIR = ../..
+
+PGM = g.gui
+
+LIBES     = $(GISLIB)
+DEPENDENCIES= $(GISDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd


Property changes on: grass/trunk/general/g.gui/Makefile
___________________________________________________________________
Name: svn:mime-type
   + text/x-sh
Name: svn:keywords
   + Author Date Id
Name: svn:eol-style
   + native

Added: grass/trunk/general/g.gui/description.html
===================================================================
--- grass/trunk/general/g.gui/description.html	                        (rev 0)
+++ grass/trunk/general/g.gui/description.html	2008-02-11 12:33:40 UTC (rev 30080)
@@ -0,0 +1,35 @@
+<h2>DESCRIPTION</h2>
+
+<p>
+This program allows user to start 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>
+</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.
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="wxGUI.html">wxPython based new generation GUI</a>,
+<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>
+</em>
+
+
+<h2>AUTHOR</h2>
+
+Martin Landa, FBK-irst, Trento, Italy
+
+<p>
+<i>$Date$</i>


Property changes on: grass/trunk/general/g.gui/description.html
___________________________________________________________________
Name: svn:mime-type
   + text/html
Name: svn:keywords
   + Author Date Id
Name: svn:eol-style
   + native

Added: grass/trunk/general/g.gui/main.c
===================================================================
--- grass/trunk/general/g.gui/main.c	                        (rev 0)
+++ grass/trunk/general/g.gui/main.c	2008-02-11 12:33:40 UTC (rev 30080)
@@ -0,0 +1,73 @@
+/****************************************************************************
+ *
+ * MODULE:       g.gui
+ *
+ * AUTHOR(S):    Martin Landa <landa.martin gmail.com>
+ *
+ * PURPOSE:      Start GRASS GUI from command line.
+ *
+ * COPYRIGHT:    (C) 2008 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
+ *               for details.
+ *
+ *****************************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+
+int main(int argc, char *argv[])
+{
+    struct Option *type;
+    struct GModule *module;
+    char *gui_type_env;
+
+    G_gisinit(argv[0]);
+
+    module = G_define_module();
+    module->keywords = _("general, gui");
+    module->description =
+	_("Starts GRASS graphical user interface (GUI).");
+
+    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";
+    gui_type_env = G__getenv("GRASS_GUI");
+    if (gui_type_env && strcmp(gui_type_env, "text")) {
+	type->answer = G_store(gui_type_env);
+    }
+    else {
+	type->answer = "tcltk";
+    }
+
+    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);
+	    G_setenv("GRASS_GUI", type->answer);
+	}
+    }
+
+    if (strcmp(type->answer, "oldtcltk") == 0) {
+	G_system("d.m");
+    }
+    else if (strcmp(type->answer, "tcltk") == 0) {
+	G_system("gis.m");
+    }
+    else if (strcmp(type->answer, "wxpython") == 0) {
+	G_system("wxgui");
+    }
+
+    exit(EXIT_SUCCESS);
+}


Property changes on: grass/trunk/general/g.gui/main.c
___________________________________________________________________
Name: svn:mime-type
   + text/x-csrc
Name: svn:keywords
   + Author Date Id
Name: svn:eol-style
   + native



More information about the grass-commit mailing list