From 916ba2d25b8c8f00d23e84ebbf0be43c3c7c2ce0 Mon Sep 17 00:00:00 2001 From: Jim Easterbrook Date: Thu, 13 Apr 2023 09:20:54 +0100 Subject: [PATCH 1/3] Drop obsolete HighQualityAntialiasing flag It's not present in Qt6, something I should have spotted before doing a new release! --- src/photini/__init__.py | 4 ++-- src/photini/regions.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/photini/__init__.py b/src/photini/__init__.py index 77d4f121..6b8a05ee 100644 --- a/src/photini/__init__.py +++ b/src/photini/__init__.py @@ -1,4 +1,4 @@ """Full documentation is at https://photini.readthedocs.io/""" -__version__ = '2023.4.0' -build = '2660 (f95a287)' +__version__ = '2023.4.0.1' +build = '2661 (1ab398f)' diff --git a/src/photini/regions.py b/src/photini/regions.py index 0a7ccb35..1d467970 100644 --- a/src/photini/regions.py +++ b/src/photini/regions.py @@ -381,8 +381,6 @@ def __init__(self, *arg, **kw): super(ImageDisplayWidget, self).__init__(*arg, **kw) self.setRenderHint( QtGui.QPainter.RenderHint.Antialiasing, True) - self.setRenderHint( - QtGui.QPainter.RenderHint.HighQualityAntialiasing, True) self.setRenderHint( QtGui.QPainter.RenderHint.SmoothPixmapTransform, True) self.setScene(QtWidgets.QGraphicsScene()) From c138cd6317d6d1f6439623708f0bc7158bdce445 Mon Sep 17 00:00:00 2001 From: Jim Easterbrook Date: Thu, 13 Apr 2023 10:09:23 +0100 Subject: [PATCH 2/3] Fix MRO bug in spinbox mixin init calls PySide and PyQt behave differently with multiple inheritance, so it's only safe to make the Qt class last in the MRO. --- src/photini/__init__.py | 2 +- src/photini/technical.py | 9 +++------ src/photini/widgets.py | 10 ++++------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/photini/__init__.py b/src/photini/__init__.py index 6b8a05ee..d05cf8b3 100644 --- a/src/photini/__init__.py +++ b/src/photini/__init__.py @@ -1,4 +1,4 @@ """Full documentation is at https://photini.readthedocs.io/""" __version__ = '2023.4.0.1' -build = '2661 (1ab398f)' +build = '2662 (916ba2d)' diff --git a/src/photini/technical.py b/src/photini/technical.py index afd631d5..25143520 100644 --- a/src/photini/technical.py +++ b/src/photini/technical.py @@ -153,13 +153,12 @@ def data_to_text(self, lens_model): return lens_model.get_name() -class IntSpinBox(QtWidgets.QSpinBox, AugmentSpinBox): +class IntSpinBox(AugmentSpinBox, QtWidgets.QSpinBox): def __init__(self, key, *arg, **kw): self.default_value = 0 self.multiple = multiple_values() self._key = key super(IntSpinBox, self).__init__(*arg, **kw) - AugmentSpinBox.__init__(self) self.setSingleStep(1) lim = (2 ** 31) - 1 self.setRange(-lim, lim) @@ -201,7 +200,7 @@ def showEvent(self, event): return super(CalendarWidget, self).showEvent(event) -class DateTimeEdit(QtWidgets.QDateTimeEdit, AugmentDateTime): +class DateTimeEdit(AugmentDateTime, QtWidgets.QDateTimeEdit): def __init__(self, key, *arg, **kw): self.default_value = QtCore.QDateTime( QtCore.QDate.currentDate(), QtCore.QTime()) @@ -213,7 +212,6 @@ def __init__(self, key, *arg, **kw): self.textFromValue = self.textFromDateTime self.value = self.dateTime super(DateTimeEdit, self).__init__(*arg, **kw) - AugmentDateTime.__init__(self) self.setCalendarPopup(True) self.setCalendarWidget(CalendarWidget()) self.precision = 1 @@ -265,13 +263,12 @@ def set_precision(self, value): ' hh', ':mm', ':ss', '.zzz')[:self.precision])) -class TimeZoneWidget(QtWidgets.QSpinBox, AugmentSpinBox): +class TimeZoneWidget(AugmentSpinBox, QtWidgets.QSpinBox): def __init__(self, key, *arg, **kw): self.default_value = 0 self.multiple = multiple() self._key = key super(TimeZoneWidget, self).__init__(*arg, **kw) - AugmentSpinBox.__init__(self) self.setRange(-14 * 60, 15 * 60) self.setSingleStep(15) self.setWrapping(True) diff --git a/src/photini/widgets.py b/src/photini/widgets.py index 7cbacd02..ce046f80 100644 --- a/src/photini/widgets.py +++ b/src/photini/widgets.py @@ -704,11 +704,11 @@ def set_multiple(self, choices=[]): class AugmentSpinBoxBase(WidgetMixin): - def __init__(self): + def __init__(self, *arg, **kw): self._is_multiple = False self._prefix = '' self._suffix = '' - super(AugmentSpinBoxBase, self).__init__() + super(AugmentSpinBoxBase, self).__init__(*arg, **kw) if self.isRightToLeft(): self.setAlignment( Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter) @@ -820,13 +820,12 @@ def set_suffix(self, suffix): self.setSuffix(suffix) -class LatLongDisplay(QtWidgets.QAbstractSpinBox, AugmentSpinBox): +class LatLongDisplay(AugmentSpinBox, QtWidgets.QAbstractSpinBox): def __init__(self, *args, **kwds): self._key = ('exif:GPSLatitude', 'exif:GPSLongitude') self.default_value = '' self.multiple = multiple_values() super(LatLongDisplay, self).__init__(*args, **kwds) - AugmentSpinBox.__init__(self) self.lat_validator = QtGui.QDoubleValidator( -90.0, 90.0, 20, parent=self) self.lng_validator = QtGui.QDoubleValidator( @@ -934,13 +933,12 @@ def set_value_list(self, values): self.set_value(choices and choices.pop()) -class DoubleSpinBox(QtWidgets.QDoubleSpinBox, AugmentSpinBox): +class DoubleSpinBox(AugmentSpinBox, QtWidgets.QDoubleSpinBox): def __init__(self, key, *arg, **kw): self._key = key self.default_value = 0 self.multiple = multiple_values() super(DoubleSpinBox, self).__init__(*arg, **kw) - AugmentSpinBox.__init__(self) self.setSingleStep(0.1) self.setDecimals(4) lim = (2 ** 31) - 1 From 427d37995cae4f4d963b104a38a434dd4d1c05ac Mon Sep 17 00:00:00 2001 From: Jim Easterbrook Date: Thu, 13 Apr 2023 10:44:38 +0100 Subject: [PATCH 3/3] Fix LangAltWidget validator bug PySide6 doesn't allow use of 'min' and 'max' on the QValidator.State enum. --- src/photini/__init__.py | 2 +- src/photini/widgets.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/photini/__init__.py b/src/photini/__init__.py index d05cf8b3..b0822a24 100644 --- a/src/photini/__init__.py +++ b/src/photini/__init__.py @@ -1,4 +1,4 @@ """Full documentation is at https://photini.readthedocs.io/""" __version__ = '2023.4.0.1' -build = '2662 (916ba2d)' +build = '2663 (c138cd6)' diff --git a/src/photini/widgets.py b/src/photini/widgets.py index ce046f80..25e399b5 100644 --- a/src/photini/widgets.py +++ b/src/photini/widgets.py @@ -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