|
2 | 2 | import time |
3 | 3 | from ast import literal_eval as parse_tuple |
4 | 4 | from ovos_color_parser import color_from_description, sRGBAColor |
5 | | -# from difflib import SequenceMatcher |
6 | 5 | from ovos_utils import create_daemon, classproperty |
7 | 6 | from ovos_utils.log import LOG |
8 | 7 | from ovos_utils.process_utils import RuntimeRequirements |
@@ -30,37 +29,20 @@ def _hex_to_rgb(_hex): |
30 | 29 | except Exception: |
31 | 30 | return None |
32 | 31 |
|
33 | | - |
34 | | -# def fuzzy_match_color(color_a, color_dict): |
35 | | -# """ fuzzy match for colors |
36 | | -# |
37 | | -# Args: |
38 | | -# color_a (str): color as string |
39 | | -# color_dict (dict): dict with colors |
40 | | -# Returns: |
41 | | -# color: color from color_dict |
42 | | -# """ |
43 | | -# highest_ratio = float("-inf") |
44 | | -# _color = None |
45 | | -# for color, value in color_dict.items(): |
46 | | -# s = SequenceMatcher(None, color_a, color) |
47 | | -# if s.ratio() > highest_ratio: |
48 | | -# highest_ratio = s.ratio() |
49 | | -# _color = color |
50 | | -# if highest_ratio > 0.8: |
51 | | -# return _color |
52 | | -# else: |
53 | | -# return None |
54 | | - |
| 32 | +class EnclosureControlSkill(OVOSSkill): |
| 33 | + def __init__(self, *args, **kwargs): |
| 34 | + super().__init__(*args, **kwargs) |
| 35 | + self.handle_default_eyes() |
| 36 | + self.thread = None |
| 37 | + self.playing = False |
| 38 | + self.animations = [] |
55 | 39 |
|
56 | 40 | class EnclosureControlSkill(OVOSSkill): |
57 | 41 | def __init__(self, *args, **kwargs): |
58 | 42 | super().__init__(*args, **kwargs) |
59 | 43 | self.thread = None |
60 | 44 | self.playing = False |
61 | 45 | self.animations = [] |
62 | | - # self.brightness_dict = self.translate_namedvalues('brightness.levels') |
63 | | - # self.color_dict = self.translate_namedvalues('colors') |
64 | 46 | self.add_event('mycroft.eyes.default', self.handle_default_eyes) |
65 | 47 | self.add_event('mycroft.ready', self.handle_default_eyes) |
66 | 48 |
|
@@ -358,7 +340,6 @@ def handle_eye_color(self, message): |
358 | 340 | self.get_response('color.need')) |
359 | 341 | if color_str: |
360 | 342 | match = color_from_description(color_str) |
361 | | - # match = fuzzy_match_color(normalize(color_str), self.color_dict) |
362 | 343 | if match is not None: |
363 | 344 | default = False |
364 | 345 | if self.ask_yesno('set.default.eye.color') == 'yes': |
@@ -405,7 +386,6 @@ def _parse_to_rgb(self, color): |
405 | 386 | return _hex_to_rgb(color) |
406 | 387 |
|
407 | 388 | def handle_default_eyes(self): |
408 | | - LOG.info(self.settings.get('default_eye_color', "NONE")) |
409 | 389 | if self.settings.get('default_eye_color'): |
410 | 390 | self.set_eye_color(rgb=self.settings['default_eye_color'], speak=False) |
411 | 391 |
|
@@ -435,11 +415,6 @@ def parse_brightness(self, brightness): |
435 | 415 | """ |
436 | 416 |
|
437 | 417 | try: |
438 | | - # Handle "full", etc. |
439 | | - name = normalize(brightness) |
440 | | - # if name in self.brightness_dict: |
441 | | - # return self.brightness_dict[name] |
442 | | - |
443 | 418 | if '%' in brightness: |
444 | 419 | brightness = brightness.replace("%", "").strip() |
445 | 420 | return int(brightness) |
|
0 commit comments