Skip to content

Commit 5e91e18

Browse files
committed
Add a fully functioning pure-Python event loop
1 parent 815514c commit 5e91e18

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

examples/cube_trio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Cube trio
33
---------
44
5-
Run a wgpu example on the glfw backend, and the trio loop
5+
Run a wgpu example on the glfw backend, and the trio loop.
66
"""
77

88
import trio

examples/demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
canvas = RenderCanvas(
2424
size=(640, 480),
25-
title="Canvas events with $backend - $fps fps",
25+
title="Canvas events with $backend on $loop - $fps fps",
2626
max_fps=10,
2727
update_mode="continuous",
2828
present_method="",

rendercanvas/_loop.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ async def _loop_task(self):
137137
del canvas
138138

139139
finally:
140-
self._stop()
140+
self.__stop()
141141

142142
def add_task(self, async_func, *args, name="unnamed"):
143143
"""Run an async function in the event-loop.
@@ -260,9 +260,9 @@ def stop(self):
260260
self.__should_stop += 1
261261
if self.__should_stop >= 4:
262262
# If for some reason the tick method is no longer being called, but the loop is still running, we can still stop it by spamming stop() :)
263-
self._stop()
263+
self.__stop()
264264

265-
def _stop(self):
265+
def __stop(self):
266266
"""Move to the off-state."""
267267
# If we used the async adapter, cancel any tasks
268268
while self.__tasks:

tests/test_backends.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ def test_meta():
146146
continue
147147
module_name = fname.split(".")[0]
148148
test_func_name = f"test_{module_name}_module"
149-
assert (
150-
test_func_name in all_test_names
151-
), f"Test missing for {module_name} module"
149+
assert test_func_name in all_test_names, (
150+
f"Test missing for {module_name} module"
151+
)
152152

153153

154154
def test_ref_rc_methods():

tests/test_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def handler(event):
352352
ee.sync_flush()
353353
t2 = time.perf_counter() - t0
354354

355-
print(f"add_handler: {1000*t1:0.0f} ms, emit: {1000*t2:0.0f} ms")
355+
print(f"add_handler: {1000 * t1:0.0f} ms, emit: {1000 * t2:0.0f} ms")
356356

357357

358358
if __name__ == "__main__":

0 commit comments

Comments
 (0)