Skip to content

Commit 762a773

Browse files
committed
deprecate bool type to show_preview and preview; add logging related to change in behavior of None & False
Signed-off-by: Asadullah Shaikh <asadshaikh20022002@gmail.com>
1 parent d94a5de commit 762a773

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

picamera2/picamera2.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,18 @@ def start_preview(self, preview=None, **kwargs) -> None:
596596
Additional keyword arguments may be supplied which will be
597597
forwarded to the preview class constructor.
598598
"""
599+
if isinstance(preview, bool):
600+
_log.info("CHANGED: Passing False to show_preview or preview skips starting an event loop")
601+
_log.warning("Passing bool type to show_preview or preview has been deprecated")
602+
if preview:
603+
_log.warning("Use Preview.auto() to autodetect")
604+
preview = Preview.auto()
605+
else:
606+
_log.warning("Use Preview.NO to skip starting an event loop")
607+
preview = Preview.NO
608+
599609
if preview is None:
610+
_log.info("CHANGED: Passing None (default) to show_preview or preview starts a NullPreview")
600611
preview = NullPreview(**kwargs)
601612
elif isinstance(preview, Preview):
602613
if preview is Preview.NO:

0 commit comments

Comments
 (0)