Fix a bug in Build and Constants, and clean up some more nested translates

This commit is contained in:
Veronica K. B. Olsen
2021-02-16 19:42:50 +01:00
parent d5bd816676
commit 8f1c4af9fa
15 changed files with 621 additions and 355 deletions
+474 -195
View File
File diff suppressed because it is too large Load Diff
+60 -61
View File
@@ -24,8 +24,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """
from PyQt5.QtCore import QCoreApplication from PyQt5.QtCore import QCoreApplication, QT_TRANSLATE_NOOP
from PyQt5.QtCore import QT_TRANSLATE_NOOP as QT_TRN
from nw.constants.enum import ( from nw.constants.enum import (
nwItemClass, nwItemLayout, nwItemType, nwOutline nwItemClass, nwItemLayout, nwItemType, nwOutline
@@ -127,17 +126,17 @@ class nwKeyWords:
class nwLabels(): class nwLabels():
CLASS_NAME = { CLASS_NAME = {
nwItemClass.NO_CLASS : QT_TRN("Constant", "None"), nwItemClass.NO_CLASS : QT_TRANSLATE_NOOP("Constant", "None"),
nwItemClass.NOVEL : QT_TRN("Constant", "Novel"), nwItemClass.NOVEL : QT_TRANSLATE_NOOP("Constant", "Novel"),
nwItemClass.PLOT : QT_TRN("Constant", "Plot"), nwItemClass.PLOT : QT_TRANSLATE_NOOP("Constant", "Plot"),
nwItemClass.CHARACTER : QT_TRN("Constant", "Characters"), nwItemClass.CHARACTER : QT_TRANSLATE_NOOP("Constant", "Characters"),
nwItemClass.WORLD : QT_TRN("Constant", "Locations"), nwItemClass.WORLD : QT_TRANSLATE_NOOP("Constant", "Locations"),
nwItemClass.TIMELINE : QT_TRN("Constant", "Timeline"), nwItemClass.TIMELINE : QT_TRANSLATE_NOOP("Constant", "Timeline"),
nwItemClass.OBJECT : QT_TRN("Constant", "Objects"), nwItemClass.OBJECT : QT_TRANSLATE_NOOP("Constant", "Objects"),
nwItemClass.ENTITY : QT_TRN("Constant", "Entity"), nwItemClass.ENTITY : QT_TRANSLATE_NOOP("Constant", "Entity"),
nwItemClass.CUSTOM : QT_TRN("Constant", "Custom"), nwItemClass.CUSTOM : QT_TRANSLATE_NOOP("Constant", "Custom"),
nwItemClass.ARCHIVE : QT_TRN("Constant", "Outtakes"), nwItemClass.ARCHIVE : QT_TRANSLATE_NOOP("Constant", "Outtakes"),
nwItemClass.TRASH : QT_TRN("Constant", "Trash"), nwItemClass.TRASH : QT_TRANSLATE_NOOP("Constant", "Trash"),
} }
CLASS_FLAG = { CLASS_FLAG = {
nwItemClass.NO_CLASS : "0", nwItemClass.NO_CLASS : "0",
@@ -166,15 +165,15 @@ class nwLabels():
nwItemClass.TRASH : "cls_trash", nwItemClass.TRASH : "cls_trash",
} }
LAYOUT_NAME = { LAYOUT_NAME = {
nwItemLayout.NO_LAYOUT : QT_TRN("Constant", "None"), nwItemLayout.NO_LAYOUT : QT_TRANSLATE_NOOP("Constant", "None"),
nwItemLayout.TITLE : QT_TRN("Constant", "Title Page"), nwItemLayout.TITLE : QT_TRANSLATE_NOOP("Constant", "Title Page"),
nwItemLayout.BOOK : QT_TRN("Constant", "Book"), nwItemLayout.BOOK : QT_TRANSLATE_NOOP("Constant", "Book"),
nwItemLayout.PAGE : QT_TRN("Constant", "Plain Page"), nwItemLayout.PAGE : QT_TRANSLATE_NOOP("Constant", "Plain Page"),
nwItemLayout.PARTITION : QT_TRN("Constant", "Partition"), nwItemLayout.PARTITION : QT_TRANSLATE_NOOP("Constant", "Partition"),
nwItemLayout.UNNUMBERED : QT_TRN("Constant", "Unnumbered"), nwItemLayout.UNNUMBERED : QT_TRANSLATE_NOOP("Constant", "Unnumbered"),
nwItemLayout.CHAPTER : QT_TRN("Constant", "Chapter"), nwItemLayout.CHAPTER : QT_TRANSLATE_NOOP("Constant", "Chapter"),
nwItemLayout.SCENE : QT_TRN("Constant", "Scene"), nwItemLayout.SCENE : QT_TRANSLATE_NOOP("Constant", "Scene"),
nwItemLayout.NOTE : QT_TRN("Constant", "Note"), nwItemLayout.NOTE : QT_TRANSLATE_NOOP("Constant", "Note"),
} }
LAYOUT_FLAG = { LAYOUT_FLAG = {
nwItemLayout.NO_LAYOUT : "Xo", nwItemLayout.NO_LAYOUT : "Xo",
@@ -188,27 +187,27 @@ class nwLabels():
nwItemLayout.NOTE : "Nt", nwItemLayout.NOTE : "Nt",
} }
KEY_NAME = { KEY_NAME = {
nwKeyWords.TAG_KEY : QT_TRN("Constant", "Tag"), nwKeyWords.TAG_KEY : QT_TRANSLATE_NOOP("Constant", "Tag"),
nwKeyWords.POV_KEY : QT_TRN("Constant", "Point of View"), nwKeyWords.POV_KEY : QT_TRANSLATE_NOOP("Constant", "Point of View"),
nwKeyWords.FOCUS_KEY : QT_TRN("Constant", "Focus"), nwKeyWords.FOCUS_KEY : QT_TRANSLATE_NOOP("Constant", "Focus"),
nwKeyWords.CHAR_KEY : QT_TRN("Constant", "Characters"), nwKeyWords.CHAR_KEY : QT_TRANSLATE_NOOP("Constant", "Characters"),
nwKeyWords.PLOT_KEY : QT_TRN("Constant", "Plot"), nwKeyWords.PLOT_KEY : QT_TRANSLATE_NOOP("Constant", "Plot"),
nwKeyWords.TIME_KEY : QT_TRN("Constant", "Timeline"), nwKeyWords.TIME_KEY : QT_TRANSLATE_NOOP("Constant", "Timeline"),
nwKeyWords.WORLD_KEY : QT_TRN("Constant", "Locations"), nwKeyWords.WORLD_KEY : QT_TRANSLATE_NOOP("Constant", "Locations"),
nwKeyWords.OBJECT_KEY : QT_TRN("Constant", "Objects"), nwKeyWords.OBJECT_KEY : QT_TRANSLATE_NOOP("Constant", "Objects"),
nwKeyWords.ENTITY_KEY : QT_TRN("Constant", "Entities"), nwKeyWords.ENTITY_KEY : QT_TRANSLATE_NOOP("Constant", "Entities"),
nwKeyWords.CUSTOM_KEY : QT_TRN("Constant", "Custom"), nwKeyWords.CUSTOM_KEY : QT_TRANSLATE_NOOP("Constant", "Custom"),
} }
OUTLINE_COLS = { OUTLINE_COLS = {
nwOutline.TITLE : QT_TRN("Constant", "Title"), nwOutline.TITLE : QT_TRANSLATE_NOOP("Constant", "Title"),
nwOutline.LEVEL : QT_TRN("Constant", "Level"), nwOutline.LEVEL : QT_TRANSLATE_NOOP("Constant", "Level"),
nwOutline.LABEL : QT_TRN("Constant", "Document"), nwOutline.LABEL : QT_TRANSLATE_NOOP("Constant", "Document"),
nwOutline.LINE : QT_TRN("Constant", "Line"), nwOutline.LINE : QT_TRANSLATE_NOOP("Constant", "Line"),
nwOutline.CCOUNT : QT_TRN("Constant", "Chars"), nwOutline.CCOUNT : QT_TRANSLATE_NOOP("Constant", "Chars"),
nwOutline.WCOUNT : QT_TRN("Constant", "Words"), nwOutline.WCOUNT : QT_TRANSLATE_NOOP("Constant", "Words"),
nwOutline.PCOUNT : QT_TRN("Constant", "Pars"), nwOutline.PCOUNT : QT_TRANSLATE_NOOP("Constant", "Pars"),
nwOutline.POV : QT_TRN("Constant", "POV"), nwOutline.POV : QT_TRANSLATE_NOOP("Constant", "POV"),
nwOutline.FOCUS : QT_TRN("Constant", "Focus"), nwOutline.FOCUS : QT_TRANSLATE_NOOP("Constant", "Focus"),
nwOutline.CHAR : KEY_NAME[nwKeyWords.CHAR_KEY], nwOutline.CHAR : KEY_NAME[nwKeyWords.CHAR_KEY],
nwOutline.PLOT : KEY_NAME[nwKeyWords.PLOT_KEY], nwOutline.PLOT : KEY_NAME[nwKeyWords.PLOT_KEY],
nwOutline.TIME : KEY_NAME[nwKeyWords.TIME_KEY], nwOutline.TIME : KEY_NAME[nwKeyWords.TIME_KEY],
@@ -216,7 +215,7 @@ class nwLabels():
nwOutline.OBJECT : KEY_NAME[nwKeyWords.OBJECT_KEY], nwOutline.OBJECT : KEY_NAME[nwKeyWords.OBJECT_KEY],
nwOutline.ENTITY : KEY_NAME[nwKeyWords.ENTITY_KEY], nwOutline.ENTITY : KEY_NAME[nwKeyWords.ENTITY_KEY],
nwOutline.CUSTOM : KEY_NAME[nwKeyWords.CUSTOM_KEY], nwOutline.CUSTOM : KEY_NAME[nwKeyWords.CUSTOM_KEY],
nwOutline.SYNOP : QT_TRN("Constant", "Synopsis"), nwOutline.SYNOP : QT_TRANSLATE_NOOP("Constant", "Synopsis"),
} }
# END Class nwLabels # END Class nwLabels
@@ -226,28 +225,28 @@ class nwQuotes():
Source: https://en.wikipedia.org/wiki/Quotation_mark Source: https://en.wikipedia.org/wiki/Quotation_mark
""" """
SYMBOLS = { SYMBOLS = {
"\u0027" : QT_TRN("Constant", "Straight single quotation mark"), "\u0027" : QT_TRANSLATE_NOOP("Constant", "Straight single quotation mark"),
"\u0022" : QT_TRN("Constant", "Straight double quotation mark"), "\u0022" : QT_TRANSLATE_NOOP("Constant", "Straight double quotation mark"),
"\u2018" : QT_TRN("Constant", "Left single quotation mark"), "\u2018" : QT_TRANSLATE_NOOP("Constant", "Left single quotation mark"),
"\u2019" : QT_TRN("Constant", "Right single quotation mark"), "\u2019" : QT_TRANSLATE_NOOP("Constant", "Right single quotation mark"),
"\u201a" : QT_TRN("Constant", "Single low-9 quotation mark"), "\u201a" : QT_TRANSLATE_NOOP("Constant", "Single low-9 quotation mark"),
"\u201b" : QT_TRN("Constant", "Single high-reversed-9 quotation mark"), "\u201b" : QT_TRANSLATE_NOOP("Constant", "Single high-reversed-9 quotation mark"),
"\u201c" : QT_TRN("Constant", "Left double quotation mark"), "\u201c" : QT_TRANSLATE_NOOP("Constant", "Left double quotation mark"),
"\u201d" : QT_TRN("Constant", "Right double quotation mark"), "\u201d" : QT_TRANSLATE_NOOP("Constant", "Right double quotation mark"),
"\u201e" : QT_TRN("Constant", "Double low-9 quotation mark"), "\u201e" : QT_TRANSLATE_NOOP("Constant", "Double low-9 quotation mark"),
"\u201f" : QT_TRN("Constant", "Double high-reversed-9 quotation mark"), "\u201f" : QT_TRANSLATE_NOOP("Constant", "Double high-reversed-9 quotation mark"),
"\u2e42" : QT_TRN("Constant", "Double low-reversed-9 quotation mark"), "\u2e42" : QT_TRANSLATE_NOOP("Constant", "Double low-reversed-9 quotation mark"),
"\u2039" : QT_TRN("Constant", "Single left-pointing angle quotation mark"), "\u2039" : QT_TRANSLATE_NOOP("Constant", "Single left-pointing angle quotation mark"),
"\u203a" : QT_TRN("Constant", "Single right-pointing angle quotation mark"), "\u203a" : QT_TRANSLATE_NOOP("Constant", "Single right-pointing angle quotation mark"),
"\u00ab" : QT_TRN("Constant", "Left-pointing double angle quotation mark"), "\u00ab" : QT_TRANSLATE_NOOP("Constant", "Left-pointing double angle quotation mark"),
"\u00bb" : QT_TRN("Constant", "Right-pointing double angle quotation mark"), "\u00bb" : QT_TRANSLATE_NOOP("Constant", "Right-pointing double angle quotation mark"),
"\u300c" : QT_TRN("Constant", "Left corner bracket"), "\u300c" : QT_TRANSLATE_NOOP("Constant", "Left corner bracket"),
"\u300d" : QT_TRN("Constant", "Right corner bracket"), "\u300d" : QT_TRANSLATE_NOOP("Constant", "Right corner bracket"),
"\u300e" : QT_TRN("Constant", "Left white corner bracket"), "\u300e" : QT_TRANSLATE_NOOP("Constant", "Left white corner bracket"),
"\u300f" : QT_TRN("Constant", "Right white corner bracket"), "\u300f" : QT_TRANSLATE_NOOP("Constant", "Right white corner bracket"),
} }
# END Class nwQuotes # END Class nwQuotes
+2 -6
View File
@@ -130,9 +130,7 @@ class NWDoc():
if showStatus and not isOrphan: if showStatus and not isOrphan:
self.theParent.setStatus( self.theParent.setStatus(
self.tr("{0}: {1}").format( self.tr("Opened Document: {0}").format(self._theItem.itemName)
self.tr("Opened Document"), self._theItem.itemName
)
) )
return theText return theText
@@ -178,9 +176,7 @@ class NWDoc():
if self._theItem is not None: if self._theItem is not None:
self.theParent.setStatus( self.theParent.setStatus(
self.tr("{0}: {1}").format( self.tr("Saved Document: {0}").format(self._theItem.itemName)
self.tr("Saved Document"), self._theItem.itemName
)
) )
return True return True
+2 -2
View File
@@ -1156,8 +1156,8 @@ class NWProject():
if nAuth == 1: if nAuth == 1:
authString = self.bookAuthors[0] authString = self.bookAuthors[0]
elif nAuth > 1: elif nAuth > 1:
authString = "%s and %s" % ( authString = "%s %s %s" % (
", ".join(self.bookAuthors[0:-1]), self.bookAuthors[-1] ", ".join(self.bookAuthors[0:-1]), self.tr("and"), self.bookAuthors[-1]
) )
return authString return authString
+2 -2
View File
@@ -292,8 +292,8 @@ class Tokenizer():
docSize = len(self.theText) docSize = len(self.theText)
if docSize > nwConst.MAX_DOCSIZE: if docSize > nwConst.MAX_DOCSIZE:
errVal = self.tr("Document '{0}' is too big ({1}). Skipping.").format( errVal = self.tr("Document '{0}' is too big ({1} MB). Skipping.").format(
self.theItem.itemName, f"{docSize/1.0e6:.2f} MB" self.theItem.itemName, f"{docSize/1.0e6:.2f}"
) )
self.theText = "# %s\n\n%s\n\n" % (self.tr("ERROR"), errVal) self.theText = "# %s\n\n%s\n\n" % (self.tr("ERROR"), errVal)
self.errData.append(errVal) self.errData.append(errVal)
+2 -2
View File
@@ -28,9 +28,9 @@ import nw
import logging import logging
import os import os
from time import time
from lxml import etree from lxml import etree
from hashlib import sha256 from hashlib import sha256
from time import time
from nw.core.item import NWItem from nw.core.item import NWItem
from nw.common import checkHandle from nw.common import checkHandle
@@ -199,7 +199,7 @@ class NWTree():
outFile.write("=================\n") outFile.write("=================\n")
outFile.write("\n") outFile.write("\n")
outFile.write("%-25s %-9s %-10s %s\n" % ( outFile.write("%-25s %-9s %-10s %s\n" % (
"File Name", "Class", "Layout", "Document Label", "File Name", "Class", "Layout", "Document Label"
)) ))
outFile.write("-"*tocLen + "\n") outFile.write("-"*tocLen + "\n")
outFile.write("\n".join(tocList)) outFile.write("\n".join(tocList))
+25 -23
View File
@@ -133,42 +133,44 @@ class GuiAbout(QDialog):
"""Generate the content for the About page. """Generate the content for the About page.
""" """
listPrefix = "&nbsp;&nbsp;&bull;&nbsp;&nbsp;" listPrefix = "&nbsp;&nbsp;&bull;&nbsp;&nbsp;"
aboutMsg = "".join([ webLink = f"<a href='{nw.__url__:s}'>{nw.__domain__:s}</a>"
"<h2>%s</h2>" % self.tr("About novelWriter"), aboutMsg = (
"<p>{copyright:s}.</p>", "<h2>{title1}</h2>"
"<p>%s</p>" % self.tr( "<p>{copyright}.</p>"
"Website: {0}".format("<a href='{website:s}'>{domain:s}</a>") "<p>{website}</p>"
), "<p>{intro}</p>"
"<p>%s</p>" % self.tr( "<p>{license1}</p>"
"<p>{license2}</p>"
"<p>{license3}</p>"
"<h3>{title2}</h3>"
"<p>{credits}</p>"
).format(
title1 = self.tr("About novelWriter"),
copyright = nw.__copyright__,
website = self.tr("Website: {0}").format(webLink),
title2 = self.tr("Credits"),
credits = "<br/>".join(["%s%s" % (listPrefix, x) for x in nw.__credits__]),
intro = self.tr(
"novelWriter is a markdown-like text editor designed for organising and " "novelWriter is a markdown-like text editor designed for organising and "
"writing novels. It is written in Python 3 with a Qt5 GUI, using PyQt5." "writing novels. It is written in Python 3 with a Qt5 GUI, using PyQt5."
), ),
"<p>%s</p>" % self.tr( license1 = self.tr(
"novelWriter is free software: you can redistribute it and/or modify it " "novelWriter is free software: you can redistribute it and/or modify it "
"under the terms of the GNU General Public License as published by the " "under the terms of the GNU General Public License as published by the "
"Free Software Foundation, either version 3 of the License, or (at your " "Free Software Foundation, either version 3 of the License, or (at your "
"option) any later version." "option) any later version."
), ),
"<p>%s</p>" % self.tr( license2 = self.tr(
"novelWriter is distributed in the hope that it will be useful, but " "novelWriter is distributed in the hope that it will be useful, but "
"WITHOUT ANY WARRANTY; without even the implied warranty of " "WITHOUT ANY WARRANTY; without even the implied warranty of "
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
), ),
"<p>%s</p>" % ( license3 = self.tr(
self.tr( "See the License tab for the full license text, or visit the "
"See the License tab for the full license text, or visit the " "GNU website at {0} for more details."
"GNU website at {0} for more details." ).format(
).format( "<a href='https://www.gnu.org/licenses/gpl-3.0.html'>GPL v3.0</a>"
"<a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">GPL v3.0</a>"
)
), ),
"<h3>%s</h3>" % self.tr("Credits"),
"<p>{credits:s}</p>",
]).format(
copyright = nw.__copyright__,
website = nw.__url__,
domain = nw.__domain__,
credits = "<br/>".join(["%s%s" % (listPrefix, x) for x in nw.__credits__]),
) )
theTheme = self.theParent.theTheme theTheme = self.theParent.theTheme
+7 -9
View File
@@ -986,7 +986,7 @@ class GuiBuildNovel(QDialog):
# Report to user # Report to user
if wSuccess: if wSuccess:
self.theParent.makeAlert( self.theParent.makeAlert(
"%s<br> %s" % ( "%s<br>%s" % (
self.tr("{0} file successfully written to:").format(textFmt), savePath self.tr("{0} file successfully written to:").format(textFmt), savePath
), ),
nwAlert.INFO nwAlert.INFO
@@ -1189,13 +1189,11 @@ class GuiBuildNovelDocView(QTextBrowser):
self.qDocument = self.document() self.qDocument = self.document()
self.qDocument.setDocumentMargin(self.mainConf.getTextMargin()) self.qDocument.setDocumentMargin(self.mainConf.getTextMargin())
self.setPlaceholderText( self.setPlaceholderText(self.tr(
self.tr( "This area will show the content of the document to be "
"This area will show the content of the document to be " "exported or printed. Press the \"Build Preview\" button "
"exported or printed. Press the \"Build Preview\" button " "to generate content."
"to generate content." ))
)
)
theFont = QFont() theFont = QFont()
if self.mainConf.textFont is None: if self.mainConf.textFont is None:
@@ -1225,7 +1223,7 @@ class GuiBuildNovelDocView(QTextBrowser):
fPx = int(1.1*self.theTheme.fontPixelSize) fPx = int(1.1*self.theTheme.fontPixelSize)
self.theTitle = QLabel("") self.theTitle = QLabel("", self)
self.theTitle.setIndent(0) self.theTitle.setIndent(0)
self.theTitle.setAutoFillBackground(True) self.theTitle.setAutoFillBackground(True)
self.theTitle.setAlignment(Qt.AlignCenter) self.theTitle.setAlignment(Qt.AlignCenter)
+1 -1
View File
@@ -798,7 +798,7 @@ class GuiMainMenu(QMenuBar):
# Search > Replace Next # Search > Replace Next
self.aReplaceNext = QAction(self.tr("Replace Next"), self) self.aReplaceNext = QAction(self.tr("Replace Next"), self)
self.aReplaceNext.setStatusTip( self.aReplaceNext.setStatusTip(
self.tr("Find and replace next occurrence text in document") self.tr("Find and replace next occurrence of text in document")
) )
self.aReplaceNext.setShortcut("Ctrl+Shift+1") self.aReplaceNext.setShortcut("Ctrl+Shift+1")
self.aReplaceNext.triggered.connect(lambda: self._docAction(nwDocAction.REPL_NEXT)) self.aReplaceNext.triggered.connect(lambda: self._docAction(nwDocAction.REPL_NEXT))
+5 -6
View File
@@ -27,8 +27,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
import nw import nw
import logging import logging
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP
from PyQt5.QtCore import QT_TRANSLATE_NOOP as QT_TRN
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QScrollArea, QWidget, QGridLayout, QHBoxLayout, QGroupBox, QLabel QScrollArea, QWidget, QGridLayout, QHBoxLayout, QGroupBox, QLabel
) )
@@ -41,10 +40,10 @@ logger = logging.getLogger(__name__)
class GuiOutlineDetails(QScrollArea): class GuiOutlineDetails(QScrollArea):
LVL_MAP = { LVL_MAP = {
"H1" : QT_TRN("GuiOutlineDetails", "Title"), "H1" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Title"),
"H2" : QT_TRN("GuiOutlineDetails", "Chapter"), "H2" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Chapter"),
"H3" : QT_TRN("GuiOutlineDetails", "Scene"), "H3" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Scene"),
"H4" : QT_TRN("GuiOutlineDetails", "Section"), "H4" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Section"),
} }
def __init__(self, theParent): def __init__(self, theParent):
+4 -3
View File
@@ -200,7 +200,7 @@ class GuiPreferencesGeneral(QWidget):
self.tr("Font size"), self.tr("Font size"),
self.guiFontSize, self.guiFontSize,
self.tr("Changing this requires restarting novelWriter."), self.tr("Changing this requires restarting novelWriter."),
theUnit = "pt" theUnit = self.tr("pt")
) )
# GUI Settings # GUI Settings
@@ -429,7 +429,8 @@ class GuiPreferencesProjects(QWidget):
if newDir: if newDir:
self.backupPath = newDir self.backupPath = newDir
self.mainForm.setHelpText( self.mainForm.setHelpText(
self.backupPathRow, self.tr("Path: {0}").format(self.backupPath)) self.backupPathRow, self.tr("Path: {0}").format(self.backupPath)
)
return True return True
return False return False
@@ -486,7 +487,7 @@ class GuiPreferencesDocuments(QWidget):
self.tr("Font size"), self.tr("Font size"),
self.textSize, self.textSize,
self.tr("Font size for the document editor and viewer."), self.tr("Font size for the document editor and viewer."),
theUnit = "pt" theUnit = self.tr("pt")
) )
# Text Flow # Text Flow
+5 -5
View File
@@ -186,15 +186,15 @@ class GuiProjectLoad(QDialog):
"""Browse for a folder path. """Browse for a folder path.
""" """
logger.verbose("GuiProjectLoad browse button clicked") logger.verbose("GuiProjectLoad browse button clicked")
extFilter = [
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
self.tr("All files ({0})").format("*.*"),
]
dlgOpt = QFileDialog.Options() dlgOpt = QFileDialog.Options()
dlgOpt |= QFileDialog.DontUseNativeDialog dlgOpt |= QFileDialog.DontUseNativeDialog
projFile, _ = QFileDialog.getOpenFileName( projFile, _ = QFileDialog.getOpenFileName(
self, self.tr("Open novelWriter Project"), "", self, self.tr("Open novelWriter Project"), "",
";;".join([ filter=";;".join(extFilter), options=dlgOpt
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
self.tr("All Files (*.*)"),
]),
options=dlgOpt
) )
if projFile: if projFile:
thePath = os.path.abspath(os.path.dirname(projFile)) thePath = os.path.abspath(os.path.dirname(projFile))
+1 -3
View File
@@ -327,9 +327,7 @@ class GuiProjectEditStatus(QWidget):
""" """
if self.selColour is not None: if self.selColour is not None:
newCol = QColorDialog.getColor( newCol = QColorDialog.getColor(
self.selColour, self.selColour, self, self.tr("Select Colour"),
self,
self.tr("Select Colour"),
QColorDialog.DontUseNativeDialog QColorDialog.DontUseNativeDialog
) )
if newCol.isValid(): if newCol.isValid():
+27 -33
View File
@@ -95,14 +95,12 @@ class ProjWizardIntroPage(QWizardPage):
self.theTheme = theWizard.theTheme self.theTheme = theWizard.theTheme
self.setTitle(self.tr("Create New Project")) self.setTitle(self.tr("Create New Project"))
self.theText = QLabel( self.theText = QLabel(self.tr(
self.tr( "Provide at least a working title. The working title should not "
"Provide at least a working title. The working title should not " "be change beyond this point as it is used by the application for "
"be change beyond this point as it is used by the application for " "generating file names for for instance backups. The other fields "
"generating file names for for instance backups. The other fields " "are optional and can be changed at any time in Project Settings."
"are optional and can be changed at any time in Project Settings." ))
)
)
self.theText.setWordWrap(True) self.theText.setWordWrap(True)
self.imgCredit = QLabel(self.tr("Side image by {0}, {1}").format( self.imgCredit = QLabel(self.tr("Side image by {0}, {1}").format(
@@ -166,12 +164,10 @@ class ProjWizardFolderPage(QWizardPage):
self.theTheme = theWizard.theTheme self.theTheme = theWizard.theTheme
self.setTitle(self.tr("Select Project Folder")) self.setTitle(self.tr("Select Project Folder"))
self.theText = QLabel( self.theText = QLabel(self.tr(
self.tr( "Select a location to store the project. A new project folder "
"Select a location to store the project. A new project folder " "will be created in the selected location."
"will be created in the selected location." ))
)
)
self.theText.setWordWrap(True) self.theText.setWordWrap(True)
xW = self.mainConf.pxInt(300) xW = self.mainConf.pxInt(300)
@@ -242,13 +238,11 @@ class ProjWizardPopulatePage(QWizardPage):
self.theWizard = theWizard self.theWizard = theWizard
self.setTitle(self.tr("Populate Project")) self.setTitle(self.tr("Populate Project"))
self.theText = QLabel( self.theText = QLabel(self.tr(
self.tr( "Choose how to pre-fill the project. Either with a minimal set of "
"Choose how to pre-fill the project. Either with a minimal set of " "starter items, an example project explaining and showing many of "
"starter items, an example project explaining and showing many of " "the features, or show further custom options on the next page."
"the features, or show further custom options on the next page." ))
)
)
self.theText.setWordWrap(True) self.theText.setWordWrap(True)
vS = self.mainConf.pxInt(12) vS = self.mainConf.pxInt(12)
@@ -299,13 +293,11 @@ class ProjWizardCustomPage(QWizardPage):
self.theWizard = theWizard self.theWizard = theWizard
self.setTitle(self.tr("Custom Project Options")) self.setTitle(self.tr("Custom Project Options"))
self.theText = QLabel( self.theText = QLabel(self.tr(
self.tr( "Select which additional root folders to make, and how to populate "
"Select which additional root folders to make, and how to populate " "the Novel folder. If you don't want to add chapters or scenes, set "
"the Novel folder. If you don't want to add chapters or scenes, set " "the values to 0. You can add scenes without chapters."
"the values to 0. You can add scenes without chapters." ))
)
)
self.theText.setWordWrap(True) self.theText.setWordWrap(True)
vS = self.mainConf.pxInt(12) vS = self.mainConf.pxInt(12)
@@ -419,12 +411,14 @@ class ProjWizardFinalPage(QWizardPage):
self.theWizard = theWizard self.theWizard = theWizard
self.setTitle(self.tr("Finished")) self.setTitle(self.tr("Finished"))
self.theText = QLabel("".join([ self.theText = QLabel(
"<p>%s</p>" % self.tr("All done."), "<p>{done}</p><p>{help}</p>".format(
"<p>%s</p>" % self.tr("Press '{0}' to create the new project.").format( done = self.tr("All done."),
self.tr("Done") if self.mainConf.osDarwin else self.tr("Finish") help = self.tr("Press '{0}' to create the new project.").format(
self.tr("Done") if self.mainConf.osDarwin else self.tr("Finish")
)
) )
])) )
self.theText.setWordWrap(True) self.theText.setWordWrap(True)
# Assemble # Assemble
+4 -4
View File
@@ -702,10 +702,10 @@ class GuiMain(QMainWindow):
lastPath = self.mainConf.lastPath lastPath = self.mainConf.lastPath
extFilter = [ extFilter = [
self.tr("{0} ({1})").format(self.tr("Text files"), "*.txt"), self.tr("Text files ({0})").format("*.txt"),
self.tr("{0} ({1})").format(self.tr("Markdown files"), "*.md"), self.tr("Markdown files ({0})").format("*.md"),
self.tr("{0} ({1})").format(self.tr("novelWriter files"), "*.nwd"), self.tr("novelWriter files ({0})").format("*.nwd"),
self.tr("{0} ({1})").format(self.tr("All files"), "*.*"), self.tr("All files ({0})").format("*.*"),
] ]
dlgOpt = QFileDialog.Options() dlgOpt = QFileDialog.Options()
dlgOpt |= QFileDialog.DontUseNativeDialog dlgOpt |= QFileDialog.DontUseNativeDialog