mctrl 0.1.0__tar.gz

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.
Files changed (69) hide show
  1. mctrl-0.1.0/.gitignore +10 -0
  2. mctrl-0.1.0/.vscode/launch.json +22 -0
  3. mctrl-0.1.0/Makefile +92 -0
  4. mctrl-0.1.0/PKG-INFO +692 -0
  5. mctrl-0.1.0/README.md +674 -0
  6. mctrl-0.1.0/config.toml +219 -0
  7. mctrl-0.1.0/mindcontrol/__init__.py +10 -0
  8. mctrl-0.1.0/mindcontrol/__main__.py +4 -0
  9. mctrl-0.1.0/mindcontrol/app.py +432 -0
  10. mctrl-0.1.0/mindcontrol/autotune.py +493 -0
  11. mctrl-0.1.0/mindcontrol/calibrate.py +199 -0
  12. mctrl-0.1.0/mindcontrol/capture.py +159 -0
  13. mctrl-0.1.0/mindcontrol/config.py +243 -0
  14. mctrl-0.1.0/mindcontrol/control/__init__.py +1 -0
  15. mctrl-0.1.0/mindcontrol/control/bridge.py +360 -0
  16. mctrl-0.1.0/mindcontrol/control/events.py +34 -0
  17. mctrl-0.1.0/mindcontrol/control/keyboard.py +101 -0
  18. mctrl-0.1.0/mindcontrol/control/modes.py +194 -0
  19. mctrl-0.1.0/mindcontrol/control/mouse.py +256 -0
  20. mctrl-0.1.0/mindcontrol/debug_view.py +188 -0
  21. mctrl-0.1.0/mindcontrol/devices.py +222 -0
  22. mctrl-0.1.0/mindcontrol/filters.py +95 -0
  23. mctrl-0.1.0/mindcontrol/fusion.py +240 -0
  24. mctrl-0.1.0/mindcontrol/geometry.py +200 -0
  25. mctrl-0.1.0/mindcontrol/gestures/__init__.py +1 -0
  26. mctrl-0.1.0/mindcontrol/gestures/engine.py +465 -0
  27. mctrl-0.1.0/mindcontrol/logs.py +87 -0
  28. mctrl-0.1.0/mindcontrol/models.py +59 -0
  29. mctrl-0.1.0/mindcontrol/pipeline.py +376 -0
  30. mctrl-0.1.0/mindcontrol/record.py +454 -0
  31. mctrl-0.1.0/mindcontrol/replay.py +193 -0
  32. mctrl-0.1.0/mindcontrol/session.py +328 -0
  33. mctrl-0.1.0/mindcontrol/tracking/__init__.py +1 -0
  34. mctrl-0.1.0/mindcontrol/tracking/gaze.py +272 -0
  35. mctrl-0.1.0/mindcontrol/tracking/hands.py +102 -0
  36. mctrl-0.1.0/native/Package.swift +35 -0
  37. mctrl-0.1.0/native/Sources/Bridge/main.swift +7 -0
  38. mctrl-0.1.0/native/Sources/BridgeCore/Cursor.swift +145 -0
  39. mctrl-0.1.0/native/Sources/BridgeCore/Motion.swift +508 -0
  40. mctrl-0.1.0/native/Sources/BridgeCore/Overlay.swift +149 -0
  41. mctrl-0.1.0/native/Sources/BridgeCore/Probe.swift +457 -0
  42. mctrl-0.1.0/native/Sources/BridgeCore/Protocol.swift +96 -0
  43. mctrl-0.1.0/native/Sources/BridgeCore/Run.swift +218 -0
  44. mctrl-0.1.0/native/Sources/BridgeCore/Solitary.swift +116 -0
  45. mctrl-0.1.0/native/Sources/BridgeCore/Targets.swift +272 -0
  46. mctrl-0.1.0/native/Sources/BridgeCore/Transport.swift +118 -0
  47. mctrl-0.1.0/native/Sources/BridgeCore/Tuning.swift +134 -0
  48. mctrl-0.1.0/native/Tests/BridgeCoreTests/ProtocolTests.swift +187 -0
  49. mctrl-0.1.0/native/Tests/BridgeCoreTests/TargetSelectionTests.swift +275 -0
  50. mctrl-0.1.0/packaging/build_app.sh +113 -0
  51. mctrl-0.1.0/packaging/dmg_background.py +97 -0
  52. mctrl-0.1.0/packaging/icns.sh +35 -0
  53. mctrl-0.1.0/packaging/icon.py +312 -0
  54. mctrl-0.1.0/packaging/identity.sh +32 -0
  55. mctrl-0.1.0/packaging/launcher.c +165 -0
  56. mctrl-0.1.0/packaging/launcher.sh +29 -0
  57. mctrl-0.1.0/packaging/make_dmg.sh +99 -0
  58. mctrl-0.1.0/pyproject.toml +52 -0
  59. mctrl-0.1.0/tests/conftest.py +243 -0
  60. mctrl-0.1.0/tests/test_autotune.py +113 -0
  61. mctrl-0.1.0/tests/test_bridge.py +371 -0
  62. mctrl-0.1.0/tests/test_filters.py +66 -0
  63. mctrl-0.1.0/tests/test_geometry.py +112 -0
  64. mctrl-0.1.0/tests/test_gestures.py +319 -0
  65. mctrl-0.1.0/tests/test_logs.py +103 -0
  66. mctrl-0.1.0/tests/test_record_script.py +63 -0
  67. mctrl-0.1.0/tests/test_replay_synthetic.py +329 -0
  68. mctrl-0.1.0/tests/test_session_replay.py +272 -0
  69. mctrl-0.1.0/uv.lock +654 -0
