Subtitles and menu text sections in the editor

This commit is contained in:
2026-10-09 22:42:50 +02:00
parent ef68edbe45
commit a10593ec24
9 changed files with 816 additions and 31 deletions

View File

@@ -133,7 +133,7 @@ class ExportModDialog(QDialog):
class ImportModDialog(QDialog):
"""Shows how each item of a package matches this game before installing."""
def __init__(self, manifest, items, parent=None):
def __init__(self, manifest, items, parent=None, texts=()):
super().__init__(parent)
self.setWindowTitle("Import mod package")
lay = QVBoxLayout(self)
@@ -151,9 +151,15 @@ class ImportModDialog(QDialog):
"missing": im.note}[im.how]
QTreeWidgetItem(self.tree, [im.item.get("name") or im.item["target"], im.how, note])
n_ok += im.how != "missing"
t_ok = 0
for key, _text, problem in texts:
QTreeWidgetItem(self.tree, [key, "text", problem or "will be applied"])
t_ok += not problem
self.tree.resizeColumnToContents(0)
lay.addWidget(self.tree)
lay.addWidget(QLabel("%d of %d sounds will be installed." % (n_ok, len(items))))
lay.addWidget(QLabel("%d of %d sounds and %d of %d texts will be installed."
% (n_ok, len(items), t_ok, len(texts))))
n_ok += t_ok
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
bb.button(QDialogButtonBox.StandardButton.Ok).setText("Install")
bb.button(QDialogButtonBox.StandardButton.Ok).setEnabled(n_ok > 0)