Fix translations and refactor makeAlert calls
This commit is contained in:
+10
-15
@@ -747,11 +747,10 @@ class GuiBuildNovel(QDialog):
|
||||
tEnd = int(time())
|
||||
logger.debug("Built project in %.3f ms" % (1000*(tEnd - tStart)))
|
||||
|
||||
if bldObj.errData:
|
||||
self.theParent.makeAlert("%s:<br>- %s" % (
|
||||
self.tr("There were problems when building the project"),
|
||||
"<br>- ".join(bldObj.errData)), nwAlert.ERROR
|
||||
)
|
||||
if bldObj.errData and isinstance(bldObj.errData, list):
|
||||
self.theParent.makeAlert([
|
||||
self.tr("There were problems when building the project:")
|
||||
] + bldObj.errData, nwAlert.ERROR)
|
||||
|
||||
return
|
||||
|
||||
@@ -998,17 +997,13 @@ class GuiBuildNovel(QDialog):
|
||||
# ==============
|
||||
|
||||
if wSuccess:
|
||||
self.theParent.makeAlert(
|
||||
"%s<br>%s" % (
|
||||
self.tr("{0} file successfully written to:").format(textFmt), savePath
|
||||
),
|
||||
nwAlert.INFO
|
||||
)
|
||||
self.theParent.makeAlert([
|
||||
self.tr("{0} file successfully written to:").format(textFmt), savePath
|
||||
], nwAlert.INFO)
|
||||
else:
|
||||
self.theParent.makeAlert(
|
||||
self.tr("Failed to write {0} file. {1}").format(textFmt, errMsg),
|
||||
nwAlert.ERROR
|
||||
)
|
||||
self.theParent.makeAlert(self.tr(
|
||||
"Failed to write {0} file. {1}"
|
||||
).format(textFmt, errMsg), nwAlert.ERROR)
|
||||
|
||||
return wSuccess
|
||||
|
||||
|
||||
+10
-14
@@ -412,17 +412,13 @@ class GuiWritingStats(QDialog):
|
||||
|
||||
# Report to user
|
||||
if wSuccess:
|
||||
self.theParent.makeAlert(
|
||||
"%s file successfully written to:<br>%s" % (
|
||||
textFmt, savePath
|
||||
), nwAlert.INFO
|
||||
)
|
||||
self.theParent.makeAlert([
|
||||
self.tr("{0} file successfully written to:").format(textFmt), savePath
|
||||
], nwAlert.INFO)
|
||||
else:
|
||||
self.theParent.makeAlert(
|
||||
"Failed to write %s file.<br>%s" % (
|
||||
textFmt, errMsg
|
||||
), nwAlert.ERROR
|
||||
)
|
||||
self.theParent.makeAlert([
|
||||
self.tr("Failed to write {0} file.").format(textFmt), errMsg
|
||||
], nwAlert.ERROR)
|
||||
|
||||
return wSuccess
|
||||
|
||||
@@ -487,9 +483,9 @@ class GuiWritingStats(QDialog):
|
||||
self.logData.append((dStart, sDiff, wcNovel, wcNotes, sIdle))
|
||||
|
||||
except Exception as e:
|
||||
self.theParent.makeAlert(
|
||||
[self.tr("Failed to read session log file."), str(e)], nwAlert.ERROR
|
||||
)
|
||||
self.theParent.makeAlert([
|
||||
self.tr("Failed to read session log file."), str(e)
|
||||
], nwAlert.ERROR)
|
||||
return False
|
||||
|
||||
ttWords = ttNovel + ttNotes
|
||||
@@ -505,7 +501,7 @@ class GuiWritingStats(QDialog):
|
||||
# Slots
|
||||
##
|
||||
|
||||
def _updateListBox(self, dummyVar=None):
|
||||
def _updateListBox(self):
|
||||
"""Load/reload the content of the list box. The dummyVar
|
||||
variable captures the variable sent from the widgets connecting
|
||||
to it and discards it.
|
||||
|
||||
Reference in New Issue
Block a user