Skip to content

Commit

Permalink
Merge branch 'LedFx:main' into webaudio-base64
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusCZ authored Jan 6, 2024
2 parents ae04a50 + 3a095ad commit ecb31ab
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 312 deletions.
47 changes: 0 additions & 47 deletions .devcontainer/Dockerfile

This file was deleted.

63 changes: 0 additions & 63 deletions .devcontainer/Dockerfile.pip

This file was deleted.

42 changes: 0 additions & 42 deletions .devcontainer/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions .devcontainer/dev-apt-install.sh

This file was deleted.

82 changes: 0 additions & 82 deletions .devcontainer/devcontainer.json

This file was deleted.

12 changes: 0 additions & 12 deletions .devcontainer/ledfx-config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ledfx/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
)
from ledfx.http_manager import HttpServer
from ledfx.integrations import Integrations
from ledfx.mdns_manager import ZeroConfRunner
from ledfx.presets import ledfx_presets
from ledfx.scenes import Scenes
from ledfx.utils import (
Expand All @@ -38,7 +39,6 @@
currently_frozen,
)
from ledfx.virtuals import Virtuals
from ledfx.zeroconf import ZeroConfRunner

_LOGGER = logging.getLogger(__name__)
if currently_frozen():
Expand Down
1 change: 1 addition & 0 deletions ledfx/devices/adalight.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ def flush(self, data):
_LOGGER.critical(
"Serial Connection Interrupted. Please check connections and ensure your device is functioning correctly."
)
self.deactivate()
48 changes: 48 additions & 0 deletions ledfx/effects/gifbase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import logging
from enum import Enum

import voluptuous as vol
from PIL import Image

from ledfx.effects import Effect

_LOGGER = logging.getLogger(__name__)


class GIFResizeMethods(Enum):
# https://pillow.readthedocs.io/en/stable/handbook/concepts.html#filters-comparison-table
NEAREST = "Fastest"
BILINEAR = "Fast"
BICUBIC = "Slow"
LANCZOS = "Slowest"


@Effect.no_registration
class GifBase(Effect):
"""
Simple Gif base class that supplies basic gif and resize capability.
"""

RESIZE_METHOD_MAPPING = {
GIFResizeMethods.NEAREST.value: Image.NEAREST,
GIFResizeMethods.BILINEAR.value: Image.BILINEAR,
GIFResizeMethods.BICUBIC.value: Image.BICUBIC,
GIFResizeMethods.LANCZOS.value: Image.LANCZOS,
}

CONFIG_SCHEMA = vol.Schema(
{
vol.Optional(
"resize_method",
description="What strategy to use when resizing GIF",
default=GIFResizeMethods.BICUBIC.value,
): vol.In(
[resize_method.value for resize_method in GIFResizeMethods]
),
}
)

def config_updated(self, config):
self.resize_method = self.RESIZE_METHOD_MAPPING[
self._config["resize_method"]
]
Loading

0 comments on commit ecb31ab

Please sign in to comment.