Merge branch 'main' into dev
This commit is contained in:
@@ -7,6 +7,7 @@ Created: 2020-05-03 [0.4.5] NColourLabel
|
||||
Created: 2024-01-08 [2.3b1] NScrollableForm
|
||||
Created: 2024-01-26 [2.3b1] NScrollablePage
|
||||
Created: 2024-01-26 [2.3b1] NFixedPage
|
||||
Created: 2024-03-12 [2.4b1] NWrappedWidgetBox
|
||||
|
||||
This file is a part of novelWriter
|
||||
Copyright 2018–2024, Veronica Berglyd Olsen
|
||||
@@ -269,3 +270,24 @@ class NColourLabel(QLabel):
|
||||
return
|
||||
|
||||
# END Class NColourLabel
|
||||
|
||||
|
||||
class NWrappedWidgetBox(QHBoxLayout):
|
||||
"""Extension: A Text-Wrapped Widget Box
|
||||
|
||||
A custom layout box where a widget is wrapped in text labels on
|
||||
either side within a layout box. The widget is inserted at the {0}
|
||||
position so that it can be used for translation strings.
|
||||
"""
|
||||
|
||||
def __init__(self, text: str, widget: QWidget) -> None:
|
||||
super().__init__()
|
||||
before, _, after = text.partition(r"{0}")
|
||||
if before:
|
||||
self.addWidget(QLabel(before.rstrip()))
|
||||
self.addWidget(widget)
|
||||
if after:
|
||||
self.addWidget(QLabel(after.lstrip()))
|
||||
return
|
||||
|
||||
# END Class NWrappedWidgetBox
|
||||
|
||||
@@ -355,8 +355,8 @@ class GuiMain(QMainWindow):
|
||||
if hexToInt(CONFIG.lastNotes) < hexToInt(__hexversion__):
|
||||
CONFIG.lastNotes = __hexversion__
|
||||
trVersion = self.tr(
|
||||
"You are now running novelWriter version {0}.".format(formatVersion(__version__))
|
||||
)
|
||||
"You are now running novelWriter version {0}."
|
||||
).format(formatVersion(__version__))
|
||||
trRelease = self.tr(
|
||||
"Please check the {0}release notes{1} for further details."
|
||||
).format(f"<a href='{nwConst.URL_RELEASES}'>", "</a>")
|
||||
|
||||
@@ -45,6 +45,7 @@ from novelwriter.enum import nwItemClass
|
||||
from novelwriter.common import formatInt, makeFileNameSafe
|
||||
from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.coretools import ProjectBuilder
|
||||
from novelwriter.extensions.configlayout import NWrappedWidgetBox
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.modified import NSpinBox
|
||||
from novelwriter.extensions.versioninfo import VersionInfoWidget
|
||||
@@ -630,20 +631,18 @@ class _NewProjectForm(QWidget):
|
||||
self.numChapters.setValue(5)
|
||||
self.numChapters.setToolTip(self.tr("Set to 0 to only add scenes"))
|
||||
|
||||
self.chapterBox = QHBoxLayout()
|
||||
self.chapterBox.addWidget(QLabel(self.tr("Add")))
|
||||
self.chapterBox.addWidget(self.numChapters)
|
||||
self.chapterBox.addWidget(QLabel(self.tr("chapter documents")))
|
||||
self.chapterBox = NWrappedWidgetBox(
|
||||
self.tr("Add {0} chapter documents"), self.numChapters
|
||||
)
|
||||
self.chapterBox.addStretch(1)
|
||||
|
||||
self.numScenes = NSpinBox(self)
|
||||
self.numScenes.setRange(0, 200)
|
||||
self.numScenes.setValue(5)
|
||||
|
||||
self.sceneBox = QHBoxLayout()
|
||||
self.sceneBox.addWidget(QLabel(self.tr("Add")))
|
||||
self.sceneBox.addWidget(self.numScenes)
|
||||
self.sceneBox.addWidget(QLabel(self.tr("scene documents (to each chapter)")))
|
||||
self.sceneBox = NWrappedWidgetBox(
|
||||
self.tr("Add {0} scene documents (to each chapter)"), self.numScenes
|
||||
)
|
||||
self.sceneBox.addStretch(1)
|
||||
|
||||
self.novelForm = QVBoxLayout()
|
||||
|
||||
Reference in New Issue
Block a user