[GRASS-dev] [GRASS GIS] #500: GUI menu item to swtich GUIs

#500: GUI menu item to swtich GUIs
-------------------------+--------------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
     Type: enhancement | Status: new
Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Keywords: gui | Platform: All
      Cpu: All |
-------------------------+--------------------------------------------------
Hi,

currently there is no easy way to switch the default GUI from a GUI.

e.g. from the native windows build you typically don't start from a
command prompt so `grass64 -wxpython` isn't an easy option. If you know
how you can do Config -> Settings -> GRASS working environment -> Change
settings -> GRASS variable to set -> "GRASS_GUI=wxpython"
in the GUI, but that's hardly something that someone could figure out on
their own.

To make this easier, I've added a new flag to g.gui to update default GUI
but do not launch it. (done in r35972, r35973)

The GUI menus would need to launch "g.gui -n --ui", or a wrapper fn for
g.gui (bash/python template: 'g.gui --script') with the -nu flags
hardcoded and only the type pulldown menu available. Then exit with a "you
need to restart grass to see the effect" message.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/500&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by hamish):

Hi,

I added a new g.change.gui wrapper script to develbr6 in r36027.

strangely it only works for me from the command line, which is not very
helpful as it is intended to be used from the GUI menu.

??
Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/500#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by hamish):

further g.change.gui & added to devbr6 menus in r36030.

please test! (especially to/from wxPy gui where I haven't tested it at
all)

note .grassrc6 file will only be updated when you exit GRASS cleanly, but
g.gisenv setting will be updated immediately. (earlier strangeness was
probably just me looking in the wrong place)

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/500#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by hamish):

more weirdness, I can't change it from the d.m GUI or from the command
prompt with --ui. But it works from from gis.m and the command line with
an argument.

I just get a red "X" in the output tab.

??
Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/500#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by hamish):

back/ported to relbr64 and trunk in r36093, r36094; weirdness remains: I
can't change it from the d.m GUI or from the command prompt with --ui
using g.change.gui.sh. But it works fine from from gis.m and the command
line with an argument.

In d.m I just get a red "X" in the output tab.

oh well, it works in d.m if I pass it plain g.gui instead of the
simplified g.change.gui.sh wrapper script (done in r36095, r36096), and I
doubt anyone will try `$GISBASE/etc/gui/scripts/g.change.gui.sh` very
often from the CLI as "g.gui" is somewhat easier to type.

shrug.
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/500#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by hamish):

ah, I understand the g.parser weirdness now. The script is not in the path
so it can't find itself when it goes to run the second pass.

I'll try a patch like:

{{{
if [ "$1" != "@ARGS_PARSED@" ] ; then
+ if [ ! -z `$0` ] ; then
+ PATH="$PATH:$GISBASE/etc/gui/scripts"
+ export PATH
+ fi
     exec g.parser "$0" "$@"
fi
}}}

(untested)

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/500#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by hamish):

I tried the following patch, it seemed to work from the commandline with
--ui, but still not from d.m.

{{{
Index: gui/scripts/g.change.gui.sh

--- gui/scripts/g.change.gui.sh (revision 36060)
+++ gui/scripts/g.change.gui.sh (working copy)
@@ -41,6 +41,11 @@
      exit 1
  fi

+if [ ! -x "`which $(basename "$0")`" ] ; then
+ PATH="$PATH:$GISBASE/etc/gui/scripts"
+ export PATH
+fi
+
  if [ "$1" != "@ARGS_PARSED@" ] ; then
      exec g.parser "$0" "$@"
  fi
}}}

???

Running it from the wxPython GUI still needs to be tested by someone
please. Config -> Working enviro -> Change default GUI

Also, I was thinking it could be useful to add an entry after 'Help->About
system' like 'Help->Show system environment' which would run "set" and
dump the results to the Output window. It would help in debugging.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/500#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by cmbarton):

This works from the wxPython GUI--at least to switch to the current TclTK
GIS manager. I haven't tested with old dm.

Tested on Mac OSX Intel.

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/500#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by hamish):

not working in the latest wingrass installer, see bug #553.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/500#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#500: GUI menu item to swtich GUIs
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: closed
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: fixed | Keywords: gui
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Changes (by hamish):

  * status: new => closed
  * resolution: => fixed

Comment:

it's not working on wingrass, but it's a generic Makefile problem.

closing this ticket as it's done.

H

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/500#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>