Fix#289: Validate subset name for database#448
Conversation
|
Maybe this is helping the users too much, but maybe the "Invalid subset name..." message could tell the users which characters are invalid? |
|
Yeah, I thought about that, too. But seems complex to implement 😟 |
|
Hmm since the "Create" button gets invalidated, it might not be a must have. Great work! |
|
Haha, turns out it's not that hard :P What do you think ? |
|
Amazing! |
|
Wait, it seems that |
|
Looks great! |
BigRoy
left a comment
There was a problem hiding this comment.
From an artist/interface perspective this looks good to me. Code-wise I only had some questions, because it seems quite an amount of lines of code for the visual result. It looks good though.
| Separator = "---separator---" | ||
|
|
||
|
|
||
| class SubsetNameValidator(QtGui.QRegExpValidator): |
There was a problem hiding this comment.
To be sure, the only reason we require to define our own class is so we can report to the user which characters were invalidated in particular. Correct? If so, then this class is fine. Otherwise, this seems redundant.
There was a problem hiding this comment.
Correct?
Not entirely, the main reason I subclass the QtGui.QRegExpValidator was to re-implement the function validate, so that I could emit a signal when the input has invalid character. I could not find any built-in way to implement this notification on QLineEdit, it just works silently.
Reporting which characters exactly were invalid was something I picked up on the way :)
There was a problem hiding this comment.
Ah. If you only wanted to have the invalid signal, it's QLineEdit.inputRejected but it won't signal what characters were invalid I believe + it's only been introduced since Qt 5.12 so I guess we can't rely on it.
I guess currently subclassing like this really is the only way.
avalon/tools/creator/app.py
Outdated
| self.setToolTip("Only alphanumeric characters (A-Z a-z 0-9), " | ||
| "'_' and '.' are allowed.") | ||
|
|
||
| self._cstatus = None |
There was a problem hiding this comment.
Not sure if there's enough reason to abbrevaite _color_status to _cstatus. I don't mind it. Just wondering.
There was a problem hiding this comment.
Hmm, this should be improved for reading.
|
I love it! |
|
Well merge this tomorrow ! |



This PR resolve #289, Creator will ensure the subset name is valid for MongoDB.
What's changed?