Formats impression configurables + recadrage au ratio
Config admin : - Chaque format (10x15, 13x18, 15x20) activable avec checkbox - Imprimante CUPS assignable par format Écran impression : - Boutons de format (seuls les activés apparaissent) - Cadre de recadrage au ratio du format (3:2, 18:13, 4:3) - Auto-détection portrait/paysage - Cadre déplaçable avec poignées tactiles - Galerie → Valider → écran impression avec print_list Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,9 +31,12 @@ DEFAULT_CONFIG = {
|
||||
"imap_password": "",
|
||||
"imap_folder": "INBOX",
|
||||
"imap_interval": 30,
|
||||
# Impression
|
||||
"printer_name": "",
|
||||
"print_format": "10x15 cm",
|
||||
# Formats d'impression (activable + imprimante par format)
|
||||
"formats": {
|
||||
"10x15": {"enabled": True, "printer": "", "ratio": 1.5},
|
||||
"13x18": {"enabled": False, "printer": "", "ratio": 1.385},
|
||||
"15x20": {"enabled": False, "printer": "", "ratio": 1.333},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -211,23 +214,26 @@ class ConfigDialog(QDialog):
|
||||
grid.addWidget(self.imap_interval_input, row, 1)
|
||||
row += 1
|
||||
|
||||
# ── Impression ──
|
||||
grid.addWidget(self._section_title("Impression"), row, 0, 1, 2)
|
||||
# ── Formats d'impression ──
|
||||
grid.addWidget(self._section_title("Formats d'impression"), row, 0, 1, 2)
|
||||
row += 1
|
||||
|
||||
grid.addWidget(self._label("Imprimante :"), row, 0)
|
||||
self.printer_input = self._input(self.config["printer_name"], "Nom CUPS (vide = par défaut)")
|
||||
grid.addWidget(self.printer_input, row, 1)
|
||||
row += 1
|
||||
formats = self.config.get("formats", DEFAULT_CONFIG["formats"])
|
||||
self.format_widgets = {}
|
||||
|
||||
grid.addWidget(self._label("Format par défaut :"), row, 0)
|
||||
self.format_combo = QComboBox()
|
||||
self.format_combo.setFont(QFont("", 12))
|
||||
self.format_combo.setMinimumHeight(35)
|
||||
self.format_combo.addItems(["10x15 cm", "13x18 cm", "15x20 cm"])
|
||||
self.format_combo.setCurrentText(self.config["print_format"])
|
||||
grid.addWidget(self.format_combo, row, 1)
|
||||
row += 1
|
||||
for fmt_name, fmt_conf in formats.items():
|
||||
# Checkbox activé
|
||||
cb = QCheckBox(f"{fmt_name} cm")
|
||||
cb.setFont(QFont("", 12))
|
||||
cb.setChecked(fmt_conf.get("enabled", False))
|
||||
grid.addWidget(cb, row, 0)
|
||||
|
||||
# Imprimante associée
|
||||
printer = self._input(fmt_conf.get("printer", ""), "Imprimante CUPS (vide = défaut)")
|
||||
grid.addWidget(printer, row, 1)
|
||||
|
||||
self.format_widgets[fmt_name] = {"checkbox": cb, "printer": printer}
|
||||
row += 1
|
||||
|
||||
scroll.setWidget(content)
|
||||
layout.addWidget(scroll, 1)
|
||||
@@ -272,8 +278,14 @@ class ConfigDialog(QDialog):
|
||||
self.config["imap_password"] = self.imap_pass_input.text()
|
||||
self.config["imap_folder"] = self.imap_folder_input.text()
|
||||
self.config["imap_interval"] = self.imap_interval_input.value()
|
||||
self.config["printer_name"] = self.printer_input.text()
|
||||
self.config["print_format"] = self.format_combo.currentText()
|
||||
# Formats d'impression
|
||||
formats = self.config.get("formats", dict(DEFAULT_CONFIG["formats"]))
|
||||
for fmt_name, widgets in self.format_widgets.items():
|
||||
if fmt_name not in formats:
|
||||
formats[fmt_name] = {}
|
||||
formats[fmt_name]["enabled"] = widgets["checkbox"].isChecked()
|
||||
formats[fmt_name]["printer"] = widgets["printer"].text()
|
||||
self.config["formats"] = formats
|
||||
save_config(self.config)
|
||||
self.accept()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user