wxGUI/mapwin: add map overlays 'at' parameter arg validation#1069
wxGUI/mapwin: add map overlays 'at' parameter arg validation#1069petrasovaa merged 5 commits intoOSGeo:masterfrom
Conversation
petrasovaa
left a comment
There was a problem hiding this comment.
This solution is very specific to d.legend (and some other d.* modules), I would rather go with the system of validators used in forms.py, that is already in place, see for example CoordinatesValidator as the closest example. The disadvantage is that with the current validators in forms you don't get any information what is wrong and I don't think it prevents you from trying to run the module. The widget background turns grey, that's all it does.
However, I would rather improve the system of validators in general than going with this too specialized solution. For this PR I would try to create a new validator (maybe generalize the coordinates validator, based on option's 'key_desc'). For future I would like to see better reporting of the problems, e.g. through an InfoBar in each module frame. The validator could call a callback with the message and the module form would show the infobar.
f6db125 to
cac364b
Compare
|
Fixed in the cac364b. |
Also removed focus when invalid since it selects all text in the textctrl and you can't keep typing
|
It didn't work for me, so I made some changes, see the commit message. If this works for you, feel free to merge it. |
Yes it work I tested many time before I send my commits. According wxPython doc Validate method has parent arg https://wxpython.org/Phoenix/docs/html/wx.Validator.html, this line is no needed. |
Weird, this is what I was getting: Any idea what could be going on here? |
Base class BaseValidator Validate method has missing parent (win) argument, commit 9515755. |
I didn't test it but shouldn't the classes derived from BaseValidator be updated as well? |
Yes of course you're right, I did it in the commit above. |
To Reproduce:
Steps to reproduce the behavior:
g.guiError message:
Expected behavior: