V2.1.0 — Formats personnalises + reperes de coupe
- 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>
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
from PyQt6.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel,
|
||||
QComboBox, QGroupBox, QSpinBox, QCheckBox,
|
||||
QDialogButtonBox, QDoubleSpinBox, QFileDialog)
|
||||
from app.engine.pdf_utils import PAGE_SIZES, mm_to_pt
|
||||
QDialogButtonBox, QDoubleSpinBox, QFileDialog,
|
||||
QPushButton)
|
||||
from app.engine.pdf_utils import mm_to_pt
|
||||
from app.dialogs.format_combo import populate_format_combo, get_selected_size, handle_format_selection
|
||||
|
||||
|
||||
class NupDialog(QDialog):
|
||||
@@ -17,7 +19,6 @@ class NupDialog(QDialog):
|
||||
def _setup_ui(self):
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
# Grille
|
||||
grp_grid = QGroupBox("Disposition")
|
||||
gl = QHBoxLayout(grp_grid)
|
||||
gl.addWidget(QLabel("Colonnes :"))
|
||||
@@ -32,18 +33,15 @@ class NupDialog(QDialog):
|
||||
gl.addWidget(self.spin_rows)
|
||||
layout.addWidget(grp_grid)
|
||||
|
||||
# Taille feuille
|
||||
grp_sheet = QGroupBox("Taille de la feuille")
|
||||
sl = QHBoxLayout(grp_sheet)
|
||||
sl.addWidget(QLabel("Format :"))
|
||||
self.combo_sheet = QComboBox()
|
||||
for name in PAGE_SIZES:
|
||||
self.combo_sheet.addItem(name)
|
||||
self.combo_sheet.setCurrentText("A4 Paysage")
|
||||
populate_format_combo(self.combo_sheet, "A4 Paysage")
|
||||
self.combo_sheet.activated.connect(lambda: handle_format_selection(self.combo_sheet, self))
|
||||
sl.addWidget(self.combo_sheet)
|
||||
layout.addWidget(grp_sheet)
|
||||
|
||||
# Marges
|
||||
grp_margins = QGroupBox("Marges (mm)")
|
||||
ml = QHBoxLayout(grp_margins)
|
||||
self.margins = {}
|
||||
@@ -57,7 +55,6 @@ class NupDialog(QDialog):
|
||||
self.margins[label.lower()] = spin
|
||||
layout.addWidget(grp_margins)
|
||||
|
||||
# Gouttiere
|
||||
grp_gutter = QGroupBox("Gouttiere (mm)")
|
||||
gutl = QHBoxLayout(grp_gutter)
|
||||
gutl.addWidget(QLabel("Horizontale :"))
|
||||
@@ -74,7 +71,6 @@ class NupDialog(QDialog):
|
||||
gutl.addWidget(self.spin_gutter_v)
|
||||
layout.addWidget(grp_gutter)
|
||||
|
||||
# Options
|
||||
grp_opts = QGroupBox("Options")
|
||||
ol = QVBoxLayout(grp_opts)
|
||||
self.chk_fit = QCheckBox("Ajuster les pages a la cellule")
|
||||
@@ -88,16 +84,13 @@ class NupDialog(QDialog):
|
||||
bg_layout.addWidget(self.chk_bg)
|
||||
self.lbl_bg = QLabel("Aucun")
|
||||
bg_layout.addWidget(self.lbl_bg)
|
||||
from PyQt6.QtWidgets import QPushButton
|
||||
btn_bg = QPushButton("Choisir...")
|
||||
btn_bg.clicked.connect(self._choose_bg)
|
||||
bg_layout.addWidget(btn_bg)
|
||||
bg_layout.addStretch()
|
||||
ol.addLayout(bg_layout)
|
||||
|
||||
layout.addWidget(grp_opts)
|
||||
|
||||
# Boutons
|
||||
buttons = QDialogButtonBox(
|
||||
QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel
|
||||
)
|
||||
@@ -113,12 +106,10 @@ class NupDialog(QDialog):
|
||||
self.chk_bg.setChecked(True)
|
||||
|
||||
def get_settings(self):
|
||||
sheet_text = self.combo_sheet.currentText()
|
||||
sheet_size = PAGE_SIZES[sheet_text]
|
||||
return {
|
||||
"cols": self.spin_cols.value(),
|
||||
"rows": self.spin_rows.value(),
|
||||
"sheet_size": sheet_size,
|
||||
"sheet_size": get_selected_size(self.combo_sheet),
|
||||
"margin_top": mm_to_pt(self.margins["haut"].value()),
|
||||
"margin_bottom": mm_to_pt(self.margins["bas"].value()),
|
||||
"margin_left": mm_to_pt(self.margins["gauche"].value()),
|
||||
|
||||
Reference in New Issue
Block a user