From 5d12f7bf8b319fe82b487fc61e6d3222dee6862e Mon Sep 17 00:00:00 2001 From: David Plowman Date: Mon, 17 Jun 2024 14:51:35 +0100 Subject: [PATCH] Add flush parameter to captured_request() It had just been forgotten. Signed-off-by: David Plowman --- examples/request_context_manager.py | 4 +++- picamera2/picamera2.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/request_context_manager.py b/examples/request_context_manager.py index 4555ae59..ffb30540 100755 --- a/examples/request_context_manager.py +++ b/examples/request_context_manager.py @@ -8,6 +8,8 @@ with Picamera2() as picam2: picam2.start() - for _ in range(50): + for _ in range(25): with picam2.captured_request() as request: print(request) + with picam2.captured_request(flush=True) as request: + print(request) diff --git a/picamera2/picamera2.py b/picamera2/picamera2.py index 3d85c0cd..0e515493 100644 --- a/picamera2/picamera2.py +++ b/picamera2/picamera2.py @@ -1478,9 +1478,9 @@ def capture_request_and_stop_(self): return self.dispatch_functions(functions, wait, signal_function, immediate=True) @contextlib.contextmanager - def captured_request(self): + def captured_request(self, flush=None): """Capture a completed request using the context manager which guarantees its release.""" - request = self.capture_request() + request = self.capture_request(flush=flush) try: yield request finally: