makcu 2.1.1__py3-none-any.whl → 2.1.3__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.
makcu/test_suite.py CHANGED
@@ -1,145 +1,145 @@
1
- import pytest
2
- import time
3
- from makcu import MouseButton
4
-
5
-
6
- TEST_BUTTONS = (MouseButton.LEFT, MouseButton.RIGHT, MouseButton.MIDDLE)
7
- BUTTON_STATE_KEYS = ('left', 'right', 'middle', 'mouse4', 'mouse5')
8
- MOVE_COORDS = ((10, 0), (0, 10), (-10, 0), (0, -10))
9
-
10
- def test_connect_to_port(makcu):
11
- print("Connecting to port...")
12
- makcu.connect()
13
- assert makcu.is_connected(), "Failed to connect to the makcu"
14
-
15
- def test_press_and_release(makcu):
16
- makcu.press(MouseButton.LEFT)
17
- makcu.release(MouseButton.LEFT)
18
-
19
- def test_firmware_version(makcu):
20
- version = makcu.mouse.get_firmware_version()
21
- assert version and len(version.strip()) > 0
22
-
23
- def test_middle_click(makcu):
24
- makcu.press(MouseButton.MIDDLE)
25
- makcu.release(MouseButton.MIDDLE)
26
-
27
- def test_device_info(makcu):
28
- print("Fetching device info...")
29
- info = makcu.mouse.get_device_info()
30
- print(f"Device Info: {info}")
31
- assert info.get("port")
32
- assert info.get("isConnected") is True
33
-
34
- def test_port_connection(makcu):
35
- assert makcu.is_connected()
36
-
37
- def test_button_mask(makcu):
38
- print("Getting button mask...")
39
- mask = makcu.get_button_mask()
40
- print(f"Mask value: {mask}")
41
- assert isinstance(mask, int)
42
-
43
- def test_get_button_states(makcu):
44
- states = makcu.get_button_states()
45
- assert isinstance(states, dict)
46
- for key in BUTTON_STATE_KEYS:
47
- assert key in states
48
-
49
- def test_lock_state(makcu):
50
- print("Locking LEFT button...")
51
- makcu.lock_left(True)
52
- print("Querying lock state while LEFT is locked...")
53
- state = makcu.is_locked(MouseButton.LEFT)
54
- print(state)
55
- assert state
56
-
57
- def test_makcu_behavior(makcu):
58
- makcu.move(25, 25)
59
- makcu.click(MouseButton.LEFT)
60
- makcu.scroll(-2)
61
-
62
- def test_batch_commands(makcu):
63
- print("Testing batch command execution (10 commands)...")
64
-
65
- start_time = time.perf_counter()
66
-
67
-
68
- makcu.move(10, 0)
69
- makcu.click(MouseButton.LEFT)
70
- makcu.move(0, 10)
71
- makcu.press(MouseButton.RIGHT)
72
- makcu.release(MouseButton.RIGHT)
73
- makcu.scroll(-1)
74
- makcu.move(-10, 0)
75
- makcu.click(MouseButton.MIDDLE)
76
- makcu.move(0, -10)
77
- makcu.scroll(1)
78
-
79
- end_time = time.perf_counter()
80
- elapsed_ms = (end_time - start_time) * 1000
81
-
82
- print(f"Batch execution time: {elapsed_ms:.2f}ms")
83
- print(f"Average per command: {elapsed_ms/10:.2f}ms")
84
-
85
-
86
- assert elapsed_ms < 50, f"Batch commands took {elapsed_ms:.2f}ms, expected < 50ms"
87
-
88
-
89
- start_time = time.perf_counter()
90
- for _ in range(10):
91
- makcu.move(5, 5)
92
- end_time = time.perf_counter()
93
-
94
- move_only_ms = (end_time - start_time) * 1000
95
- print(f"10 move commands: {move_only_ms:.2f}ms ({move_only_ms/10:.2f}ms per move)")
96
-
97
- def test_rapid_moves(makcu):
98
- start = time.perf_counter_ns()
99
-
100
-
101
- makcu.move(5, 5)
102
- makcu.move(5, 5)
103
- makcu.move(5, 5)
104
- makcu.move(5, 5)
105
- makcu.move(5, 5)
106
- makcu.move(5, 5)
107
- makcu.move(5, 5)
108
- makcu.move(5, 5)
109
- makcu.move(5, 5)
110
- makcu.move(5, 5)
111
-
112
- elapsed_ms = (time.perf_counter_ns() - start) / 1_000_000
113
- print(f"10 rapid moves: {elapsed_ms:.2f}ms")
114
- assert elapsed_ms < 30
115
-
116
- def test_button_performance(makcu):
117
- start = time.perf_counter_ns()
118
-
119
-
120
- for button in TEST_BUTTONS:
121
- makcu.press(button)
122
- makcu.release(button)
123
-
124
- elapsed_ms = (time.perf_counter_ns() - start) / 1_000_000
125
- print(f"Button operations: {elapsed_ms:.2f}ms")
126
- assert elapsed_ms < 20
127
-
128
- def test_mixed_operations(makcu):
129
- start = time.perf_counter_ns()
130
-
131
-
132
- makcu.move(20, 20)
133
- makcu.press(MouseButton.LEFT)
134
- makcu.move(-20, -20)
135
- makcu.release(MouseButton.LEFT)
136
- makcu.scroll(1)
137
-
138
- elapsed_ms = (time.perf_counter_ns() - start) / 1_000_000
139
- print(f"Mixed operations: {elapsed_ms:.2f}ms")
140
- assert elapsed_ms < 15
141
-
142
-
143
- @pytest.mark.skip(reason="Capture test disabled until firmware supports tracking clicks from software input")
144
- def test_capture_right_clicks(makcu):
1
+ import pytest
2
+ import time
3
+ from makcu import MouseButton
4
+
5
+
6
+ TEST_BUTTONS = (MouseButton.LEFT, MouseButton.RIGHT, MouseButton.MIDDLE)
7
+ BUTTON_STATE_KEYS = ('left', 'right', 'middle', 'mouse4', 'mouse5')
8
+ MOVE_COORDS = ((10, 0), (0, 10), (-10, 0), (0, -10))
9
+
10
+ def test_connect_to_port(makcu):
11
+ print("Connecting to port...")
12
+ makcu.connect()
13
+ assert makcu.is_connected(), "Failed to connect to the makcu"
14
+
15
+ def test_press_and_release(makcu):
16
+ makcu.press(MouseButton.LEFT)
17
+ makcu.release(MouseButton.LEFT)
18
+
19
+ def test_firmware_version(makcu):
20
+ version = makcu.mouse.get_firmware_version()
21
+ assert version and len(version.strip()) > 0
22
+
23
+ def test_middle_click(makcu):
24
+ makcu.press(MouseButton.MIDDLE)
25
+ makcu.release(MouseButton.MIDDLE)
26
+
27
+ def test_device_info(makcu):
28
+ print("Fetching device info...")
29
+ info = makcu.mouse.get_device_info()
30
+ print(f"Device Info: {info}")
31
+ assert info.get("port")
32
+ assert info.get("isConnected") is True
33
+
34
+ def test_port_connection(makcu):
35
+ assert makcu.is_connected()
36
+
37
+ def test_button_mask(makcu):
38
+ print("Getting button mask...")
39
+ mask = makcu.get_button_mask()
40
+ print(f"Mask value: {mask}")
41
+ assert isinstance(mask, int)
42
+
43
+ def test_get_button_states(makcu):
44
+ states = makcu.get_button_states()
45
+ assert isinstance(states, dict)
46
+ for key in BUTTON_STATE_KEYS:
47
+ assert key in states
48
+
49
+ def test_lock_state(makcu):
50
+ print("Locking LEFT button...")
51
+ makcu.lock_left(True)
52
+ print("Querying lock state while LEFT is locked...")
53
+ state = makcu.is_locked(MouseButton.LEFT)
54
+ print(state)
55
+ assert state
56
+
57
+ def test_makcu_behavior(makcu):
58
+ makcu.move(25, 25)
59
+ makcu.click(MouseButton.LEFT)
60
+ makcu.scroll(-2)
61
+
62
+ def test_batch_commands(makcu):
63
+ print("Testing batch command execution (10 commands)...")
64
+
65
+ start_time = time.perf_counter()
66
+
67
+
68
+ makcu.move(10, 0)
69
+ makcu.click(MouseButton.LEFT)
70
+ makcu.move(0, 10)
71
+ makcu.press(MouseButton.RIGHT)
72
+ makcu.release(MouseButton.RIGHT)
73
+ makcu.scroll(-1)
74
+ makcu.move(-10, 0)
75
+ makcu.click(MouseButton.MIDDLE)
76
+ makcu.move(0, -10)
77
+ makcu.scroll(1)
78
+
79
+ end_time = time.perf_counter()
80
+ elapsed_ms = (end_time - start_time) * 1000
81
+
82
+ print(f"Batch execution time: {elapsed_ms:.2f}ms")
83
+ print(f"Average per command: {elapsed_ms/10:.2f}ms")
84
+
85
+
86
+ assert elapsed_ms < 50, f"Batch commands took {elapsed_ms:.2f}ms, expected < 50ms"
87
+
88
+
89
+ start_time = time.perf_counter()
90
+ for _ in range(10):
91
+ makcu.move(5, 5)
92
+ end_time = time.perf_counter()
93
+
94
+ move_only_ms = (end_time - start_time) * 1000
95
+ print(f"10 move commands: {move_only_ms:.2f}ms ({move_only_ms/10:.2f}ms per move)")
96
+
97
+ def test_rapid_moves(makcu):
98
+ start = time.perf_counter_ns()
99
+
100
+
101
+ makcu.move(5, 5)
102
+ makcu.move(5, 5)
103
+ makcu.move(5, 5)
104
+ makcu.move(5, 5)
105
+ makcu.move(5, 5)
106
+ makcu.move(5, 5)
107
+ makcu.move(5, 5)
108
+ makcu.move(5, 5)
109
+ makcu.move(5, 5)
110
+ makcu.move(5, 5)
111
+
112
+ elapsed_ms = (time.perf_counter_ns() - start) / 1_000_000
113
+ print(f"10 rapid moves: {elapsed_ms:.2f}ms")
114
+ assert elapsed_ms < 30
115
+
116
+ def test_button_performance(makcu):
117
+ start = time.perf_counter_ns()
118
+
119
+
120
+ for button in TEST_BUTTONS:
121
+ makcu.press(button)
122
+ makcu.release(button)
123
+
124
+ elapsed_ms = (time.perf_counter_ns() - start) / 1_000_000
125
+ print(f"Button operations: {elapsed_ms:.2f}ms")
126
+ assert elapsed_ms < 20
127
+
128
+ def test_mixed_operations(makcu):
129
+ start = time.perf_counter_ns()
130
+
131
+
132
+ makcu.move(20, 20)
133
+ makcu.press(MouseButton.LEFT)
134
+ makcu.move(-20, -20)
135
+ makcu.release(MouseButton.LEFT)
136
+ makcu.scroll(1)
137
+
138
+ elapsed_ms = (time.perf_counter_ns() - start) / 1_000_000
139
+ print(f"Mixed operations: {elapsed_ms:.2f}ms")
140
+ assert elapsed_ms < 15
141
+
142
+
143
+ @pytest.mark.skip(reason="Capture test disabled until firmware supports tracking clicks from software input")
144
+ def test_capture_right_clicks(makcu):
145
145
  pass
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: makcu
3
+ Version: 2.1.3
4
+ Summary: Python library for Makcu hardware device control
5
+ Author: SleepyTotem
6
+ Project-URL: Homepage, https://github.com/SleepyTotem/makcu-py-lib
7
+ Project-URL: Bug Reports, https://github.com/SleepyTotem/makcu-py-lib/issues
8
+ Project-URL: Source, https://github.com/SleepyTotem/makcu-py-lib
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: System :: Hardware :: Hardware Drivers
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.7
26
+ Description-Content-Type: text/markdown
27
+ Requires-Dist: pyserial>=3.5
28
+ Requires-Dist: pytest>=7.0
29
+ Requires-Dist: pytest-html>=3.1
30
+ Requires-Dist: build>=0.10
31
+ Requires-Dist: twine>=4.0
32
+ Requires-Dist: rich>=14.0
@@ -0,0 +1,15 @@
1
+ makcu/__init__.py,sha256=6ooI_cehSv4BUjRgibOEMXa3FAFfFBW8TLCyZhynvkE,12207
2
+ makcu/__main__.py,sha256=2ob_ph8lQz8kqJpswel18IGgDq2y9i9Hi2-V-L6ZvoU,13998
3
+ makcu/conftest.py,sha256=BqPx6ywYONYGyKH11Bam9aV5zSGXR6odE5Z8hGFrn4U,863
4
+ makcu/connection.py,sha256=cpk8eNKWcnrjE9-iG_HKRtmU4A9jjDXNyWZ7BsrqDKA,14676
5
+ makcu/controller.py,sha256=evIN3h7-wctFRZxR6zJoDYjqiJUZc9fxLImCgwbno4c,12496
6
+ makcu/enums.py,sha256=1SvIv5IoMIfXyoMAq8I5r_aKMVKjYR-L_hXkFLJ_5mw,119
7
+ makcu/errors.py,sha256=hXdeUCHvbzfqWX3uotG12Xv8EPwWs-5aHQ12xpgwx3Y,229
8
+ makcu/makcu.pyi,sha256=UfbX7774u_a9oyIa1rweWqIRoQxVAjhhHUuukDp3jiA,237
9
+ makcu/mouse.py,sha256=YZQDA5OGQlCxCDu3Huzwp5bjH__9yb867iLSVTYOKP4,8157
10
+ makcu/py.typed,sha256=lI_IPBO6A6a5eY5kRQDNsdSydUb3sFWtcC_ML8FNftU,111
11
+ makcu/test_suite.py,sha256=LlVX-4RD2QHaIPOCE9HtYh2_-YmgsQ0tsvZ4aX-UhJc,3948
12
+ makcu-2.1.3.dist-info/METADATA,sha256=heofxEfsrICLDrIrDPGENo1oL-mukcD5dDVzDZHK9qU,1435
13
+ makcu-2.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ makcu-2.1.3.dist-info/top_level.txt,sha256=IRO1UVb5LK_ovjau0g4oObyXQqy00tVEE-yF5lPgw1w,6
15
+ makcu-2.1.3.dist-info/RECORD,,