-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Enable Window support, Add fit StatUSB consumer * Fix lint issue * Switch to brandnew busylight exceptions * Switch to serial based filtering * Use acquire over is_pluggedin * Use vendor namespacing for each consumer * Fix name in test reporter * Fix status * Make it uniform * Revert "Make it uniform" This reverts commit b3bc1a8. * Make it uniform * Refactor producers aswell * Fix CI * Fix CI * Fix CI * Fix CI * Fix CI
- Loading branch information
Showing
235 changed files
with
1,061 additions
and
571 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
from .core import process | ||
|
||
__all__ =\ | ||
[ | ||
'agile_innovative_blinkstick', | ||
'elgato_streamdeck', | ||
'embrava_blynclight', | ||
'kuando_busylight', | ||
'lifx_light', | ||
'luxafor_flag', | ||
'magic_hue', | ||
'nanoleaf_light', | ||
'philips_hue', | ||
'razer_chroma', | ||
'thingm_blink1', | ||
'wiz_light', | ||
'xiaomi_yeelight' | ||
] | ||
ALL = \ | ||
{ | ||
'agile_innovative.blinkstick': 'chroma_feedback.consumer.agile_innovative.blinkstick', | ||
'compulab_fit.statusb': 'chroma_feedback.consumer.compulab_fit.statusb', | ||
'elgato.streamdeck': 'chroma_feedback.consumer.elgato.streamdeck', | ||
'embrava.blynclight': 'chroma_feedback.consumer.embrava.blynclight', | ||
'kuando.busylight': 'chroma_feedback.consumer.kuando.busylight', | ||
'lifx': 'chroma_feedback.consumer.lifx.lifx', | ||
'luxafor.flag': 'chroma_feedback.consumer.luxafor.flag', | ||
'magic.hue': 'chroma_feedback.consumer.magic.hue', | ||
'nanoleaf': 'chroma_feedback.consumer.nanoleaf.nanoleaf', | ||
'philips.hue': 'chroma_feedback.consumer.philips.hue', | ||
'razer.chroma': 'chroma_feedback.consumer.razer.chroma', | ||
'signify.wiz': 'chroma_feedback.consumer.signify.wiz', | ||
'thingm.blink1': 'chroma_feedback.consumer.thingm.blink1', | ||
'xiaomi.yeelight': 'chroma_feedback.consumer.xiaomi.yeelight' | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import sys | ||
from typing import Any | ||
|
||
from chroma_feedback import logger, wording | ||
|
||
API = None | ||
|
||
|
||
def get_api() -> Any: | ||
global API | ||
|
||
if not API: | ||
API = api_factory() | ||
return API | ||
|
||
|
||
def api_factory() -> Any: | ||
try: | ||
from busylight.lights import NoLightsFound, LightUnavailable | ||
from busylight.lights.compulap import Fit_StatUSB as api | ||
|
||
try: | ||
api.first_light().acquire() | ||
except (NoLightsFound, LightUnavailable): | ||
logger.error(wording.get('connection_not_found').format('compulab_fit.statusb') + wording.get('exclamation_mark')) | ||
sys.exit() | ||
return api | ||
except ImportError: | ||
logger.error(wording.get('package_not_found').format('busylight-for-humans') + wording.get('exclamation_mark')) | ||
sys.exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import sys | ||
from argparse import ArgumentParser | ||
from typing import List | ||
|
||
from chroma_feedback import helper, logger, wording | ||
from chroma_feedback.typing import Consumer, ProducerReport | ||
from .light import filter_lights, get_lights, process_lights | ||
|
||
ARGS = None | ||
|
||
|
||
def support() -> bool: | ||
return helper.is_linux() is True or helper.is_mac() is True or helper.is_windows() is True | ||
|
||
|
||
def init(program : ArgumentParser) -> None: | ||
global ARGS | ||
|
||
if not ARGS: | ||
program.add_argument('--compulab-fit-statusb-light-serial', action = 'append') | ||
ARGS = helper.get_first(program.parse_known_args()) | ||
|
||
|
||
def run(producer_report : List[ProducerReport]) -> List[Consumer]: | ||
light = filter_lights(get_lights(), ARGS.compulab_fit_statusb_light_serial) | ||
|
||
if not light: | ||
logger.error(wording.get('device_not_found') + wording.get('exclamation_mark')) | ||
sys.exit() | ||
return process_lights(light, producer_report) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import copy | ||
from typing import Any, List | ||
|
||
from chroma_feedback import color, helper, reporter | ||
from chroma_feedback.typing import Color, Consumer, ProducerReport, Status | ||
from .api import get_api | ||
|
||
LIGHTS = None | ||
|
||
|
||
def get_lights() -> Any: | ||
global LIGHTS | ||
|
||
if not LIGHTS: | ||
LIGHTS = get_api().all_lights() | ||
return LIGHTS | ||
|
||
|
||
def filter_lights(lights : Any, light_serials : List[str]) -> Any: | ||
if light_serials: | ||
for light in copy.copy(lights): | ||
if light.info['serial_number'] not in light_serials: | ||
lights.remove(light) | ||
return lights | ||
|
||
|
||
def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List[Consumer]: | ||
result : List[Consumer] = [] | ||
status : Status = reporter.resolve_report_status(producer_report) | ||
|
||
# process lights | ||
|
||
for light in lights: | ||
if set_light(light, color.get_by_status(status)): | ||
result.append( | ||
{ | ||
'name': 'compulab_fit.statusb', | ||
'type': 'light', | ||
'description': helper.create_description(light.info['product_string'], light.info['serial_number']), | ||
'status': status | ||
}) | ||
return result | ||
|
||
|
||
def set_light(light : Any, color_config : Color) -> bool: | ||
light.on(tuple(color_config['rgb'])) | ||
return light.is_on is True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.