-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wxGUI: Allow delete on multiple mapsets in data catalog #795
wxGUI: Allow delete on multiple mapsets in data catalog #795
Conversation
gui/wxpython/startup/guiutils.py
Outdated
| # Removed last 2 letters in a string | ||
| if selected_pernament_str: | ||
| selected_pernament_str = selected_pernament_str[:-2] | ||
| if selected_successfully_str: | ||
| selected_successfully_str = selected_successfully_str[:-2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need this when using join
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good to give the user a specific error message. However, a careful balance between messages and amount and complexity of code (which will need to be maintained in the future) is needed. The question we need to ask is if there is any way to provide user with sufficiently specific messages using shorter and simpler code.
One way which should keep it shorter but provide same information is to generate message like this:
Cannot delete one or more mapsets for the following reasons:
/bla/bla/remote_sensing is a current mapset.
/bla/bla/PERMANENT is required for a valid location.
...
/foo/bar/PERMANENT is required for a valid location.
This is quite flexible in number of mapsets and kinds of error (we may add locked mapsets and mapsets not owned by the current user).
Another simplification can be not to allow any delete when one bad mapset is present. This may be even a more desired behavior since there was clearly some mistake when selecting, so it would be best to review the selection rather than proceed with deletion.
3e79cc0
to
89ba913
Compare
gui/wxpython/startup/guiutils.py
Outdated
|
|
||
| # Check for permanent mapsets | ||
| if mapset == "PERMANENT": | ||
| issues.append(os.path.join(grassdb, location, mapset) + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use format function as we discussed everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in the whole guiutils.py file.
…ich is called after selecting more mapsets. Checked possible cases of current or pernament mapset selection.
…neral both for more mapsets or for only one. Made a list with reasons for not deleting mapsets and if this list is not empty, warning message is displayed.
9b7a9e8
to
06accf4
Compare
Preserve the original delete_mapset_interactively function with the db/loc/mapset parameters as a wrapper of the new function. Return value indicates change/modification. Error on the first mapset is no change. Error in the middle is a change, but operation is interrupted, i.e. some possibly deleted and some not.


Added the function delete_mapsets_interactively which is called after selecting more mapsets. Checked possible cases of current or pernament mapset selection.