[GRASS-dev] [GRASS GIS] #3573: Save current working directory in wxGUI workspace and use it

#3573: Save current working directory in wxGUI workspace and use it
-----------------------------------------------+-------------------------
Reporter: wenzeslaus | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 8.0.0
Component: Startup | Version: unspecified
Keywords: workspace, recent, startup, wxGUI | CPU: Unspecified
Platform: Unspecified |
-----------------------------------------------+-------------------------
When user changes current working directory in GUI, saves workspace, and
reopens the same workspace, everything is there (especially after we have
#2604) but the current working directory is the system default.

The current working directory should be stored in the workspace and then
applied when starting.

It is not clear to me if only the GUI work dir should be changed or if
also the command line should be changed (if it is during startup, it
should be possible to change it for command line as well - considering
that we need to read the workspace file for #2604).

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

#3573: Save current working directory in wxGUI workspace and use it
--------------------------+-----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 8.0.0
Component: Startup | Version: unspecified
Resolution: | Keywords: workspace, recent, startup, wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------------------------

Comment (by mlennert):

Replying to [ticket:3573 wenzeslaus]:
> When user changes current working directory in GUI, saves workspace, and
reopens the same workspace, everything is there (especially after we have
#2604) but the current working directory is the system default.
>
> The current working directory should be stored in the workspace and then
applied when starting.
>
> It is not clear to me if only the GUI work dir should be changed or if
also the command line should be changed (if it is during startup, it
should be possible to change it for command line as well - considering
that we need to read the workspace file for #2604).

I have to admin that I never even noticed that we had this option. I find
this a bit weird, first of all because I don't know what the "current
working directory" actually means in GRASS GIS ? In the GUI I understand
it to mean the directory that is opened by default in any file system
widgets. Does it have any other effect ?

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

#3573: Save current working directory in wxGUI workspace and use it
--------------------------+-----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 8.0.0
Component: Startup | Version: unspecified
Resolution: | Keywords: workspace, recent, startup, wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------------------------

Comment (by wenzeslaus):

Replying to [comment:1 mlennert]:
> I have to admin that I never even noticed that we had this option.

Accessible from Setting or using cd command in the Console tab (you
basically get some consistency between terminal and Console tab).

> I find this a bit weird, first of all because I don't know what the
"current working directory" actually means in GRASS GIS?

It means just the same thing it means in the command line. Every program
has current working directory (or whatever we want to call it). `cd` and
`$PWD` or `pwd` in Linux command line, `os.getcwd()` and `os.chdir()` in
Python.

> In the GUI I understand it to mean the directory that is opened by
default in any file system widgets.

Right. (At least that's how it works on Linux.) I usually forget about
this behavior. This might be nice for some users and strange (but not
necessarily confusing) to some others.

> Does it have any other effect?

You can put all your files for import and all color tables for one project
into one directory (and perhaps subdirs) and then just cd there and you
don't need to use full path just a relative one. I guess that's clear, but
the point is that it applies for terminal as well as the GUI Console tab.
It is also advantageous when people are following commands in a list of
instructions - you need to deal with specifying the path just once (and
the exported files will be in the directory set at the beginning).

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

#3573: Save current working directory in wxGUI workspace and use it
--------------------------+-----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 8.0.0
Component: Startup | Version: unspecified
Resolution: | Keywords: workspace, recent, startup, wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------------------------

Comment (by wenzeslaus):

I meant to link #3575 not #2604 although that's also related.

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

#3573: Save current working directory in wxGUI workspace and use it
--------------------------+-----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 8.0.0
Component: Startup | Version: unspecified
Resolution: | Keywords: workspace, recent, startup, wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------------------------

Comment (by mlennert):

Replying to [comment:2 wenzeslaus]:
> Replying to [comment:1 mlennert]:
> > I have to admin that I never even noticed that we had this option.
>
> Accessible from Setting or using cd command in the Console tab (you
basically get some consistency between terminal and Console tab).

I don't know what you mean by consistency, but when I cd in the console
this (obviously) has no impact on the terminal pwd.

>
> > I find this a bit weird, first of all because I don't know what the
"current working directory" actually means in GRASS GIS?
>
> It means just the same thing it means in the command line. Every program
has current working directory (or whatever we want to call it). `cd` and
`$PWD` or `pwd` in Linux command line, `os.getcwd()` and `os.chdir()` in
Python.

Yes, but here we have to be careful to be clear that when we say
"program", we mean the GUI, not any GRASS module launched from anywhere.

>
> > In the GUI I understand it to mean the directory that is opened by
default in any file system widgets.
>
> Right. (At least that's how it works on Linux.) I usually forget about
this behavior. This might be nice for some users and strange (but not
necessarily confusing) to some others.

It is very nice, as I've had situations where I had to save multiple image
versions of the GUI screen into one directory and had to navigate to that
directory each time. Now I know that I can cd into that directory in the
console and thus make it the GUI's pwd. :slight_smile:

> > Does it have any other effect?
>
> You can put all your files for import and all color tables for one
project into one directory (and perhaps subdirs) and then just cd there
and you don't need to use full path just a relative one. I guess that's
clear, but the point is that it applies for terminal as well as the GUI
Console tab.

I don't know what you mean by "it applies" ? How ? IIUC your ticket, you
are pleading for that it should ? But this would only be for the situation
where the pwd is stored in a workspace, or ?

>It is also advantageous when people are following commands in a list of
instructions - you need to deal with specifying the path just once (and
the exported files will be in the directory set at the beginning).

But you have to be very careful to make sure that all commands are
executed either only in the console/GUI or only in the terminal...

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

#3573: Save current working directory in wxGUI workspace and use it
--------------------------+-----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 8.0.0
Component: Startup | Version: unspecified
Resolution: | Keywords: workspace, recent, startup, wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------------------------

Comment (by wenzeslaus):

Replying to [comment:4 mlennert]:
> Replying to [comment:2 wenzeslaus]:
> > Replying to [comment:1 mlennert]:
> > > I have to admin that I never even noticed that we had this option.
> >
> > Accessible from Setting or using cd command in the Console tab (you
basically get some consistency between terminal and Console tab).
>
> I don't know what you mean by consistency, but when I cd in the console
this (obviously) has no impact on the terminal pwd.

Consistency in that the directory can be changed both for terminal and for
the Console in GUI.

> > > I find this a bit weird, first of all because I don't know what the
"current working directory" actually means in GRASS GIS?
> >
> > It means just the same thing it means in the command line. Every
program has current working directory (or whatever we want to call it).
`cd` and `$PWD` or `pwd` in Linux command line, `os.getcwd()` and
`os.chdir()` in Python.
>
> Yes, but here we have to be careful to be clear that when we say
"program", we mean the GUI, not any GRASS module launched from anywhere.

That's definitively something we could improve: putting it to a better
place in menu, giving a better message when the change happens, ...

> > > Does it have any other effect?
> >
> > You can put all your files for import and all color tables for one
project into one directory (and perhaps subdirs) and then just cd there
and you don't need to use full path just a relative one. I guess that's
clear, but the point is that it applies for terminal as well as the GUI
Console tab.
>
> I don't know what you mean by "it applies" ? How ? IIUC your ticket, you
are pleading for that it should ? But this would only be for the situation
where the pwd is stored in a workspace, or ?

The functionality to change the directory is already in GUI, so the
benefits of it apply to GUI Console as well as terminal (where is it
natively).

This ticket is just for the storing and loading from workspace.

> >It is also advantageous when people are following commands in a list of
instructions - you need to deal with specifying the path just once (and
the exported files will be in the directory set at the beginning).
>
> But you have to be very careful to make sure that all commands are
executed either only in the console/GUI or only in the terminal...

I switch between them all the time, but I don't see beginners doing that.

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

#3573: Save current working directory in wxGUI workspace and use it
--------------------------+-----------------------------------------------
  Reporter: wenzeslaus | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 8.0.0
Component: Startup | Version: unspecified
Resolution: | Keywords: workspace, recent, startup, wxGUI
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------------------------

Comment (by wenzeslaus):

The triplet database/location/mapset is now (v7.7) saved in the workspace
(#3575). Adding also directory would give the user by opening a workspace
the full previously set state in relation to access to data (GRASS maps
and general files).

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