mctrl-0.1.0/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ .ruff_cache/
5
+ build/
6
+ dist/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ # Swift build products for the native helper in native/.
10
+ .build/
@@ -0,0 +1,22 @@
1
+ {
2
+ "configurations": [
3
+ {
4
+ "type": "lldb",
5
+ "request": "launch",
6
+ "args": [],
7
+ "cwd": "${workspaceFolder:mindcontrol}/native",
8
+ "name": "Debug mindcontrol-bridge (native)",
9
+ "program": "${workspaceFolder:mindcontrol}/native/.build/debug/mindcontrol-bridge",
10
+ "preLaunchTask": "swift: Build Debug mindcontrol-bridge (native)"
11
+ },
12
+ {
13
+ "type": "lldb",
14
+ "request": "launch",
15
+ "args": [],
16
+ "cwd": "${workspaceFolder:mindcontrol}/native",
17
+ "name": "Release mindcontrol-bridge (native)",
18
+ "program": "${workspaceFolder:mindcontrol}/native/.build/release/mindcontrol-bridge",
19
+ "preLaunchTask": "swift: Build Release mindcontrol-bridge (native)"
20
+ }
21
+ ]
22
+ }
mctrl-0.1.0/Makefile ADDED
@@ -0,0 +1,92 @@
1
+ # Building, installing and updating MindControl.app.
2
+ #
3
+ # make app first build, and after changing dependencies (minutes)
4
+ # make update push this project into the installed app (seconds)
5
+ # make dmg cut the installer
6
+ #
7
+ # A certificate on the keychain is used if there is one, which is what keeps the
8
+ # Camera, Accessibility and Menu Bar grants across builds; SIGN_IDENTITY overrides
9
+ # it, with "-" forcing ad-hoc. See packaging/identity.sh for why that matters.
10
+
11
+ APP := build/MindControl.app
12
+ INSTALLED := /Applications/MindControl.app
13
+ PY := $(APP)/Contents/Resources/python/bin/python3
14
+ BRIDGE := native/.build/release/mindcontrol-bridge
15
+ LOG := $(HOME)/.local/state/mindcontrol/app.log
16
+ SIGN := $(shell packaging/identity.sh)
17
+
18
+ .DEFAULT_GOAL := help
19
+ .PHONY: help app icon refresh install update dmg run stop restart logs permissions lint test clean uninstall
20
+
21
+ help: ## list what this can do
22
+ @grep -hE '^[a-z][a-z-]*:.*##' $(MAKEFILE_LIST) \
23
+ | awk -F':.*## ' '{printf " \033[1;35m%-12s\033[0m %s\n", $$1, $$2}'
24
+
25
+ # Anything that edits the bundle needs one to exist first.
26
+ $(APP):
27
+ packaging/build_app.sh
28
+
29
+ app: ## build the bundle from scratch: its own CPython, every pinned dependency
30
+ packaging/build_app.sh
31
+
32
+ refresh: | $(APP) ## rebuild only this project and the native helper into the bundle
33
+ @$(PY) -m pip install --quiet --no-input --disable-pip-version-check \
34
+ --no-deps --force-reinstall .
35
+ @if [ -f native/Package.swift ] && swift build -c release --package-path native >/dev/null; then \
36
+ cp $(BRIDGE) $(APP)/Contents/MacOS/mindcontrol-bridge; \
37
+ else \
38
+ echo " helper unchanged: nothing new built"; \
39
+ fi
40
+ @packaging/launcher.sh $(APP)
41
+ @codesign --force --deep --sign '$(SIGN)' $(APP) 2>/dev/null \
42
+ || echo " could not sign as '$(SIGN)'"
43
+ @echo "refreshed $(APP)"
44
+
45
+ icon: | $(APP) ## re-render the icon into the bundle
46
+ @PYTHON=$(PY) packaging/icns.sh $(APP)/Contents/Resources/MindControl.icns
47
+ @codesign --force --deep --sign '$(SIGN)' $(APP) 2>/dev/null || true
48
+
49
+ install: stop | $(APP) ## copy what changed into /Applications
50
+ @rsync -a --delete $(APP)/ $(INSTALLED)/
51
+ @touch $(INSTALLED)
52
+ @echo "installed $(INSTALLED)"
53
+
54
+ update: refresh install run ## refresh, reinstall and relaunch — the everyday one
55
+
56
+ dmg: | $(APP) ## cut dist/MindControl-<version>.dmg
57
+ packaging/make_dmg.sh
58
+
59
+ run: ## launch the installed app
60
+ @open -a $(INSTALLED)
61
+
62
+ stop: ## quit it, if it is running
63
+ @osascript -e 'quit app "MindControl"' >/dev/null 2>&1 || true
64
+ @pkill -f '$(INSTALLED)/Contents' >/dev/null 2>&1 || true
65
+ @sleep 1
66
+
67
+ restart: stop run ## bounce it
68
+
69
+ logs: ## follow what the app would have printed to a terminal
70
+ @tail -f -n 40 $(LOG)
71
+
72
+ permissions: ## open the Privacy and Menu Bar panes the app needs
73
+ @open 'x-apple.systempreferences:com.apple.preference.security?Privacy_Camera'
74
+ @sleep 1
75
+ @open 'x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility'
76
+ @sleep 1
77
+ @open 'x-apple.systempreferences:com.apple.ControlCenter-Settings.extension'
78
+
79
+ lint: ## ruff and shellcheck
80
+ uvx ruff check .
81
+ uvx ruff format --check .
82
+ @command -v shellcheck >/dev/null && shellcheck packaging/*.sh || echo "shellcheck not installed"
83
+
84
+ test: ## run the test suite
85
+ uv run pytest
86
+
87
+ uninstall: stop ## remove the installed app (permissions have to be revoked by hand)
88
+ @rm -rf $(INSTALLED)
89
+ @echo "removed $(INSTALLED)"
90
+
91
+ clean: ## drop build products
92
+ @rm -rf build dist