diff --git a/adafruit-circuitpython-display-text-DSX_CUSTOM_MAR172020.tar.gz b/adafruit-circuitpython-display-text-DSX_CUSTOM_MAR172020.tar.gz index 938961b05..3fc33f13a 100644 Binary files a/adafruit-circuitpython-display-text-DSX_CUSTOM_MAR172020.tar.gz and b/adafruit-circuitpython-display-text-DSX_CUSTOM_MAR172020.tar.gz differ diff --git a/src/base_circuitpython/displayio/group.py b/src/base_circuitpython/displayio/group.py index b1c6000b1..17109b03a 100644 --- a/src/base_circuitpython/displayio/group.py +++ b/src/base_circuitpython/displayio/group.py @@ -39,24 +39,23 @@ def append(self, item): self.__contents.append(item) item.parent = self + self.elem_changed() - self.__elem_changed() - - def __elem_changed(self): + def elem_changed(self): # Ensure that this group is what the board is currently showing. # Otherwise, don't bother to draw it. - if ( - self.__auto_write - and self.__check_active_group_ref - and board.DISPLAY.active_group == self - ): + if self.__auto_write: + self.trigger_draw() + + def trigger_draw(self): + # select the correct parent to draw from if necessary + if self.__check_active_group_ref and board.DISPLAY.active_group == self: self.draw() elif self.in_group: - # If a sub-group is modified, propagate to top level to # see if one of the parents are the current active group. - self.parent.__elem_changed() + self.parent.elem_changed() def __getitem__(self, index): return self.__contents[index] @@ -65,9 +64,8 @@ def __setitem__(self, index, val): old_val = self.__contents[index] self.__contents[index] = val - if old_val != val: - self.__elem_changed() + self.elem_changed() def draw(self, img=None, x=0, y=0, scale=None, show=True): # this function is not a part of the orignal implementation @@ -136,5 +134,5 @@ def __len__(self): def pop(self, i=-1): item = self.__contents.pop(i) item.parent = None - self.__elem_changed() + self.elem_changed() return item diff --git a/src/clue/adafruit_clue.py b/src/clue/adafruit_clue.py index 3a8ecbb1f..82639d61c 100644 --- a/src/clue/adafruit_clue.py +++ b/src/clue/adafruit_clue.py @@ -115,7 +115,7 @@ def __init__( if font: self._font = font self.text_group = displayio.Group(max_size=20, scale=text_scale) - + self.text_scale = text_scale if title: # Fail gracefully if title is longer than 60 characters. if len(title) > 60: @@ -130,7 +130,7 @@ def __init__( ) title.x = 0 title.y = 8 - self._y = title.y + 18 + self._y = title.y + 18 * text_scale self.text_group.append(title) else: @@ -154,7 +154,7 @@ def add_text_line(self, color=0xFFFFFF): text_label = self._label.Label(self._font, text="", max_glyphs=45, color=color) text_label.x = 0 text_label.y = self._y - self._y = text_label.y + 13 + self._y = text_label.y + 13 * self.text_scale self.text_group.append(text_label) return text_label diff --git a/src/process_user_code.py b/src/process_user_code.py index e5e72d36b..1287fc241 100644 --- a/src/process_user_code.py +++ b/src/process_user_code.py @@ -52,8 +52,7 @@ from adafruit_clue import clue from base_circuitpython.base_cp_constants import CLUE -from base_circuitpython import terminal_handler -from base_circuitpython import board +import board # get handle to terminal for clue curr_terminal = board.DISPLAY.terminal