-
-
Notifications
You must be signed in to change notification settings - Fork 370
GUI: Included Mapvalidator in forms.py to check valid raster output names #6433
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
base: main
Are you sure you want to change the base?
Conversation
|
Thank you! It looks like it's preventing the dialog from running even if the name is correct. Looking back at the linked issue, I would go with a different approach more consistent with the current usage of validators in the tool dialogs, e.g. see how r.surf.fractal dialog deals with entering some letters instead of numbers in the dimension parameter - it will highlight the field. For that you need a slightly different validator, something like this would work (in gui_core/widgets.py): class MapNameValidator(BaseValidator):
"""Validator for map name input"""
def __init__(self):
BaseValidator.__init__(self)
def _validate(self, win):
"""Validate input"""
text = win.GetValue()
if text:
if not grass.legal_name(text):
self._notvalid()
return False
self._valid()
return True
def Clone(self):
"""Clone validator"""
return MapNameValidator()and then you just add it to https://github.com/OSGeo/grass/blob/main/gui/wxpython/gui_core/forms.py#L1511 |
…nd adding validator member to g.select.Select in forms.py
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.
Thanks, I changed it little bit to make it work.
|
Thank you @petrasovaa .. while you are here! Do you mind telling me some good documentation or just direct advice of how your grass suite of github actions work? And how you guys want python pull requests to be tested generally? Thank you for your help! |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
The actions run on all PRs, for new contributors we need to approve them (github policy). They test compilation, run tests (typically on tools, libraries), check formatting. Using pre-commit is recommended to get the formatting right (https://github.com/OSGeo/grass/blob/main/doc/development/style_guide.md#using-pre-commit). That was just a brief answer, so let me know if you have more questions. |
Description
Within the GUI, creating new raster maps with a required output name does not prompt the user of invalid character use on running the module. This feature has been applied already when creating a new vector map, with the MapValidator class within widgets.py. It was asked to use this MapValidator class to handle raster output names similarly in forms.py.
This pull request addresses issue #5978.
How has this been tested?
I overwrote the installation forms.py with my version and ran the GUI to check visually.