- Formats personnalises dans tous les menus deroulants de format : - "Personnalise..." : saisie libre largeur x hauteur en mm - "Ajouter un format..." : sauvegarder un format custom (persistant) - Formats custom affiches dans le dropdown avec separateur - Reperes de coupe (Annotations > Reperes de coupe) : - Longueur, distance du bord, epaisseur configurables - Couleur : noir, gris, CMYK - Reperes de centrage optionnels - Appliquer a : toutes, paires, impaires, page courante - Enlever les reperes de coupe (menu) - Step & Repeat : ajout des marges (haut, bas, gauche, droite) - Tous les dialogues de format migres vers format_combo Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
97 lines
3.5 KiB
Python
97 lines
3.5 KiB
Python
"""Dialogue Reperes de coupe."""
|
|
|
|
from PyQt6.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel,
|
|
QGroupBox, QDoubleSpinBox, QCheckBox, QComboBox,
|
|
QDialogButtonBox)
|
|
|
|
|
|
class CropMarksDialog(QDialog):
|
|
def __init__(self, parent=None):
|
|
super().__init__(parent)
|
|
self.setWindowTitle("Reperes de coupe")
|
|
self.setMinimumWidth(400)
|
|
self._setup_ui()
|
|
|
|
def _setup_ui(self):
|
|
layout = QVBoxLayout(self)
|
|
|
|
grp_size = QGroupBox("Dimensions des reperes")
|
|
sl = QVBoxLayout(grp_size)
|
|
|
|
h1 = QHBoxLayout()
|
|
h1.addWidget(QLabel("Longueur des traits :"))
|
|
self.spin_length = QDoubleSpinBox()
|
|
self.spin_length.setRange(1, 30)
|
|
self.spin_length.setValue(5)
|
|
self.spin_length.setSuffix(" mm")
|
|
h1.addWidget(self.spin_length)
|
|
sl.addLayout(h1)
|
|
|
|
h2 = QHBoxLayout()
|
|
h2.addWidget(QLabel("Distance du bord :"))
|
|
self.spin_offset = QDoubleSpinBox()
|
|
self.spin_offset.setRange(0, 20)
|
|
self.spin_offset.setValue(2.5)
|
|
self.spin_offset.setSuffix(" mm")
|
|
h2.addWidget(self.spin_offset)
|
|
sl.addLayout(h2)
|
|
|
|
h3 = QHBoxLayout()
|
|
h3.addWidget(QLabel("Epaisseur :"))
|
|
self.spin_weight = QDoubleSpinBox()
|
|
self.spin_weight.setRange(0.1, 2.0)
|
|
self.spin_weight.setValue(0.25)
|
|
self.spin_weight.setSuffix(" pt")
|
|
self.spin_weight.setSingleStep(0.05)
|
|
h3.addWidget(self.spin_weight)
|
|
sl.addLayout(h3)
|
|
|
|
layout.addWidget(grp_size)
|
|
|
|
grp_opts = QGroupBox("Options")
|
|
ol = QVBoxLayout(grp_opts)
|
|
|
|
self.chk_all_corners = QCheckBox("4 coins")
|
|
self.chk_all_corners.setChecked(True)
|
|
ol.addWidget(self.chk_all_corners)
|
|
|
|
self.chk_center = QCheckBox("Reperes de centrage")
|
|
ol.addWidget(self.chk_center)
|
|
|
|
h_color = QHBoxLayout()
|
|
h_color.addWidget(QLabel("Couleur :"))
|
|
self.combo_color = QComboBox()
|
|
self.combo_color.addItems(["Noir", "Gris", "CMYK (toutes les plaques)"])
|
|
h_color.addWidget(self.combo_color)
|
|
ol.addLayout(h_color)
|
|
|
|
h_apply = QHBoxLayout()
|
|
h_apply.addWidget(QLabel("Appliquer a :"))
|
|
self.combo_apply = QComboBox()
|
|
self.combo_apply.addItems(["Toutes les pages", "Pages paires", "Pages impaires", "Page courante"])
|
|
h_apply.addWidget(self.combo_apply)
|
|
ol.addLayout(h_apply)
|
|
|
|
layout.addWidget(grp_opts)
|
|
|
|
buttons = QDialogButtonBox(
|
|
QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel
|
|
)
|
|
buttons.accepted.connect(self.accept)
|
|
buttons.rejected.connect(self.reject)
|
|
layout.addWidget(buttons)
|
|
|
|
def get_settings(self):
|
|
from app.engine.pdf_utils import mm_to_pt
|
|
color_map = {"Noir": (0, 0, 0), "Gris": (0.5, 0.5, 0.5), "CMYK (toutes les plaques)": (0, 0, 0)}
|
|
apply_map = {"Toutes les pages": "all", "Pages paires": "even", "Pages impaires": "odd", "Page courante": "current"}
|
|
return {
|
|
"mark_length": mm_to_pt(self.spin_length.value()),
|
|
"mark_offset": mm_to_pt(self.spin_offset.value()),
|
|
"line_width": self.spin_weight.value(),
|
|
"all_corners": self.chk_all_corners.isChecked(),
|
|
"center_marks": self.chk_center.isChecked(),
|
|
"color": color_map[self.combo_color.currentText()],
|
|
"apply_to": apply_map[self.combo_apply.currentText()],
|
|
}
|