fastled 1.1.21__py2.py3-none-any.whl → 1.1.23__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastled/__init__.py +1 -1
- fastled/app.py +202 -197
- fastled/client_server.py +7 -6
- fastled/docker_manager.py +530 -526
- fastled/keyboard.py +8 -6
- fastled/select_sketch_directory.py +35 -0
- fastled/string_diff.py +37 -0
- {fastled-1.1.21.dist-info → fastled-1.1.23.dist-info}/METADATA +5 -1
- {fastled-1.1.21.dist-info → fastled-1.1.23.dist-info}/RECORD +13 -11
- {fastled-1.1.21.dist-info → fastled-1.1.23.dist-info}/LICENSE +0 -0
- {fastled-1.1.21.dist-info → fastled-1.1.23.dist-info}/WHEEL +0 -0
- {fastled-1.1.21.dist-info → fastled-1.1.23.dist-info}/entry_points.txt +0 -0
- {fastled-1.1.21.dist-info → fastled-1.1.23.dist-info}/top_level.txt +0 -0
fastled/keyboard.py
CHANGED
@@ -2,8 +2,8 @@ import os
|
|
2
2
|
import select
|
3
3
|
import sys
|
4
4
|
import time
|
5
|
-
from
|
6
|
-
from
|
5
|
+
from queue import Empty, Queue
|
6
|
+
from threading import Thread
|
7
7
|
|
8
8
|
_WHITE_SPACE = [" ", "\r", "\n"]
|
9
9
|
|
@@ -27,7 +27,7 @@ class SpaceBarWatcher:
|
|
27
27
|
def __init__(self) -> None:
|
28
28
|
self.queue: Queue = Queue()
|
29
29
|
self.queue_cancel: Queue = Queue()
|
30
|
-
self.process =
|
30
|
+
self.process = Thread(target=self._watch_for_space, daemon=True)
|
31
31
|
self.process.start()
|
32
32
|
|
33
33
|
def _watch_for_space(self) -> None:
|
@@ -81,16 +81,14 @@ class SpaceBarWatcher:
|
|
81
81
|
key = self.queue.get(block=False, timeout=0.1)
|
82
82
|
if key == ord(" "):
|
83
83
|
found = True
|
84
|
+
self.queue.task_done()
|
84
85
|
except Empty:
|
85
86
|
break
|
86
87
|
return found
|
87
88
|
|
88
89
|
def stop(self) -> None:
|
89
90
|
self.queue_cancel.put(True)
|
90
|
-
self.process.terminate()
|
91
91
|
self.process.join()
|
92
|
-
self.queue.close()
|
93
|
-
self.queue.join_thread()
|
94
92
|
|
95
93
|
|
96
94
|
def main() -> None:
|
@@ -98,10 +96,14 @@ def main() -> None:
|
|
98
96
|
try:
|
99
97
|
while True:
|
100
98
|
if watcher.space_bar_pressed():
|
99
|
+
print("Space bar hit!")
|
101
100
|
break
|
102
101
|
time.sleep(1)
|
103
102
|
finally:
|
103
|
+
print("Stopping watcher.")
|
104
104
|
watcher.stop()
|
105
|
+
print("Watcher stopped.")
|
106
|
+
return
|
105
107
|
|
106
108
|
|
107
109
|
if __name__ == "__main__":
|
@@ -0,0 +1,35 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
from fastled.string_diff import string_diff_paths
|
4
|
+
|
5
|
+
|
6
|
+
def select_sketch_directory(
|
7
|
+
sketch_directories: list[Path], cwd_is_fastled: bool
|
8
|
+
) -> str | None:
|
9
|
+
if cwd_is_fastled:
|
10
|
+
exclude = ["src", "dev", "tests"]
|
11
|
+
for ex in exclude:
|
12
|
+
p = Path(ex)
|
13
|
+
if p in sketch_directories:
|
14
|
+
sketch_directories.remove(p)
|
15
|
+
|
16
|
+
if len(sketch_directories) == 1:
|
17
|
+
print(f"\nUsing sketch directory: {sketch_directories[0]}")
|
18
|
+
return str(sketch_directories[0])
|
19
|
+
elif len(sketch_directories) > 1:
|
20
|
+
print("\nMultiple Directories found, choose one:")
|
21
|
+
for i, sketch_dir in enumerate(sketch_directories):
|
22
|
+
print(f" [{i+1}]: {sketch_dir}")
|
23
|
+
which = input("\nPlease specify a sketch directory: ").strip()
|
24
|
+
try:
|
25
|
+
index = int(which) - 1
|
26
|
+
return str(sketch_directories[index])
|
27
|
+
except (ValueError, IndexError):
|
28
|
+
inputs = [p for p in sketch_directories]
|
29
|
+
top_hits: list[tuple[int, Path]] = string_diff_paths(which, inputs)
|
30
|
+
if len(top_hits) == 1:
|
31
|
+
example = top_hits[0][1]
|
32
|
+
return str(example)
|
33
|
+
else:
|
34
|
+
return select_sketch_directory([p for _, p in top_hits], cwd_is_fastled)
|
35
|
+
return None
|
fastled/string_diff.py
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
from rapidfuzz.distance import Levenshtein
|
4
|
+
|
5
|
+
|
6
|
+
# Returns the min distance strings. If there is a tie, it returns
|
7
|
+
# all the strings that have the same min distance.
|
8
|
+
# Returns a tuple of index and string.
|
9
|
+
def string_diff(
|
10
|
+
input_string: str, string_list: list[str], ignore_case=True
|
11
|
+
) -> list[tuple[int, str]]:
|
12
|
+
|
13
|
+
def normalize(s: str) -> str:
|
14
|
+
return s.lower() if ignore_case else s
|
15
|
+
|
16
|
+
distances = [
|
17
|
+
Levenshtein.distance(normalize(input_string), normalize(s)) for s in string_list
|
18
|
+
]
|
19
|
+
min_distance = min(distances)
|
20
|
+
out: list[tuple[int, str]] = []
|
21
|
+
for i, d in enumerate(distances):
|
22
|
+
if d == min_distance:
|
23
|
+
out.append((i, string_list[i]))
|
24
|
+
return out
|
25
|
+
|
26
|
+
|
27
|
+
def string_diff_paths(
|
28
|
+
input_string: str | Path, path_list: list[Path], ignore_case=True
|
29
|
+
) -> list[tuple[int, Path]]:
|
30
|
+
string_list = [str(p) for p in path_list]
|
31
|
+
tmp = string_diff(str(input_string), string_list, ignore_case)
|
32
|
+
# out: list[tuple[int, Path]] = [(i, Path(path_list[j])) for i, j in tmp]
|
33
|
+
out: list[tuple[int, Path]] = []
|
34
|
+
for i, j in tmp:
|
35
|
+
p = Path(j)
|
36
|
+
out.append((i, p))
|
37
|
+
return out
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.23
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -18,6 +18,7 @@ Requires-Dist: download
|
|
18
18
|
Requires-Dist: filelock
|
19
19
|
Requires-Dist: disklru>=2.0.1
|
20
20
|
Requires-Dist: appdirs
|
21
|
+
Requires-Dist: rapidfuzz
|
21
22
|
|
22
23
|
# FastLED Wasm compiler
|
23
24
|
|
@@ -31,6 +32,7 @@ Compiles an Arduino/Platformio sketch into a wasm binary that can be run directl
|
|
31
32
|
[](https://github.com/zackees/fastled-wasm/actions/workflows/test_win.yml)
|
32
33
|
|
33
34
|
|
35
|
+
|
34
36
|
# About
|
35
37
|
|
36
38
|
This python app will compile your FastLED style sketches into html/js/wasm output that runs directly in the browser.
|
@@ -161,6 +163,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
|
|
161
163
|
|
162
164
|
# Revisions
|
163
165
|
|
166
|
+
* 1.1.23 - Various fixes for MacOS
|
167
|
+
* 1.1.22 - Selecting sketch now allows strings and narrowing down paths if ambiguity
|
164
168
|
* 1.1.21 - Now always watches for space/enter key events to trigger a recompile.
|
165
169
|
* 1.1.20 - Fixed a regression for 1.1.16 involving docker throwing an exception before DockerManager.is_running() could be called so it can be launched.
|
166
170
|
* 1.1.19 - Automatically does a limit searches for sketch directories if you leave it blank.
|
@@ -1,23 +1,25 @@
|
|
1
|
-
fastled/__init__.py,sha256=
|
2
|
-
fastled/app.py,sha256=
|
1
|
+
fastled/__init__.py,sha256=IEm_Rn25u4jkMLkK9nn2bAU9Aq8ya6w4CcUXAy889IQ,64
|
2
|
+
fastled/app.py,sha256=VZP65zT1qLQLcOXA8oElPdZiladIAMvW9MVnqy5QTRM,6806
|
3
3
|
fastled/build_mode.py,sha256=joMwsV4K1y_LijT4gEAcjx69RZBoe_KmFmHZdPYbL_4,631
|
4
4
|
fastled/cli.py,sha256=CNR_pQR0sNVPNuv8e_nmm-0PI8sU-eUBUgnWgWkzW9c,237
|
5
|
-
fastled/client_server.py,sha256=
|
5
|
+
fastled/client_server.py,sha256=CBgicRyunn96tVeAHQOuo4q2gkDFAtLEPxhTf2EnQ_0,11113
|
6
6
|
fastled/compile_server.py,sha256=aBdpILSRrDsCJ5e9g5uwIqt9bcqE_8FrSddCV2ygtrI,5401
|
7
|
-
fastled/docker_manager.py,sha256=
|
7
|
+
fastled/docker_manager.py,sha256=Ur29DXoMpD5QFVmJJ0jYXWpbXaysoDv8a6-BRWKUJjA,20078
|
8
8
|
fastled/env.py,sha256=8wctQwl5qE4CI8NBugHtgMmUfEfHZ869JX5lGdSOJxc,304
|
9
9
|
fastled/filewatcher.py,sha256=5dVmjEG23kMeJa29tRVm5XKSr9sTD4ME2boo-CFDuUM,6910
|
10
|
-
fastled/keyboard.py,sha256=
|
10
|
+
fastled/keyboard.py,sha256=Zz_ggxOUTX2XQEy6K6kAoorVlUev4wEk9Awpvv9aStA,3241
|
11
11
|
fastled/open_browser.py,sha256=RRHcsZ5Vzsw1AuZUEYuSfjKmf_9j3NGMDUR-FndHmqs,1483
|
12
12
|
fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
|
13
|
+
fastled/select_sketch_directory.py,sha256=ih8Voua8ecMIZ9m0ZEBp_EuuBzz8xGfMxC_UhAKuoA0,1312
|
13
14
|
fastled/sketch.py,sha256=5nRjg281lMH8Bo9wKjbcpTQCfEP574ZCG-lukvFmyQ8,2656
|
15
|
+
fastled/string_diff.py,sha256=svtaQFGp4a6r2Qjx-Gxhna94wK-d8LKV4OCpKMXiHso,1164
|
14
16
|
fastled/types.py,sha256=dDIsGHJkHNJ7B61wNp6X0JSLs_nrHiq7RlNqNWbwFec,194
|
15
17
|
fastled/util.py,sha256=t4M3NFMhnCzfYbLvIyJi0RdFssZqbTN_vVIaej1WV-U,265
|
16
18
|
fastled/web_compile.py,sha256=KuvKGdX6SSUUqC7YgX4T9SMSP5wdcPUhpg9-K9zPoTI,10378
|
17
19
|
fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
|
18
|
-
fastled-1.1.
|
19
|
-
fastled-1.1.
|
20
|
-
fastled-1.1.
|
21
|
-
fastled-1.1.
|
22
|
-
fastled-1.1.
|
23
|
-
fastled-1.1.
|
20
|
+
fastled-1.1.23.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
21
|
+
fastled-1.1.23.dist-info/METADATA,sha256=owb8VnZ08wElA9muFhZM3FTqj1v3SDQxXcAHAvGxx08,14052
|
22
|
+
fastled-1.1.23.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
|
23
|
+
fastled-1.1.23.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
|
24
|
+
fastled-1.1.23.dist-info/top_level.txt,sha256=xfG6Z_ol9V5YmBROkZq2QTRwjbS2ouCUxaTJsOwfkOo,14
|
25
|
+
fastled-1.1.23.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|