Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
44d6aed
Raise an error if a required method if not overridden when called
lesamouraipourpre Jul 8, 2021
381a890
Remove references to 'max_glyphs' from __init__ and bitmap_label, it …
lesamouraipourpre Jul 8, 2021
60590f1
Refactor line_spacing
lesamouraipourpre Jul 8, 2021
9552fdc
Refactor background_tight
lesamouraipourpre Jul 8, 2021
64a7d3e
Refactor x & y
lesamouraipourpre Jul 8, 2021
889679e
Refactor padding
lesamouraipourpre Jul 8, 2021
6eb5dd0
Refactor padding
lesamouraipourpre Jul 8, 2021
ff473a4
Refactor save_text
lesamouraipourpre Jul 8, 2021
31ad121
Refactor tab_replacement
lesamouraipourpre Jul 8, 2021
b259e6b
Refactor label_direction
lesamouraipourpre Jul 9, 2021
c4d43e2
Refactor color, background_color & palette
lesamouraipourpre Jul 9, 2021
fb75d66
Refactor base_alignment
lesamouraipourpre Jul 9, 2021
4bef392
Refactor anchor_point & anchored_position
lesamouraipourpre Jul 9, 2021
3f9a6b6
Refactor max_glyphs away (Closes #131)
lesamouraipourpre Jul 9, 2021
48357d4
Refactor local_group to a protected variable.
lesamouraipourpre Jul 9, 2021
068599c
Remove and update all pylint disables
lesamouraipourpre Jul 9, 2021
aedccd9
Reduce unnecessary kwarg usage
lesamouraipourpre Jul 10, 2021
915b360
Minor tweaks to advanced example
lesamouraipourpre Jul 10, 2021
95a822a
Refactor label __init__
lesamouraipourpre Jul 10, 2021
46fec3a
Refactor baseline
lesamouraipourpre Jul 10, 2021
d557cf8
Refactor bitmap
lesamouraipourpre Jul 10, 2021
a001c02
Refactor width & height
lesamouraipourpre Jul 10, 2021
5014b3d
Refactor tilegrid
lesamouraipourpre Jul 10, 2021
58c6644
Refactor boolean to bool
lesamouraipourpre Jul 10, 2021
fbe1fbd
Tweak the PyPortal example to specify the Font directory
lesamouraipourpre Jul 15, 2021
adddcf2
Add height & width properties to LabelBase
lesamouraipourpre Jul 15, 2021
b3acf4f
Print a message if max_glyphs is passed in
lesamouraipourpre Jul 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor save_text
  • Loading branch information
lesamouraipourpre committed Jul 8, 2021
commit ff473a48d323508fb9578a5d40648b883a862ef9
3 changes: 0 additions & 3 deletions adafruit_display_text/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ class LabelBase(Group):
:param (int,int) anchored_position: Position relative to the anchor_point. Tuple
containing x,y pixel coordinates.
:param int scale: Integer value of the pixel scaling
:param bool save_text: Set True to save the text string as a constant in the
label structure. Set False to reduce memory use.
:param bool base_alignment: when True allows to align text label to the baseline.
This is helpful when two or more labels need to be aligned to the same baseline
:param (int,str) tab_replacement: tuple with tab character replace information. When
Expand All @@ -207,7 +205,6 @@ def __init__(
padding_right: int = 0,
anchor_point: Tuple[float, float] = None,
anchored_position: Tuple[int, int] = None,
save_text: bool = True, # can reduce memory use if save_text = False
scale: int = 1,
base_alignment: bool = False,
tab_replacement: Tuple[int, str] = (4, " "),
Expand Down
7 changes: 2 additions & 5 deletions adafruit_display_text/bitmap_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Label(LabelBase):
# pylint: disable=unused-argument, too-many-instance-attributes, too-many-locals, too-many-arguments
# pylint: disable=too-many-branches, no-self-use, too-many-statements

def __init__(self, font, **kwargs) -> None:
def __init__(self, font, save_text=True, **kwargs) -> None:

super().__init__(font, **kwargs)

Expand All @@ -94,6 +94,7 @@ def __init__(self, font, **kwargs) -> None:
self._tab_replacement = kwargs.get("tab_replacement", (4, " "))
self._tab_text = self._tab_replacement[1] * self._tab_replacement[0]
text = kwargs.get("text", "")
self._save_text = save_text
self._text = self._tab_text.join(text.split("\t"))

# Create the two-color palette
Expand All @@ -117,7 +118,6 @@ def __init__(self, font, **kwargs) -> None:
line_spacing=self._line_spacing,
anchor_point=kwargs.get("anchor_point", None),
anchored_position=kwargs.get("anchored_position", None),
save_text=kwargs.get("save_text", True),
scale=kwargs.get("scale", 1),
base_alignment=kwargs.get("base_alignment", False),
tab_replacement=kwargs.get("tab_replacement", (4, " ")),
Expand All @@ -131,7 +131,6 @@ def _reset_text(
line_spacing: float = None,
anchor_point: Tuple[float, float] = None,
anchored_position: Tuple[int, int] = None,
save_text: bool = None,
scale: int = None,
base_alignment: bool = None,
tab_replacement: Tuple[int, str] = None,
Expand All @@ -147,8 +146,6 @@ def _reset_text(
self._anchor_point = anchor_point
if anchored_position is not None:
self._anchored_position = anchored_position
if save_text is not None:
self._save_text = save_text
if base_alignment is not None:
self.base_alignment = base_alignment
if tab_replacement is not None:
Expand Down