From: James Carr Date: Thu, 1 Jul 2021 19:39:42 +0000 (+0100) Subject: Add an internal _set_scale method, so that the scale can still be set from X-Git-Tag: 0.6.2^2 X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka_Displayio.git/commitdiff_plain/a48d0f835022730cc570eb210406ea9f8ef2b149 Add an internal _set_scale method, so that the scale can still be set from the constructor even when the scale property is over-ridden in a subclass. Closes #64 --- diff --git a/displayio/group.py b/displayio/group.py index 3fd6809..e6deba8 100644 --- a/displayio/group.py +++ b/displayio/group.py @@ -46,10 +46,9 @@ class Group: self._hidden_group = False self._layers = [] self._supported_types = (TileGrid, Group) - self._absolute_transform = None self.in_group = False self._absolute_transform = Transform(0, 0, 1, 1, 1, False, False, False) - self.scale = scale # Set the scale via the setter + self._set_scale(scale) # Set the scale via the setter def update_transform(self, parent_transform): """Update the parent transform and child transforms""" @@ -164,6 +163,11 @@ class Group: @scale.setter def scale(self, value): + self._set_scale(value) + + def _set_scale(self, value): + # This is method allows the scale to be set by this class even when + # the scale property is over-ridden by a subclass. if not isinstance(value, int) or value < 1: raise ValueError("Scale must be >= 1") if self._scale != value: