[GRASS-SVN] r66918 - in grass/trunk: general/g.gui lib/init
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 24 14:11:34 PST 2015
Author: martinl
Date: 2015-11-24 14:11:34 -0800 (Tue, 24 Nov 2015)
New Revision: 66918
Modified:
grass/trunk/general/g.gui/main.c
grass/trunk/lib/init/grass.py
Log:
Exit GRASS from GUI (see r66917) - implement also for g.gui
Modified: grass/trunk/general/g.gui/main.c
===================================================================
--- grass/trunk/general/g.gui/main.c 2015-11-24 21:56:53 UTC (rev 66917)
+++ grass/trunk/general/g.gui/main.c 2015-11-24 22:11:34 UTC (rev 66918)
@@ -29,7 +29,7 @@
struct Option *type, *rc_file;
struct Flag *update_ui, *fglaunch, *nolaunch;
struct GModule *module;
- const char *gui_type_env;
+ const char *gui_type_env, *shell_pid;
char progname[GPATH_MAX];
char *desc;
@@ -103,6 +103,8 @@
exit(EXIT_SUCCESS);
}
+ shell_pid = G_getenv_nofatal("PID");
+
sprintf(progname, "%s/gui/wxpython/wxgui.py", G_gisbase());
if (access(progname, F_OK) == -1)
G_fatal_error(_("Your installation doesn't include GUI, exiting."));
@@ -111,22 +113,22 @@
G_message(_("Launching <%s> GUI, please wait..."), type->answer);
if (rc_file->answer) {
G_spawn_ex(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"), progname,
- "--workspace", rc_file->answer, NULL);
+ "--workspace", rc_file->answer, "--pid", shell_pid, NULL);
}
else {
G_spawn_ex(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"), progname,
- NULL);
+ "--pid", shell_pid, NULL);
}
}
else {
G_message(_("Launching <%s> GUI in the background, please wait..."), type->answer);
if (rc_file->answer) {
G_spawn_ex(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"), progname,
- "--workspace", rc_file->answer, SF_BACKGROUND, NULL);
+ "--workspace", rc_file->answer, "--pid", shell_pid, SF_BACKGROUND, NULL);
}
else {
G_spawn_ex(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"), progname,
- SF_BACKGROUND, NULL);
+ "--pid", shell_pid, SF_BACKGROUND, NULL);
}
/* stop the impatient from starting it again
before the splash screen comes up */
Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py 2015-11-24 21:56:53 UTC (rev 66917)
+++ grass/trunk/lib/init/grass.py 2015-11-24 22:11:34 UTC (rev 66918)
@@ -1901,6 +1901,9 @@
mapset_settings.location)
start_gui(grass_gui, shell_process.pid)
+ kv = read_gisrc(gisrc)
+ kv['PID'] = str(shell_process.pid)
+ write_gisrc(kv, gisrc)
exit_val = shell_process.wait()
if exit_val != 0:
warning(_("Failed to start shell '%s'") % os.getenv('SHELL'))
More information about the grass-commit
mailing list