Merge pull request #684 from vkbo/qt_translations
Qt Widget Translations
This commit is contained in:
@@ -0,0 +1,74 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Dummy Qt Translation File
|
||||||
|
=========================
|
||||||
|
|
||||||
|
This file causes Qt Linguist to generate translation entries for the Qt
|
||||||
|
elements that need translation in novelWriter for those languages who do
|
||||||
|
not yet have a qtbase_xx.qm file shipped with Qt.
|
||||||
|
|
||||||
|
If a qtbase_xx.qm file already exists, do not add a translation for the
|
||||||
|
entries generated from this file.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from PyQt5.QtCore import QT_TRANSLATE_NOOP
|
||||||
|
|
||||||
|
# QDialogButtonBox
|
||||||
|
# ================
|
||||||
|
|
||||||
|
QT_TRANSLATE_NOOP("QDialogButtonBox", "OK")
|
||||||
|
|
||||||
|
# QGnomeTheme
|
||||||
|
# ===========
|
||||||
|
|
||||||
|
QT_TRANSLATE_NOOP("QGnomeTheme", "&OK")
|
||||||
|
QT_TRANSLATE_NOOP("QGnomeTheme", "&Save")
|
||||||
|
QT_TRANSLATE_NOOP("QGnomeTheme", "&Cancel")
|
||||||
|
QT_TRANSLATE_NOOP("QGnomeTheme", "&Close")
|
||||||
|
QT_TRANSLATE_NOOP("QGnomeTheme", "Close without Saving")
|
||||||
|
|
||||||
|
# QGuiApplication
|
||||||
|
# ===============
|
||||||
|
|
||||||
|
QT_TRANSLATE_NOOP("QGuiApplication", (
|
||||||
|
"Translate this string to the string 'LTR' in left-to-right languages or to "
|
||||||
|
"'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout."
|
||||||
|
))
|
||||||
|
|
||||||
|
# QPlatformTheme
|
||||||
|
# ==============
|
||||||
|
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "OK")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Save")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Save All")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Open")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "&Yes")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Yes to &All")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "&No")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "N&o to All")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Abort")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Retry")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Ignore")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Close")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Cancel")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Discard")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Help")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Apply")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Reset")
|
||||||
|
QT_TRANSLATE_NOOP("QPlatformTheme", "Restore Defaults")
|
||||||
|
|
||||||
|
# QWizard
|
||||||
|
# =======
|
||||||
|
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "Go Back")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "< &Back")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "Continue")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "&Next")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "&Next >")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "Commit")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "Done")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "&Finish")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "Cancel")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "Cancel")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "Help")
|
||||||
|
QT_TRANSLATE_NOOP("QWizard", "&Help")
|
||||||
+418
-342
File diff suppressed because it is too large
Load Diff
+418
-342
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
i18n/dummy_qtbase.py \
|
||||||
nw/constants/constants.py \
|
nw/constants/constants.py \
|
||||||
nw/core/document.py \
|
nw/core/document.py \
|
||||||
nw/core/project.py \
|
nw/core/project.py \
|
||||||
|
|||||||
+4
-4
@@ -221,14 +221,14 @@ def main(sysArgs=None):
|
|||||||
"At least Python 3.6.0 is required, found %s." % CONFIG.verPyString
|
"At least Python 3.6.0 is required, found %s." % CONFIG.verPyString
|
||||||
)
|
)
|
||||||
errorCode |= 4
|
errorCode |= 4
|
||||||
if CONFIG.verQtValue < 50200:
|
if CONFIG.verQtValue < 50300:
|
||||||
errorData.append(
|
errorData.append(
|
||||||
"At least Qt5 version 5.2 is required, found %s." % CONFIG.verQtString
|
"At least Qt5 version 5.3 is required, found %s." % CONFIG.verQtString
|
||||||
)
|
)
|
||||||
errorCode |= 8
|
errorCode |= 8
|
||||||
if CONFIG.verPyQtValue < 50200:
|
if CONFIG.verPyQtValue < 50300:
|
||||||
errorData.append(
|
errorData.append(
|
||||||
"At least PyQt5 version 5.2 is required, found %s." % CONFIG.verPyQtString
|
"At least PyQt5 version 5.3 is required, found %s." % CONFIG.verPyQtString
|
||||||
)
|
)
|
||||||
errorCode |= 16
|
errorCode |= 16
|
||||||
|
|
||||||
|
|||||||
@@ -377,7 +377,6 @@ class Config:
|
|||||||
self.qtTrans = {}
|
self.qtTrans = {}
|
||||||
|
|
||||||
langList = [
|
langList = [
|
||||||
(self.qtLangPath, "qt"), # Qt 4.x
|
|
||||||
(self.qtLangPath, "qtbase"), # Qt 5.x
|
(self.qtLangPath, "qtbase"), # Qt 5.x
|
||||||
(self.nwLangPath, "qtbase"), # Alternative Qt 5.x
|
(self.nwLangPath, "qtbase"), # Alternative Qt 5.x
|
||||||
(self.nwLangPath, "nw"), # novelWriter
|
(self.nwLangPath, "nw"), # novelWriter
|
||||||
|
|||||||
+1
-1
@@ -583,7 +583,7 @@ class NWProject():
|
|||||||
if errList:
|
if errList:
|
||||||
self.makeAlert(errList, nwAlert.ERROR)
|
self.makeAlert(errList, nwAlert.ERROR)
|
||||||
|
|
||||||
# Clean up old files
|
# Clean up no longer used files
|
||||||
self._deprecatedFiles()
|
self._deprecatedFiles()
|
||||||
|
|
||||||
# Update recent projects
|
# Update recent projects
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ class ToMarkdown(Tokenizer):
|
|||||||
self.FMT_D_B : "", self.FMT_D_E : "",
|
self.FMT_D_B : "", self.FMT_D_E : "",
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
# GitHub and novelWriter
|
# GitHub
|
||||||
mdTags = {
|
mdTags = {
|
||||||
self.FMT_B_B : "**", self.FMT_B_E : "**",
|
self.FMT_B_B : "**", self.FMT_B_E : "**",
|
||||||
self.FMT_I_B : "_", self.FMT_I_E : "_",
|
self.FMT_I_B : "_", self.FMT_I_E : "_",
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ class NWErrorMessage(QDialog):
|
|||||||
self.msgBody.setReadOnly(True)
|
self.msgBody.setReadOnly(True)
|
||||||
|
|
||||||
self.btnBox = QDialogButtonBox(QDialogButtonBox.Close)
|
self.btnBox = QDialogButtonBox(QDialogButtonBox.Close)
|
||||||
self.btnBox.button(QDialogButtonBox.Close).setText(self.tr("Close"))
|
|
||||||
self.btnBox.rejected.connect(self._doClose)
|
self.btnBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
# Assemble
|
# Assemble
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ class GuiAbout(QDialog):
|
|||||||
|
|
||||||
# OK Button
|
# OK Button
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
|
||||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr("OK"))
|
|
||||||
self.buttonBox.accepted.connect(self._doClose)
|
self.buttonBox.accepted.connect(self._doClose)
|
||||||
|
|
||||||
self.outerBox.addLayout(self.innerBox)
|
self.outerBox.addLayout(self.innerBox)
|
||||||
|
|||||||
+1
-3
@@ -858,10 +858,8 @@ class GuiBuildNovel(QDialog):
|
|||||||
if not os.path.isdir(saveDir):
|
if not os.path.isdir(saveDir):
|
||||||
saveDir = self.mainConf.homePath
|
saveDir = self.mainConf.homePath
|
||||||
|
|
||||||
dlgOpt = QFileDialog.Options()
|
|
||||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
|
||||||
savePath, _ = QFileDialog.getSaveFileName(
|
savePath, _ = QFileDialog.getSaveFileName(
|
||||||
self, self.tr("Save Document As"), savePath, options=dlgOpt
|
self, self.tr("Save Document As"), savePath
|
||||||
)
|
)
|
||||||
if not savePath:
|
if not savePath:
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -500,8 +500,6 @@ class QuotesDialog(QDialog):
|
|||||||
|
|
||||||
# Buttons
|
# Buttons
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr("OK"))
|
|
||||||
self.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))
|
|
||||||
self.buttonBox.accepted.connect(self._doAccept)
|
self.buttonBox.accepted.connect(self._doAccept)
|
||||||
self.buttonBox.rejected.connect(self._doReject)
|
self.buttonBox.rejected.connect(self._doReject)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2050,7 +2050,7 @@ class GuiDocEditSearch(QFrame):
|
|||||||
self._alertSearchValid(theRegEx.isValid())
|
self._alertSearchValid(theRegEx.isValid())
|
||||||
return theRegEx
|
return theRegEx
|
||||||
|
|
||||||
elif self.mainConf.verQtValue >= 50300:
|
else: # >= 50300 to < 51300
|
||||||
if self.isCaseSense:
|
if self.isCaseSense:
|
||||||
rxOpt = Qt.CaseSensitive
|
rxOpt = Qt.CaseSensitive
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -66,8 +66,6 @@ class GuiDocMerge(QDialog):
|
|||||||
self.listBox.setMinimumHeight(self.mainConf.pxInt(180))
|
self.listBox.setMinimumHeight(self.mainConf.pxInt(180))
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr("OK"))
|
|
||||||
self.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))
|
|
||||||
self.buttonBox.accepted.connect(self._doMerge)
|
self.buttonBox.accepted.connect(self._doMerge)
|
||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
|
|||||||
@@ -82,8 +82,6 @@ class GuiDocSplit(QDialog):
|
|||||||
self.splitLevel.currentIndexChanged.connect(self._populateList)
|
self.splitLevel.currentIndexChanged.connect(self._populateList)
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr("OK"))
|
|
||||||
self.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))
|
|
||||||
self.buttonBox.accepted.connect(self._doSplit)
|
self.buttonBox.accepted.connect(self._doSplit)
|
||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
|
|||||||
@@ -117,8 +117,6 @@ class GuiItemEditor(QDialog):
|
|||||||
|
|
||||||
# Buttons
|
# Buttons
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr("OK"))
|
|
||||||
self.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))
|
|
||||||
self.buttonBox.accepted.connect(self._doSave)
|
self.buttonBox.accepted.connect(self._doSave)
|
||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
|
|||||||
@@ -70,8 +70,6 @@ class GuiPreferences(PagedDialog):
|
|||||||
self.addTab(self.tabAuto, self.tr("Automation"))
|
self.addTab(self.tabAuto, self.tr("Automation"))
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr("OK"))
|
|
||||||
self.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))
|
|
||||||
self.buttonBox.accepted.connect(self._doSave)
|
self.buttonBox.accepted.connect(self._doSave)
|
||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
self.addControls(self.buttonBox)
|
self.addControls(self.buttonBox)
|
||||||
@@ -440,11 +438,8 @@ class GuiPreferencesProjects(QWidget):
|
|||||||
if not os.path.isdir(currDir):
|
if not os.path.isdir(currDir):
|
||||||
currDir = ""
|
currDir = ""
|
||||||
|
|
||||||
dlgOpt = QFileDialog.Options()
|
newDir = QFileDialog.getExistingDirectory(
|
||||||
dlgOpt |= QFileDialog.ShowDirsOnly
|
self, self.tr("Backup Directory"), currDir, options=QFileDialog.ShowDirsOnly
|
||||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
|
||||||
newDir = QFileDialog.getExistingDirectory(
|
|
||||||
self, self.tr("Backup Directory"), currDir, options=dlgOpt
|
|
||||||
)
|
)
|
||||||
if newDir:
|
if newDir:
|
||||||
self.backupPath = newDir
|
self.backupPath = newDir
|
||||||
|
|||||||
+2
-7
@@ -127,8 +127,6 @@ class GuiProjectLoad(QDialog):
|
|||||||
self.innerBox.addLayout(self.projectForm)
|
self.innerBox.addLayout(self.projectForm)
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Open | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Open | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.button(QDialogButtonBox.Open).setText(self.tr("Open"))
|
|
||||||
self.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))
|
|
||||||
self.buttonBox.accepted.connect(self._doOpenRecent)
|
self.buttonBox.accepted.connect(self._doOpenRecent)
|
||||||
self.buttonBox.rejected.connect(self._doCancel)
|
self.buttonBox.rejected.connect(self._doCancel)
|
||||||
|
|
||||||
@@ -188,13 +186,10 @@ class GuiProjectLoad(QDialog):
|
|||||||
logger.verbose("GuiProjectLoad browse button clicked")
|
logger.verbose("GuiProjectLoad browse button clicked")
|
||||||
extFilter = [
|
extFilter = [
|
||||||
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
|
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
|
||||||
self.tr("All files ({0})").format("*.*"),
|
self.tr("All files ({0})").format("*"),
|
||||||
]
|
]
|
||||||
dlgOpt = QFileDialog.Options()
|
|
||||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
|
||||||
projFile, _ = QFileDialog.getOpenFileName(
|
projFile, _ = QFileDialog.getOpenFileName(
|
||||||
self, self.tr("Open novelWriter Project"), "",
|
self, self.tr("Open Project"), "", filter=";;".join(extFilter)
|
||||||
filter=";;".join(extFilter), options=dlgOpt
|
|
||||||
)
|
)
|
||||||
if projFile:
|
if projFile:
|
||||||
thePath = os.path.abspath(os.path.dirname(projFile))
|
thePath = os.path.abspath(os.path.dirname(projFile))
|
||||||
|
|||||||
@@ -77,8 +77,6 @@ class GuiProjectSettings(PagedDialog):
|
|||||||
self.addTab(self.tabReplace, self.tr("Auto-Replace"))
|
self.addTab(self.tabReplace, self.tr("Auto-Replace"))
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr("OK"))
|
|
||||||
self.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))
|
|
||||||
self.buttonBox.accepted.connect(self._doSave)
|
self.buttonBox.accepted.connect(self._doSave)
|
||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
self.addControls(self.buttonBox)
|
self.addControls(self.buttonBox)
|
||||||
@@ -330,8 +328,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, self.tr("Select Colour"),
|
self.selColour, self, self.tr("Select Colour")
|
||||||
QColorDialog.DontUseNativeDialog
|
|
||||||
)
|
)
|
||||||
if newCol.isValid():
|
if newCol.isValid():
|
||||||
self.selColour = newCol
|
self.selColour = newCol
|
||||||
|
|||||||
@@ -211,11 +211,8 @@ class ProjWizardFolderPage(QWizardPage):
|
|||||||
if not os.path.isdir(lastPath):
|
if not os.path.isdir(lastPath):
|
||||||
lastPath = ""
|
lastPath = ""
|
||||||
|
|
||||||
dlgOpt = QFileDialog.Options()
|
|
||||||
dlgOpt |= QFileDialog.ShowDirsOnly
|
|
||||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
|
||||||
projDir = QFileDialog.getExistingDirectory(
|
projDir = QFileDialog.getExistingDirectory(
|
||||||
self, self.tr("Select Project Folder"), lastPath, options=dlgOpt
|
self, self.tr("Select Project Folder"), lastPath, options=QFileDialog.ShowDirsOnly
|
||||||
)
|
)
|
||||||
if projDir:
|
if projDir:
|
||||||
projName = self.field("projName")
|
projName = self.field("projName")
|
||||||
@@ -412,9 +409,9 @@ class ProjWizardFinalPage(QWizardPage):
|
|||||||
|
|
||||||
self.setTitle(self.tr("Finished"))
|
self.setTitle(self.tr("Finished"))
|
||||||
self.theText = QLabel(
|
self.theText = QLabel(
|
||||||
"<p>{done}</p><p>{help}</p>".format(
|
"<p>%s</p><p>%s</p>" % (
|
||||||
done = self.tr("All done."),
|
self.tr("All done."),
|
||||||
help = self.tr("Press '{0}' to create the new project.").format(
|
self.tr("Press '{0}' to create the new project.").format(
|
||||||
self.tr("Done") if self.mainConf.osDarwin else self.tr("Finish")
|
self.tr("Done") if self.mainConf.osDarwin else self.tr("Finish")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -90,8 +90,6 @@ class GuiWordList(QDialog):
|
|||||||
self.editBox.addWidget(self.delButton, 0)
|
self.editBox.addWidget(self.delButton, 0)
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
|
||||||
self.buttonBox.button(QDialogButtonBox.Save).setText(self.tr("Save"))
|
|
||||||
self.buttonBox.button(QDialogButtonBox.Close).setText(self.tr("Close"))
|
|
||||||
self.buttonBox.accepted.connect(self._doSave)
|
self.buttonBox.accepted.connect(self._doSave)
|
||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
|
|||||||
@@ -259,7 +259,6 @@ class GuiWritingStats(QDialog):
|
|||||||
self.buttonBox.rejected.connect(self._doClose)
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
self.btnClose = self.buttonBox.addButton(QDialogButtonBox.Close)
|
self.btnClose = self.buttonBox.addButton(QDialogButtonBox.Close)
|
||||||
self.buttonBox.button(QDialogButtonBox.Close).setText(self.tr("Close"))
|
|
||||||
self.btnClose.setAutoDefault(False)
|
self.btnClose.setAutoDefault(False)
|
||||||
|
|
||||||
self.btnSave = self.buttonBox.addButton(self.tr("Save As"), QDialogButtonBox.ActionRole)
|
self.btnSave = self.buttonBox.addButton(self.tr("Save As"), QDialogButtonBox.ActionRole)
|
||||||
@@ -369,10 +368,8 @@ class GuiWritingStats(QDialog):
|
|||||||
fileName = "sessionStats.%s" % fileExt
|
fileName = "sessionStats.%s" % fileExt
|
||||||
savePath = os.path.join(saveDir, fileName)
|
savePath = os.path.join(saveDir, fileName)
|
||||||
|
|
||||||
dlgOpt = QFileDialog.Options()
|
|
||||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
|
||||||
savePath, _ = QFileDialog.getSaveFileName(
|
savePath, _ = QFileDialog.getSaveFileName(
|
||||||
self, self.tr("Save Data As"), savePath, options=dlgOpt
|
self, self.tr("Save Data As"), savePath, "%s (*.%s)" % (textFmt, fileExt)
|
||||||
)
|
)
|
||||||
if not savePath:
|
if not savePath:
|
||||||
return False
|
return False
|
||||||
|
|||||||
+4
-28
@@ -550,17 +550,9 @@ class GuiMain(QMainWindow):
|
|||||||
logger.error("No project open")
|
logger.error("No project open")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# If the project is new, it may not have a path, so we need one
|
|
||||||
if self.theProject.projPath is None:
|
|
||||||
projPath = self.selectProjectPath()
|
|
||||||
self.theProject.setProjectPath(projPath)
|
|
||||||
|
|
||||||
if self.theProject.projPath is None:
|
|
||||||
return False
|
|
||||||
|
|
||||||
self.treeView.saveTreeOrder()
|
self.treeView.saveTreeOrder()
|
||||||
self.theProject.saveProject(autoSave=autoSave)
|
if self.theProject.saveProject(autoSave=autoSave):
|
||||||
self.theIndex.saveIndex()
|
self.theIndex.saveIndex()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -705,13 +697,10 @@ class GuiMain(QMainWindow):
|
|||||||
self.tr("Text files ({0})").format("*.txt"),
|
self.tr("Text files ({0})").format("*.txt"),
|
||||||
self.tr("Markdown files ({0})").format("*.md"),
|
self.tr("Markdown files ({0})").format("*.md"),
|
||||||
self.tr("novelWriter files ({0})").format("*.nwd"),
|
self.tr("novelWriter files ({0})").format("*.nwd"),
|
||||||
self.tr("All files ({0})").format("*.*"),
|
self.tr("All files ({0})").format("*"),
|
||||||
]
|
]
|
||||||
dlgOpt = QFileDialog.Options()
|
|
||||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
|
||||||
loadFile, _ = QFileDialog.getOpenFileName(
|
loadFile, _ = QFileDialog.getOpenFileName(
|
||||||
self, self.tr("Import File"), lastPath,
|
self, self.tr("Import File"), lastPath, filter=";;".join(extFilter)
|
||||||
options=dlgOpt, filter=";;".join(extFilter)
|
|
||||||
)
|
)
|
||||||
if not loadFile:
|
if not loadFile:
|
||||||
return False
|
return False
|
||||||
@@ -931,19 +920,6 @@ class GuiMain(QMainWindow):
|
|||||||
# Main Dialogs
|
# Main Dialogs
|
||||||
##
|
##
|
||||||
|
|
||||||
def selectProjectPath(self):
|
|
||||||
"""Select where to save project.
|
|
||||||
"""
|
|
||||||
dlgOpt = QFileDialog.Options()
|
|
||||||
dlgOpt |= QFileDialog.ShowDirsOnly
|
|
||||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
|
||||||
projPath = QFileDialog.getExistingDirectory(
|
|
||||||
self, self.tr("Save novelWriter Project"), "", options=dlgOpt
|
|
||||||
)
|
|
||||||
if projPath:
|
|
||||||
return projPath
|
|
||||||
return None
|
|
||||||
|
|
||||||
def showProjectLoadDialog(self):
|
def showProjectLoadDialog(self):
|
||||||
"""Opens the projects dialog for selecting either existing
|
"""Opens the projects dialog for selecting either existing
|
||||||
projects from a cache of recently opened projects, or provide a
|
projects from a cache of recently opened projects, or provide a
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from PyQt5.QtCore import QItemSelectionModel
|
from PyQt5.QtCore import QItemSelectionModel
|
||||||
from PyQt5.QtWidgets import QListWidgetItem, QDialog, QFileDialog, QMessageBox
|
from PyQt5.QtWidgets import QListWidgetItem, QDialog, QMessageBox
|
||||||
|
|
||||||
from nw.gui.custom import QuotesDialog
|
from nw.gui.custom import QuotesDialog
|
||||||
|
|
||||||
@@ -59,14 +59,3 @@ def testGuiDialogs_Quotes(qtbot, monkeypatch, nwGUI, nwMinimal):
|
|||||||
nwQuot.close()
|
nwQuot.close()
|
||||||
|
|
||||||
# END Test testDialogs_Quotes
|
# END Test testDialogs_Quotes
|
||||||
|
|
||||||
@pytest.mark.gui
|
|
||||||
def testGuiDialogs_Other(qtbot, monkeypatch, nwGUI, tmpDir):
|
|
||||||
"""Various other dialog tests.
|
|
||||||
"""
|
|
||||||
monkeypatch.setattr(QFileDialog, "getExistingDirectory", lambda *args, **kwargs: tmpDir)
|
|
||||||
assert nwGUI.selectProjectPath() == tmpDir
|
|
||||||
|
|
||||||
# qtbot.stopForInteraction()
|
|
||||||
|
|
||||||
# END Test testGuiDialogs_Other
|
|
||||||
|
|||||||
Reference in New Issue
Block a user