Skip to content

Commit

Permalink
Fix LangAltWidget validator bug
Browse files Browse the repository at this point in the history
PySide6 doesn't allow use of 'min' and 'max' on the QValidator.State
enum.
  • Loading branch information
jim-easterbrook committed Apr 13, 2023
1 parent c138cd6 commit 427d379
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/photini/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Full documentation is at https://photini.readthedocs.io/"""

__version__ = '2023.4.0.1'
build = '2662 (916ba2d)'
build = '2663 (c138cd6)'
10 changes: 6 additions & 4 deletions src/photini/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,10 +878,12 @@ def validate(self, text, pos):
if len(parts) > 2:
return QtGui.QValidator.State.Invalid, text, pos
result = self.lat_validator.validate(parts[0], pos)[0]
if len(parts) > 1:
result = min(result, self.lng_validator.validate(parts[1], pos)[0])
else:
result = min(result, QtGui.QValidator.State.Intermediate)
if result != QtGui.QValidator.State.Invalid and len(parts) > 1:
lng_result = self.lng_validator.validate(parts[1], pos)[0]
if lng_result == QtGui.QValidator.State.Invalid:
result = lng_result
elif result == QtGui.QValidator.State.Acceptable:
result = lng_result
return result, text, pos

@catch_all
Expand Down

0 comments on commit 427d379

Please sign in to comment.