Fix Python 3.7 DeprecationWarning use local.format_string() messages

Fix by replacing locale.format() with locale.format_string().
This commit is contained in:
Curtis Gedak 2018-11-10 12:28:19 -07:00
parent 7f592bae41
commit 60b58d9658
3 changed files with 8 additions and 8 deletions

View file

@ -224,12 +224,12 @@ class outlineItem(abstractItem):
wc = 0 wc = 0
if goal: if goal:
return qApp.translate("outlineItem", "{} words / {} ({})").format( return qApp.translate("outlineItem", "{} words / {} ({})").format(
locale.format("%d", wc, grouping=True), locale.format_string("%d", wc, grouping=True),
locale.format("%d", goal, grouping=True), locale.format_string("%d", goal, grouping=True),
"{}%".format(str(int(progress * 100)))) "{}%".format(str(int(progress * 100))))
else: else:
return qApp.translate("outlineItem", "{} words").format( return qApp.translate("outlineItem", "{} words").format(
locale.format("%d", wc, grouping=True)) locale.format_string("%d", wc, grouping=True))
####################################################################### #######################################################################
# Tools: split and merge # Tools: split and merge

View file

@ -318,12 +318,12 @@ class mainEditor(QWidget, Ui_mainEditor):
del p del p
self.lblRedacProgress.setPixmap(self.px) self.lblRedacProgress.setPixmap(self.px)
self.lblRedacWC.setText(self.tr("{} words / {} ").format( self.lblRedacWC.setText(self.tr("{} words / {} ").format(
locale.format("%d", wc, grouping=True), locale.format_string("%d", wc, grouping=True),
locale.format("%d", goal, grouping=True))) locale.format_string("%d", goal, grouping=True)))
else: else:
self.lblRedacProgress.hide() self.lblRedacProgress.hide()
self.lblRedacWC.setText(self.tr("{} words ").format( self.lblRedacWC.setText(self.tr("{} words ").format(
locale.format("%d", wc, grouping=True))) locale.format_string("%d", wc, grouping=True)))
############################################################################### ###############################################################################
# VIEWS # VIEWS

View file

@ -349,8 +349,8 @@ class welcome(QWidget, Ui_welcome):
total = 0 total = 0
self.lblTotal.setText(self.tr("<b>Total:</b> {} words (~ {} pages)").format( self.lblTotal.setText(self.tr("<b>Total:</b> {} words (~ {} pages)").format(
locale.format("%d", total, grouping=True), locale.format_string("%d", total, grouping=True),
locale.format("%d", total / 250, grouping=True) locale.format_string("%d", total / 250, grouping=True)
)) ))
def addTopLevelItem(self, name): def addTopLevelItem(self, name):