Skip to content

Add colorwheel effect, refactor library #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Feb 27, 2022
Merged
Prev Previous commit
Reformatted and linted per pre-commit
  • Loading branch information
tekktrik committed Feb 23, 2022
commit e22535e757b0a7be0628dbf796d5ce844085bac9
4 changes: 2 additions & 2 deletions displayio_effects/colorwheel_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
COLORWHEEL_COLORS = cycle([colorwheel(color_value) for color_value in range(256)])


def get_widget_value(instance):
def _get_widget_value(instance):
widget_type = getattr(instance, WIDGET_TYPE_ATTR)
return COLORWHEEL_WIDGET_VALUES[widget_type]

Expand Down Expand Up @@ -81,7 +81,7 @@ def hook_colorwheel_effect(widget_class, widget_type):
def update_colorwheel(self):
"""Updates the widget value and propagates the fluctuation effect refresh"""

palette_map = get_widget_value(self)
palette_map = _get_widget_value(self)
palette_attr = self
for attr_path in palette_map["path"]:
palette_attr = getattr(palette_attr, attr_path)
Expand Down
7 changes: 4 additions & 3 deletions displayio_effects/fluctuation_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
WidgetType.GAUGE: "level",
}

def get_value_name(instance):

def _get_value_name(instance):
widget_type = getattr(instance, WIDGET_TYPE_ATTR)
return FLUCTUATION_WIDGET_VALUES[widget_type]

Expand All @@ -48,7 +49,7 @@ def fluctuation_amplitude(self):

@fluctuation_amplitude.setter
def fluctuation_amplitude(self, amplitude):
value_name = get_value_name(self)
value_name = _get_value_name(self)
if amplitude < 0:
raise ValueError("Fluctuation effect setting must be larger than 0")
if amplitude:
Expand All @@ -72,7 +73,7 @@ def fluctuation_move_rate(self, rate):
def update_fluctuation(self):
"""Updates the widget value and propagates the fluctuation effect refresh"""

value_name = get_value_name(self)
value_name = _get_value_name(self)

if self._fluctuation_amplitude == 0:
self._fluctuation_destination = None
Expand Down