From 59370a49658d58c8e9def273c2fe02943100843c Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 11 Apr 2026 17:34:05 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20pellicule=20compte=20=C3=A0=20rebours=20+?= =?UTF-8?q?=20auto-d=C3=A9tection=20DSLR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - draw_compte() pellicule : suppression de l'overlay global qui masquait la bande film pendant le compte à rebours - _cam_loop() : ne quitte plus en mode simulation, tente une reconnexion automatique toutes les 8s si le DSLR est branché après démarrage - _reconnect_cam() : fonctionne aussi depuis le mode simulation (bouton admin) Co-Authored-By: Claude Sonnet 4.6 --- photobooth_pygame.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/photobooth_pygame.py b/photobooth_pygame.py index 72ff1ec..81fcd2c 100644 --- a/photobooth_pygame.py +++ b/photobooth_pygame.py @@ -713,9 +713,22 @@ class PB: # ── Thread caméra ──────────────────────────────────────────────────────── def _cam_loop(self): - if self.sim: return errs = 0 while True: + # En simulation : tentative de connexion automatique toutes les 8s + if self.sim: + time.sleep(8) + for _ in range(2): + try: + c = gp.Camera(); c.init() + if self.cam: + try: self.cam.exit() + except: pass + self.cam = c; self.sim = False; self.prev_actif = True + print("DSLR détecté automatiquement") + break + except: time.sleep(1) + continue if self.prev_actif: try: if self.cam is None: @@ -1245,7 +1258,7 @@ class PB: T = self.T if self._is_pell(): self._draw_pellicule(show_live=True) - self._overlay(90) + # Pas d'overlay global : le halo coloré suffit pour la lisibilité else: self._lv(); self._overlay(110) ch=str(self.chiffre) @@ -2056,7 +2069,6 @@ class PB: c[section][key]=max(mini,min(maxi,v+delta)); cfg_save(c); self.cfg=c def _reconnect_cam(self): - if self.sim: return self.prev_actif=False; time.sleep(0.5) try: if self.cam: self.cam.exit()