Remove translations of standard buttons and switch to native file dialogs
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+1
-6
@@ -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)
|
||||||
|
|
||||||
@@ -190,11 +188,8 @@ class GuiProjectLoad(QDialog):
|
|||||||
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 novelWriter 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")
|
||||||
|
|||||||
@@ -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
|
||||||
)
|
)
|
||||||
if not savePath:
|
if not savePath:
|
||||||
return False
|
return False
|
||||||
|
|||||||
+1
-22
@@ -550,11 +550,6 @@ 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:
|
if self.theProject.projPath is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -707,11 +702,8 @@ class GuiMain(QMainWindow):
|
|||||||
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 +923,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
|
||||||
|
|||||||
Reference in New Issue
Block a user