]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/commitdiff
starting set root group. show none also
authorfoamyguy <foamyguy@gmail.com>
Thu, 8 Dec 2022 02:40:45 +0000 (20:40 -0600)
committerfoamyguy <foamyguy@gmail.com>
Thu, 8 Dec 2022 02:40:45 +0000 (20:40 -0600)
displayio/_display.py
displayio/_displaycore.py

index da94fb2bc433a8f0c769cffc1af70256b26f749f..1e429954a9851a16196f783e506299cf0c9997e9 100644 (file)
@@ -272,6 +272,11 @@ class Display:
             )  # pylint: disable=protected-access
             # save image to buffer (or probably refresh buffer so we can compare)
             self._buffer.paste(buffer)
+        else:
+            # show nothing
+            print("show nothing")
+            buffer = Image.new("RGBA", (self._core._width, self._core._height))
+            self._buffer.paste(buffer)
 
         self._subrectangles = self._core.get_refresh_areas()
 
@@ -452,3 +457,11 @@ class Display:
     def bus(self) -> _DisplayBus:
         """Current Display Bus"""
         return self._core.get_bus()
+
+    @property
+    def root_group(self) -> Group:
+        return self._current_group
+
+    @root_group.setter
+    def root_group(self, new_group):
+        self._current_group = new_group
\ No newline at end of file
index a50d094fb656a20bb4b75396490855fda378ffc2..3753b3ccd8ca5fbea8d49c696cbce778a11b8678 100644 (file)
@@ -187,6 +187,45 @@ class _DisplayCore:
         self._current_group = root_group
         self._full_refresh = True
 
+        print(f"end of show: {root_group}")
+        return True
+
+    def set_root_group(self, root_group: Group) -> bool:
+        # pylint: disable=protected-access
+
+        """
+        Switches to displaying the given group of layers. When group is `None`, the
+        default CircuitPython terminal will be shown.
+
+        :param Optional[displayio.Group] root_group: The group to show.
+        """
+
+        """
+        # TODO: Implement Supervisor
+        if root_group is None:
+            circuitpython_splash = _Supervisor().circuitpython_splash
+            if not circuitpython_splash._in_group:
+                root_group = circuitpython_splash
+            elif self._current_group == circuitpython_splash:
+                return True
+        """
+
+        if root_group == self._current_group:
+            return True
+
+        if root_group is not None and root_group._in_group:
+            return False
+
+        if self._current_group is not None:
+            self._current_group._in_group = False
+
+        if root_group is not None:
+            root_group._update_transform(self._transform)
+            root_group._in_group = True
+
+        self._current_group = root_group
+        self._full_refresh = True
+
         return True
 
     def start_refresh(self) -> bool: