Skip to content

Commit

Permalink
Fixed merge request??
Browse files Browse the repository at this point in the history
  • Loading branch information
jake1164 committed Nov 30, 2024
2 parents ae84eef + 8734f5d commit 4631403
Show file tree
Hide file tree
Showing 37 changed files with 1,165 additions and 154 deletions.
2 changes: 1 addition & 1 deletion src/code.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# UPDATE the settings.toml file before starting!

# Following are imported from circuitpython 8.x
# Following are imported from circuitpython 9.x
import os
import gc
import board
Expand Down
8 changes: 8 additions & 0 deletions src/lib/adafruit_bitmap_font/bdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@
from fontio import Glyph
from .glyph_cache import GlyphCache

<<<<<<< HEAD
__version__ = "2.1.1"
=======
<<<<<<< HEAD
__version__ = "2.1.3"
=======
__version__ = "2.1.1"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font.git"


Expand Down
8 changes: 8 additions & 0 deletions src/lib/adafruit_bitmap_font/bitmap_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@
except ImportError:
pass

<<<<<<< HEAD
__version__ = "2.1.1"
=======
<<<<<<< HEAD
__version__ = "2.1.3"
=======
__version__ = "2.1.1"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font.git"


Expand Down
8 changes: 8 additions & 0 deletions src/lib/adafruit_bitmap_font/glyph_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@

import gc

<<<<<<< HEAD
__version__ = "2.1.1"
=======
<<<<<<< HEAD
__version__ = "2.1.3"
=======
__version__ = "2.1.1"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font.git"


Expand Down
8 changes: 8 additions & 0 deletions src/lib/adafruit_bus_device/i2c_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
pass


<<<<<<< HEAD
__version__ = "5.2.8"
=======
<<<<<<< HEAD
__version__ = "5.2.10"
=======
__version__ = "5.2.8"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git"


Expand Down
10 changes: 9 additions & 1 deletion src/lib/adafruit_bus_device/spi_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
pass


<<<<<<< HEAD
__version__ = "5.2.8"
=======
<<<<<<< HEAD
__version__ = "5.2.10"
=======
__version__ = "5.2.8"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git"


Expand Down Expand Up @@ -89,7 +97,7 @@ def __init__(
self.chip_select = chip_select
self.cs_active_value = cs_active_value
if self.chip_select:
self.chip_select.switch_to_output(value=True)
self.chip_select.switch_to_output(value=not self.cs_active_value)

def __enter__(self) -> SPI:
while not self.spi.try_lock():
Expand Down
16 changes: 10 additions & 6 deletions src/lib/adafruit_display_text/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
=======================
"""

<<<<<<< HEAD
__version__ = "3.1.0"
=======
<<<<<<< HEAD
__version__ = "3.2.0"
=======
__version__ = "3.1.0"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"

from displayio import Group, Palette
Expand Down Expand Up @@ -246,7 +254,6 @@ def __init__(
tab_replacement: Tuple[int, str] = (4, " "),
label_direction: str = "LTR",
verbose: bool = False,
**kwargs, # pylint: disable=unused-argument
) -> None:
# pylint: disable=too-many-arguments, too-many-locals

Expand All @@ -271,9 +278,6 @@ def __init__(
self._tab_text = self._tab_replacement[1] * self._tab_replacement[0]
self._verbose = verbose

if "max_glyphs" in kwargs:
print("Please update your code: 'max_glyphs' is not needed anymore.")

self._ascent, self._descent = self._get_ascent_descent()
self._bounding_box = None

Expand Down Expand Up @@ -428,12 +432,12 @@ def bounding_box(self) -> Tuple[int, int]:
@property
def height(self) -> int:
"""The height of the label determined from the bounding box."""
return self._bounding_box[3] - self._bounding_box[1]
return self._bounding_box[3]

@property
def width(self) -> int:
"""The width of the label determined from the bounding box."""
return self._bounding_box[2] - self._bounding_box[0]
return self._bounding_box[2]

@property
def line_spacing(self) -> float:
Expand Down
25 changes: 20 additions & 5 deletions src/lib/adafruit_display_text/bitmap_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@
"""

<<<<<<< HEAD
__version__ = "3.1.0"
=======
<<<<<<< HEAD
__version__ = "3.2.0"
=======
__version__ = "3.1.0"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"

import displayio
Expand Down Expand Up @@ -183,6 +191,10 @@ def _reset_text(
if self._background_tight:
box_y = tight_box_y
y_offset = tight_y_offset
self._padding_left = 0
self._padding_right = 0
self._padding_top = 0
self._padding_bottom = 0

else: # calculate the box size for a loose background
box_y = loose_box_y
Expand Down Expand Up @@ -288,15 +300,18 @@ def _line_spacing_ypixels(font: FontProtocol, line_spacing: float) -> int:
def _text_bounding_box(
self, text: str, font: FontProtocol
) -> Tuple[int, int, int, int, int, int]:
# pylint: disable=too-many-locals
# pylint: disable=too-many-locals,too-many-branches

ascender_max, descender_max = self._ascent, self._descent
bbox = font.get_bounding_box()
if len(bbox) == 4:
ascender_max, descender_max = bbox[1], -bbox[3]
else:
ascender_max, descender_max = self._ascent, self._descent

lines = 1

xposition = (
x_start
) = yposition = y_start = 0 # starting x and y position (left margin)
# starting x and y position (left margin)
xposition = x_start = yposition = y_start = 0

left = None
right = x_start
Expand Down
8 changes: 8 additions & 0 deletions src/lib/adafruit_display_text/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
"""

<<<<<<< HEAD
__version__ = "3.1.0"
=======
<<<<<<< HEAD
__version__ = "3.2.0"
=======
__version__ = "3.1.0"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"


Expand Down
8 changes: 8 additions & 0 deletions src/lib/adafruit_display_text/outlined_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
https://circuitpython.org/downloads
"""
<<<<<<< HEAD
__version__ = "3.1.0"
=======
<<<<<<< HEAD
__version__ = "3.2.0"
=======
__version__ = "3.1.0"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"

import bitmaptools
Expand Down
36 changes: 24 additions & 12 deletions src/lib/adafruit_display_text/scrolling_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@
"""

<<<<<<< HEAD
__version__ = "3.1.0"
=======
<<<<<<< HEAD
__version__ = "3.2.0"
=======
__version__ = "3.1.0"
>>>>>>> ae84eef1491903d49de0e32510d1ab243185d8ff
>>>>>>> origin/update_dependencies
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"

import time
import adafruit_ticks
from adafruit_display_text import bitmap_label

try:
Expand Down Expand Up @@ -66,7 +74,7 @@ def __init__(
self._last_animate_time = -1
self.max_characters = max_characters

if text[-1] != " ":
if text and text[-1] != " ":
text = "{} ".format(text)
self._full_text = text

Expand All @@ -81,10 +89,13 @@ def update(self, force: bool = False) -> None:
Default is False.
:return: None
"""
_now = time.monotonic()
if force or self._last_animate_time + self.animate_time <= _now:
_now = adafruit_ticks.ticks_ms()
if force or adafruit_ticks.ticks_less(
self._last_animate_time + int(self.animate_time * 1000), _now
):
if len(self.full_text) <= self.max_characters:
super()._set_text(self.full_text, self.scale)
if self._text != self.full_text:
super()._set_text(self.full_text, self.scale)
self._last_animate_time = _now
return

Expand Down Expand Up @@ -120,10 +131,10 @@ def current_index(self) -> int:

@current_index.setter
def current_index(self, new_index: int) -> None:
if new_index < len(self.full_text):
self._current_index = new_index
else:
if self.full_text:
self._current_index = new_index % len(self.full_text)
else:
self._current_index = 0

@property
def full_text(self) -> str:
Expand All @@ -136,11 +147,12 @@ def full_text(self) -> str:

@full_text.setter
def full_text(self, new_text: str) -> None:
if new_text[-1] != " ":
if new_text and new_text[-1] != " ":
new_text = "{} ".format(new_text)
self._full_text = new_text
self.current_index = 0
self.update()
if new_text != self._full_text:
self._full_text = new_text
self.current_index = 0
self.update(True)

@property
def text(self):
Expand Down
Loading

0 comments on commit 4631403

Please sign in to comment.