Engrave window: bar numbers, and two silent LilyPond faults
A system can now be given the measure it starts at, in a First bar field beside key and time. Per slice, since it is the one thing about a replacement that cannot be inherited from the song. Bar numbering is a Score property, so it is set once on the first staff, and made visible only at a line beginning — that vector is fussy: #(#f #t #t) also prints a number mid-system and #(#f #t #f) prints the second bar's rather than the first's. It travels in the bundle's engraving object as `bar`. Two things LilyPond 2.24 was quietly refusing to draw: `\bar ":|"` and the other old repeat names produce nothing at all — no error, no warning, exit status 0, just a missing repeat that you find on the tablet. Every book and forum answer still uses them, so translate them to the modern spellings. `\clef treble_8` unquoted is not an octavated clef either. It parses as a plain treble plus a stray "8" markup that lands under the first note, and the staff then reads an octave off — a tenor line engraved at soprano pitch. Quote it. The source pane, which is where either of those would have been visible, is now a collapsed section at the bottom rather than a permanent slab. It uses the panel's own disclosure helper, lifted out of Editor so both can call it.
This commit is contained in:
@@ -14,7 +14,7 @@ from __future__ import annotations
|
||||
import cv2
|
||||
import numpy as np
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtGui import QImage, QKeySequence, QPixmap, QShortcut
|
||||
from PySide6.QtGui import QImage, QIntValidator, QKeySequence, QPixmap, QShortcut
|
||||
from PySide6.QtWidgets import (
|
||||
QCheckBox,
|
||||
QComboBox,
|
||||
@@ -33,6 +33,7 @@ from PySide6.QtWidgets import (
|
||||
|
||||
from . import lilypond
|
||||
from .detect import staff_height
|
||||
from .editor import section
|
||||
from .project import Project, Replacement, Voice
|
||||
|
||||
|
||||
@@ -180,6 +181,16 @@ class EngraveWindow(QDialog):
|
||||
self.print_time.toggled.connect(self._settings_changed)
|
||||
row.addWidget(self.print_time, 1)
|
||||
top.addRow("Time", row)
|
||||
|
||||
# Per slice, unlike key and time: which measure a system starts at is
|
||||
# the one thing that changes with every slice and cannot be inherited.
|
||||
self.bar = QLineEdit("" if self.replacement.bar is None else str(self.replacement.bar))
|
||||
self.bar.setValidator(QIntValidator(1, 9999, self.bar))
|
||||
self.bar.setFixedWidth(70)
|
||||
self.bar.setPlaceholderText("none")
|
||||
self.bar.setToolTip("Printed above the first bar, as a printed score numbers its systems")
|
||||
self.bar.textChanged.connect(self._bar_changed)
|
||||
top.addRow("First bar", self.bar)
|
||||
box.addLayout(top)
|
||||
|
||||
voices_label = QLabel("Voices")
|
||||
@@ -209,11 +220,15 @@ class EngraveWindow(QDialog):
|
||||
self.status.setWordWrap(True)
|
||||
box.addWidget(self.status)
|
||||
|
||||
# Collapsed: the source is what the form writes for you, so it is for
|
||||
# checking what a field did, not for working in. Open it and it stays
|
||||
# open for the life of the window.
|
||||
raw = section("LilyPond source", box, expanded=False)
|
||||
self.generated = QPlainTextEdit()
|
||||
self.generated.setReadOnly(True)
|
||||
self.generated.setMaximumHeight(120)
|
||||
self.generated.setMaximumHeight(220)
|
||||
self.generated.setStyleSheet("color: #808080;")
|
||||
box.addWidget(self.generated)
|
||||
raw.addWidget(self.generated)
|
||||
self._refresh_source()
|
||||
return panel
|
||||
|
||||
@@ -240,6 +255,10 @@ class EngraveWindow(QDialog):
|
||||
row.setParent(None)
|
||||
self._refresh_source()
|
||||
|
||||
def _bar_changed(self, text: str) -> None:
|
||||
self.replacement.bar = int(text) if text.strip().isdigit() else None
|
||||
self._refresh_source()
|
||||
|
||||
def _settings_changed(self) -> None:
|
||||
# Set on the song, not the slice: they are song properties in practice,
|
||||
# and this is what makes the next re-engraved slice open pre-filled.
|
||||
|
||||
Reference in New Issue
Block a user