V2.6.0 — Recadrage non-destructif + impression + licence dialog

- Recadrage non-destructif :
  - Garde le fichier original en memoire
  - Reouvrir Recadrer reaffiche la page entiere avec le cadre existant
  - Les marges sont pre-remplies avec le crop precedent
  - Annuler revient au fichier actuel
- Impression : os.startfile(path, "print") ouvre le dialogue d'impression
  Windows directement (au lieu d'ouvrir le navigateur)
- Dialogue de licence custom (logo, champ monospace, bouton cyan)
- Messages erreur/succes en dialogues custom colores

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jules
2026-03-21 15:35:57 +01:00
parent c6d3ddcf9d
commit cee86f5c03
4 changed files with 79 additions and 14 deletions

View File

@@ -9,7 +9,7 @@ from app.engine.pdf_utils import mm_to_pt, pt_to_mm
class CropDialog(QDialog):
def __init__(self, page_width_pt=595, page_height_pt=842, total_pages=1,
current_page=0, viewer=None, parent=None):
current_page=0, viewer=None, existing_crop=None, parent=None):
super().__init__(parent)
self.setWindowTitle("Recadrer")
self.setFixedWidth(360)
@@ -20,7 +20,9 @@ class CropDialog(QDialog):
self._total_pages = total_pages
self._current_page = current_page
self._viewer = viewer
self._existing_crop = existing_crop
self._setup_ui()
self._apply_existing_crop()
self._update_preview()
def _setup_ui(self):
@@ -196,6 +198,22 @@ class CropDialog(QDialog):
spin.blockSignals(False)
self._update_preview()
def _apply_existing_crop(self):
"""Pre-remplir les marges si on a un crop existant."""
if not self._existing_crop:
return
from app.engine.pdf_utils import pt_to_mm
for spin in self.margin_spins.values():
spin.blockSignals(True)
self.margin_spins["haut"].setValue(pt_to_mm(self._existing_crop.get("crop_top", 0)))
self.margin_spins["bas"].setValue(pt_to_mm(self._existing_crop.get("crop_bottom", 0)))
self.margin_spins["gauche"].setValue(pt_to_mm(self._existing_crop.get("crop_left", 0)))
self.margin_spins["droite"].setValue(pt_to_mm(self._existing_crop.get("crop_right", 0)))
for spin in self.margin_spins.values():
spin.blockSignals(False)
# Afficher le cadre sur le viewer
self._show_selection_from_margins()
def _on_selection_changed(self, left, top, right, bottom):
"""Recoit les ratios de selection du viewer et met a jour les marges."""
if not self.rb_margins.isChecked():