Skip to content
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

Conversation

lindakarlovska
Copy link
Contributor

@lindakarlovska lindakarlovska commented Jul 16, 2020

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

@lindakarlovska lindakarlovska marked this pull request as draft July 16, 2020 15:21
@petrasovaa petrasovaa added gsoc Reserved for Google Summer of Code student(s) GUI wxGUI related labels Jul 16, 2020
@petrasovaa petrasovaa added this to In progress in New GUI Startup via automation Jul 16, 2020
@petrasovaa petrasovaa linked an issue Jul 16, 2020 that may be closed by this pull request
Comment on lines 374 to 378
# 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]
Copy link
Contributor

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

Copy link
Member

@wenzeslaus wenzeslaus left a 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.

@lindakarlovska lindakarlovska force-pushed the wxGUI-datacatalog-Allow-delete-on-multiple-mapsets-in-data-catalog branch from 3e79cc0 to 89ba913 Compare July 20, 2020 15:04
@lindakarlovska
Copy link
Contributor Author

lindakarlovska commented Jul 22, 2020

Now, it has only two possible results:

Current or pernament mapset means nothing is deleted:
Screenshot from 2020-07-22 09-54-33

Success:
Screenshot from 2020-07-22 09-56-28

gui/wxpython/gis_set.py Outdated Show resolved Hide resolved

# Check for permanent mapsets
if mapset == "PERMANENT":
issues.append(os.path.join(grassdb, location, mapset) +
Copy link
Contributor

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.

Copy link
Contributor Author

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.

gui/wxpython/startup/guiutils.py Outdated Show resolved Hide resolved
gui/wxpython/startup/guiutils.py Show resolved Hide resolved
gui/wxpython/startup/guiutils.py Outdated Show resolved Hide resolved
lindakladivova added 2 commits July 23, 2020 05:43
…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.
@lindakarlovska lindakarlovska force-pushed the wxGUI-datacatalog-Allow-delete-on-multiple-mapsets-in-data-catalog branch from 9b7a9e8 to 06accf4 Compare July 23, 2020 11:12
@lindakarlovska lindakarlovska marked this pull request as ready for review July 23, 2020 11:14
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.
@wenzeslaus wenzeslaus merged commit 0bf0220 into OSGeo:master Jul 24, 2020
New GUI Startup automation moved this from PRs in progress to Done Jul 24, 2020
@neteler neteler added this to the 8.0.0 milestone Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc Reserved for Google Summer of Code student(s) GUI wxGUI related
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

[Feat] Allow delete on multiple mapsets in data catalog
4 participants