Skip to content

Commit

Permalink
Merge pull request #168 from jim-easterbrook/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
jim-easterbrook committed Apr 13, 2023
2 parents 4d91194 + 427d379 commit ee0bd42
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions 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'
build = '2660 (f95a287)'
__version__ = '2023.4.0.1'
build = '2663 (c138cd6)'
2 changes: 0 additions & 2 deletions src/photini/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
9 changes: 3 additions & 6 deletions src/photini/technical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions src/photini/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -879,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 Expand Up @@ -934,13 +935,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
Expand Down

0 comments on commit ee0bd42

Please sign in to comment.