Reduce to only two constant types

This commit is contained in:
Veronica Berglyd Olsen
2025-02-16 20:40:56 +01:00
parent 8b238f3767
commit c0bb0fa54a
5 changed files with 29 additions and 26 deletions
+4 -4
View File
@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import QGridLayout, QLabel, QWidget
from novelwriter import CONFIG, SHARED
from novelwriter.common import elide
from novelwriter.constants import nwLabels, nwStats, trConst
from novelwriter.constants import nwLabels, nwStats, trConst, trStats
from novelwriter.enum import nwChange
from novelwriter.types import (
QtAlignLeft, QtAlignLeftBase, QtAlignRight, QtAlignRightBase,
@@ -65,9 +65,9 @@ class GuiItemDetails(QWidget):
fntValue = self.font()
fntValue.setPointSizeF(0.9*fPt)
trStats1 = trConst(nwLabels.STATS_NAME[nwStats.CHARS], "Stats")
trStats2 = trConst(nwLabels.STATS_NAME[nwStats.WORDS], "Stats")
trStats3 = trConst(nwLabels.STATS_NAME[nwStats.PARAGRAPHS], "Stats")
trStats1 = trStats(nwLabels.STATS_NAME[nwStats.CHARS])
trStats2 = trStats(nwLabels.STATS_NAME[nwStats.WORDS])
trStats3 = trStats(nwLabels.STATS_NAME[nwStats.PARAGRAPHS])
# Label
self.labelName = QLabel(self.tr("Label"), self)
+2 -2
View File
@@ -35,7 +35,7 @@ from novelwriter import CONFIG, SHARED
from novelwriter.common import openExternalPath, qtLambda
from novelwriter.constants import (
nwConst, nwKeyWords, nwLabels, nwShortcode, nwStats, nwStyles, nwUnicode,
trConst
trConst, trStats
)
from novelwriter.enum import nwDocAction, nwDocInsert, nwFocus, nwView
from novelwriter.extensions.eventfilters import StatusTipFilter
@@ -601,7 +601,7 @@ class GuiMainMenu(QMenuBar):
self.mInsField = self.insMenu.addMenu(self.tr("Word/Character Count"))
for field in nwStats.ALL_FIELDS:
value = nwShortcode.FIELD_VALUE.format(field)
action = self.mInsField.addAction(trConst(nwLabels.STATS_NAME[field], "Stats"))
action = self.mInsField.addAction(trStats(nwLabels.STATS_NAME[field]))
action.triggered.connect(qtLambda(self.requestDocInsertText.emit, value))
# Insert > Breaks and Vertical Space
+4 -4
View File
@@ -42,7 +42,7 @@ from PyQt5.QtWidgets import (
from novelwriter import CONFIG, SHARED
from novelwriter.common import checkInt, formatFileFilter
from novelwriter.constants import nwKeyWords, nwLabels, nwStats, nwStyles, trConst
from novelwriter.constants import nwKeyWords, nwLabels, nwStats, nwStyles, trConst, trStats
from novelwriter.enum import nwChange, nwDocMode, nwItemClass, nwItemLayout, nwItemType, nwOutline
from novelwriter.error import logException
from novelwriter.extensions.configlayout import NColourLabel
@@ -815,9 +815,9 @@ class GuiOutlineDetails(QScrollArea):
bFont = SHARED.theme.guiFontB
trStats1 = trConst(nwLabels.STATS_NAME[nwStats.CHARS], "Stats")
trStats2 = trConst(nwLabels.STATS_NAME[nwStats.WORDS], "Stats")
trStats3 = trConst(nwLabels.STATS_NAME[nwStats.PARAGRAPHS], "Stats")
trStats1 = trStats(nwLabels.STATS_NAME[nwStats.CHARS])
trStats2 = trStats(nwLabels.STATS_NAME[nwStats.WORDS])
trStats3 = trStats(nwLabels.STATS_NAME[nwStats.PARAGRAPHS])
# Details Area
self.titleLabel = QLabel(self.tr("Title"), self)