Clean up code and tests

This commit is contained in:
Veronica Berglyd Olsen
2023-08-07 20:20:04 +02:00
parent 90f9fa4451
commit 3911bc10c6
19 changed files with 131 additions and 159 deletions
+1 -2
View File
@@ -310,7 +310,7 @@ class GuiManuscriptBuild(QDialog):
self.buildProgress.setValue(0)
bPath = Path(self.buildPath.text())
if not bPath.is_dir():
self.mainGui.makeAlert(self.tr("Output folder does not exist."), nwAlert.ERROR)
self.mainGui.makeAlert(self.tr("Output folder does not exist."), level=nwAlert.ERROR)
return False
bExt = nwLabels.BUILD_EXT[bFormat]
@@ -318,7 +318,6 @@ class GuiManuscriptBuild(QDialog):
if buildPath.exists():
if not self.mainGui.askQuestion(
self.tr("File Exists"),
self.tr("The file already exists. Do you want to overwrite it?")
):
return False
+1 -5
View File
@@ -270,11 +270,7 @@ class GuiManuscript(QDialog):
"""Delete the currently selected build settings entry."""
build = self._getSelectedBuild()
if build is not None:
proceed = self.mainGui.askQuestion(
self.tr("Delete Build"),
self.tr("Delete build '{0}'?".format(build.name))
)
if proceed:
if self.mainGui.askQuestion(self.tr("Delete build '{0}'?".format(build.name))):
self._builds.removeBuild(build.buildID)
self._updateBuildsList()
return
+1 -5
View File
@@ -248,11 +248,7 @@ class GuiBuildSettings(QDialog):
it's ok to reject them.
"""
if self._build.changed:
doSave = self.mainGui.askQuestion(
self.tr("Build Settings"),
self.tr("Do you want to save your changes?")
)
if doSave:
if self.mainGui.askQuestion(self.tr("Do you want to save your changes?")):
self._emitBuildData()
self._build.resetChangedState()
return
+8 -6
View File
@@ -415,13 +415,15 @@ class GuiWritingStats(QDialog):
# Report to user
if wSuccess:
self.mainGui.makeAlert([
self.tr("{0} file successfully written to:").format(textFmt), savePath
], nwAlert.INFO)
self.mainGui.makeAlert(
self.tr("{0} file successfully written to:").format(textFmt),
info=savePath
)
else:
self.mainGui.makeAlert([
self.tr("Failed to write {0} file.").format(textFmt), errMsg
], nwAlert.ERROR)
self.mainGui.makeAlert(
self.tr("Failed to write {0} file.").format(textFmt),
info=errMsg, level=nwAlert.ERROR
)
return wSuccess