Make paper sizes translatable

This commit is contained in:
Veronica Berglyd Olsen
2023-07-20 00:29:01 +02:00
parent e1ea285201
commit dedb86b11d
4 changed files with 31 additions and 22 deletions
-9
View File
@@ -132,15 +132,6 @@ SETTINGS_LABELS = {
"html.addStyles": QT_TRANSLATE_NOOP("Builds", "Add CSS Styles"),
}
PAGE_SIZES = {
"A4": (210.0, 297.0),
"A5": (148.0, 210.0),
"A6": (105.0, 148.0),
"Legal": (215.9, 355.6),
"Letter": (215.9, 279.4),
"Custom": (-1.0, -1.0),
}
class FilterMode(Enum):
"""The decision reason for an item in a filtered project."""
+4 -4
View File
@@ -40,7 +40,7 @@ from novelwriter.core.toodt import ToOdt
from novelwriter.core.tohtml import ToHtml
from novelwriter.core.project import NWProject
from novelwriter.core.tokenizer import Tokenizer
from novelwriter.core.buildsettings import PAGE_SIZES, BuildSettings
from novelwriter.core.buildsettings import BuildSettings
logger = logging.getLogger(__name__)
@@ -292,10 +292,10 @@ class NWBuildDocument:
bldObj.setLanguage(buildLang)
scale = nwLabels.UNIT_SCALE.get(self._build.getStr("format.pageUnit"), 1.0)
width, height = PAGE_SIZES.get(self._build.getStr("format.pageSize"), (-1.0, -1.0))
pW, pH = nwLabels.PAPER_SIZE.get(self._build.getStr("format.pageSize"), (-1.0, -1.0))
bldObj.setPageLayout(
width if width > 0.0 else scale*self._build.getFloat("format.pageWidth"),
height if height > 0.0 else scale*self._build.getFloat("format.pageHeight"),
pW if pW > 0.0 else scale*self._build.getFloat("format.pageWidth"),
pH if pH > 0.0 else scale*self._build.getFloat("format.pageHeight"),
scale*self._build.getFloat("format.topMargin"),
scale*self._build.getFloat("format.bottomMargin"),
scale*self._build.getFloat("format.leftMargin"),