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.btnBox = QDialogButtonBox(QDialogButtonBox.Close)
|
||||
self.btnBox.button(QDialogButtonBox.Close).setText(self.tr("Close"))
|
||||
self.btnBox.rejected.connect(self._doClose)
|
||||
|
||||
# Assemble
|
||||
|
||||
@@ -97,7 +97,6 @@ class GuiAbout(QDialog):
|
||||
|
||||
# OK Button
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
|
||||
self.buttonBox.button(QDialogButtonBox.Ok).setText(self.tr("OK"))
|
||||
self.buttonBox.accepted.connect(self._doClose)
|
||||
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
|
||||
+1
-3
@@ -858,10 +858,8 @@ class GuiBuildNovel(QDialog):
|
||||
if not os.path.isdir(saveDir):
|
||||
saveDir = self.mainConf.homePath
|
||||
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
savePath, _ = QFileDialog.getSaveFileName(
|
||||
self, self.tr("Save Document As"), savePath, options=dlgOpt
|
||||
self, self.tr("Save Document As"), savePath
|
||||
)
|
||||
if not savePath:
|
||||
return False
|
||||
|
||||
@@ -500,8 +500,6 @@ class QuotesDialog(QDialog):
|
||||
|
||||
# Buttons
|
||||
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.rejected.connect(self._doReject)
|
||||
|
||||
|
||||
@@ -66,8 +66,6 @@ class GuiDocMerge(QDialog):
|
||||
self.listBox.setMinimumHeight(self.mainConf.pxInt(180))
|
||||
|
||||
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.rejected.connect(self._doClose)
|
||||
|
||||
|
||||
@@ -82,8 +82,6 @@ class GuiDocSplit(QDialog):
|
||||
self.splitLevel.currentIndexChanged.connect(self._populateList)
|
||||
|
||||
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.rejected.connect(self._doClose)
|
||||
|
||||
|
||||
@@ -117,8 +117,6 @@ class GuiItemEditor(QDialog):
|
||||
|
||||
# Buttons
|
||||
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.rejected.connect(self._doClose)
|
||||
|
||||
|
||||
@@ -70,8 +70,6 @@ class GuiPreferences(PagedDialog):
|
||||
self.addTab(self.tabAuto, self.tr("Automation"))
|
||||
|
||||
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.rejected.connect(self._doClose)
|
||||
self.addControls(self.buttonBox)
|
||||
@@ -440,11 +438,8 @@ class GuiPreferencesProjects(QWidget):
|
||||
if not os.path.isdir(currDir):
|
||||
currDir = ""
|
||||
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.ShowDirsOnly
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
newDir = QFileDialog.getExistingDirectory(
|
||||
self, self.tr("Backup Directory"), currDir, options=dlgOpt
|
||||
newDir = QFileDialog.getExistingDirectory(
|
||||
self, self.tr("Backup Directory"), currDir, options=QFileDialog.ShowDirsOnly
|
||||
)
|
||||
if newDir:
|
||||
self.backupPath = newDir
|
||||
|
||||
+1
-6
@@ -127,8 +127,6 @@ class GuiProjectLoad(QDialog):
|
||||
self.innerBox.addLayout(self.projectForm)
|
||||
|
||||
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.rejected.connect(self._doCancel)
|
||||
|
||||
@@ -190,11 +188,8 @@ class GuiProjectLoad(QDialog):
|
||||
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
|
||||
self.tr("All files ({0})").format("*.*"),
|
||||
]
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
projFile, _ = QFileDialog.getOpenFileName(
|
||||
self, self.tr("Open novelWriter Project"), "",
|
||||
filter=";;".join(extFilter), options=dlgOpt
|
||||
self, self.tr("Open novelWriter Project"), "", filter=";;".join(extFilter)
|
||||
)
|
||||
if 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.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.rejected.connect(self._doClose)
|
||||
self.addControls(self.buttonBox)
|
||||
@@ -330,8 +328,7 @@ class GuiProjectEditStatus(QWidget):
|
||||
"""
|
||||
if self.selColour is not None:
|
||||
newCol = QColorDialog.getColor(
|
||||
self.selColour, self, self.tr("Select Colour"),
|
||||
QColorDialog.DontUseNativeDialog
|
||||
self.selColour, self, self.tr("Select Colour")
|
||||
)
|
||||
if newCol.isValid():
|
||||
self.selColour = newCol
|
||||
|
||||
@@ -211,11 +211,8 @@ class ProjWizardFolderPage(QWizardPage):
|
||||
if not os.path.isdir(lastPath):
|
||||
lastPath = ""
|
||||
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.ShowDirsOnly
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
projDir = QFileDialog.getExistingDirectory(
|
||||
self, self.tr("Select Project Folder"), lastPath, options=dlgOpt
|
||||
self, self.tr("Select Project Folder"), lastPath, options=QFileDialog.ShowDirsOnly
|
||||
)
|
||||
if projDir:
|
||||
projName = self.field("projName")
|
||||
|
||||
@@ -90,8 +90,6 @@ class GuiWordList(QDialog):
|
||||
self.editBox.addWidget(self.delButton, 0)
|
||||
|
||||
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.rejected.connect(self._doClose)
|
||||
|
||||
|
||||
@@ -259,7 +259,6 @@ class GuiWritingStats(QDialog):
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
self.btnClose = self.buttonBox.addButton(QDialogButtonBox.Close)
|
||||
self.buttonBox.button(QDialogButtonBox.Close).setText(self.tr("Close"))
|
||||
self.btnClose.setAutoDefault(False)
|
||||
|
||||
self.btnSave = self.buttonBox.addButton(self.tr("Save As"), QDialogButtonBox.ActionRole)
|
||||
@@ -369,10 +368,8 @@ class GuiWritingStats(QDialog):
|
||||
fileName = "sessionStats.%s" % fileExt
|
||||
savePath = os.path.join(saveDir, fileName)
|
||||
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
savePath, _ = QFileDialog.getSaveFileName(
|
||||
self, self.tr("Save Data As"), savePath, options=dlgOpt
|
||||
self, self.tr("Save Data As"), savePath
|
||||
)
|
||||
if not savePath:
|
||||
return False
|
||||
|
||||
+1
-22
@@ -550,11 +550,6 @@ class GuiMain(QMainWindow):
|
||||
logger.error("No project open")
|
||||
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
|
||||
|
||||
@@ -707,11 +702,8 @@ class GuiMain(QMainWindow):
|
||||
self.tr("novelWriter files ({0})").format("*.nwd"),
|
||||
self.tr("All files ({0})").format("*.*"),
|
||||
]
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
loadFile, _ = QFileDialog.getOpenFileName(
|
||||
self, self.tr("Import File"), lastPath,
|
||||
options=dlgOpt, filter=";;".join(extFilter)
|
||||
self, self.tr("Import File"), lastPath, filter=";;".join(extFilter)
|
||||
)
|
||||
if not loadFile:
|
||||
return False
|
||||
@@ -931,19 +923,6 @@ class GuiMain(QMainWindow):
|
||||
# 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):
|
||||
"""Opens the projects dialog for selecting either existing
|
||||
projects from a cache of recently opened projects, or provide a
|
||||
|
||||
Reference in New Issue
Block a user