Finalized

This commit is contained in:
regicidal.plutophage 2023-03-08 03:07:53 +03:00 committed by GitHub
parent 8c734e1952
commit f475adf23f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,33 +149,32 @@ class Oled(Extension):
for view in self._views: for view in self._views:
if self._dark is False: if self._dark is False:
if view[3] == self.split_side or view[3] is None: if view[4] == layer or view[4] is None:
if view[4] == layer or view[4] is None: if view[5] == OledEntryType.TXT:
if view[5] == OledEntryType.TXT: splash.append(
splash.append( label.Label(
label.Label( terminalio.FONT,
terminalio.FONT, text=view[0],
text=view[0], color=0xFFFFFF if not view[10] else 0x000000,
color=0xFFFFFF if not view[10] else 0x000000, background_color=0x000000
background_color=0x000000 if not view[10]
if not view[10] else 0xFFFFFF,
else 0xFFFFFF, anchor_point=(view[6], view[7]),
anchor_point=(view[6], view[7]), anchored_position=(view[1], view[2]),
anchored_position=(view[1], view[2]), label_direction=view[8],
label_direction=view[8], line_spacing=view[9],
line_spacing=view[9], padding_left=1,
padding_left=1,
)
) )
elif view[5] == OledEntryType.IMG: )
splash.append( elif view[5] == OledEntryType.IMG:
displayio.TileGrid( splash.append(
view[0], displayio.TileGrid(
pixel_shader=view[0].pixel_shader, view[0],
x=view[1], pixel_shader=view[0].pixel_shader,
y=view[2], x=view[1],
) y=view[2],
) )
)
gc.collect() gc.collect()
self._display.show(splash) self._display.show(splash)
@ -199,6 +198,11 @@ class Oled(Extension):
self._flip = self._flip_right self._flip = self._flip_right
else: else:
self.split_side = None self.split_side = None
for idx, view in enumerate(self._views):
if view[3] != self.split_side and view[3] is not None:
del self._views[idx]
displayio.release_displays() displayio.release_displays()
i2c = busio.I2C(keyboard.SCL, keyboard.SDA) i2c = busio.I2C(keyboard.SCL, keyboard.SDA)
self._display = adafruit_displayio_ssd1306.SSD1306( self._display = adafruit_displayio_ssd1306.SSD1306(