From 414cd0f8a35f5d9aca1d2605b8ad6fa1971a99e2 Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Mon, 30 Jan 2023 23:19:33 +0100 Subject: [PATCH] Cleanup code Signed-off-by: TheJackiMonster --- manuskript/ui/editors/mainEditor.py | 18 +++++++++--------- manuskript/ui/views/textEditView.py | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/manuskript/ui/editors/mainEditor.py b/manuskript/ui/editors/mainEditor.py index 7ee4300b..33027be6 100644 --- a/manuskript/ui/editors/mainEditor.py +++ b/manuskript/ui/editors/mainEditor.py @@ -337,28 +337,28 @@ class mainEditor(QWidget, Ui_mainEditor): if settings.progressChars: self.lblRedacWC.setText(self.tr("({} chars) {} words / {} ").format( - locale.format("%d", cc, grouping=True), - locale.format("%d", wc, grouping=True), - locale.format("%d", goal, grouping=True))) + locale.format_string("%d", cc, grouping=True), + locale.format_string("%d", wc, grouping=True), + locale.format_string("%d", goal, grouping=True))) self.lblRedacWC.setToolTip("") else: self.lblRedacWC.setText(self.tr("{} words / {} ").format( - locale.format("%d", wc, grouping=True), - locale.format("%d", goal, grouping=True))) + locale.format_string("%d", wc, grouping=True), + locale.format_string("%d", goal, grouping=True))) self.lblRedacWC.setToolTip(self.tr("{} chars").format( - locale.format("%d", cc, grouping=True))) + locale.format_string("%d", cc, grouping=True))) else: self.lblRedacProgress.hide() if settings.progressChars: self.lblRedacWC.setText(self.tr("{} chars ").format( - locale.format("%d", cc, grouping=True))) + locale.format_string("%d", cc, grouping=True))) self.lblRedacWC.setToolTip("") else: self.lblRedacWC.setText(self.tr("{} words ").format( - locale.format("%d", wc, grouping=True))) + locale.format_string("%d", wc, grouping=True))) self.lblRedacWC.setToolTip(self.tr("{} chars").format( - locale.format("%d", cc, grouping=True))) + locale.format_string("%d", cc, grouping=True))) ############################################################################### # VIEWS diff --git a/manuskript/ui/views/textEditView.py b/manuskript/ui/views/textEditView.py index b26a20c2..fe17c84d 100644 --- a/manuskript/ui/views/textEditView.py +++ b/manuskript/ui/views/textEditView.py @@ -569,7 +569,7 @@ class textEditView(QTextEdit): suggestions = [] # Check for any suggestions for corrections at the cursors position - if self._dict != None: + if self._dict is not None: text = self.toPlainText() suggestions = self._dict.findSuggestions(text, cursor.selectionStart(), cursor.selectionEnd()) @@ -598,7 +598,7 @@ class textEditView(QTextEdit): popup_menu = self.appendContextMenuEntriesForWord(popup_menu, selectedWord) - if len(suggestions) > 0 or selectedWord != None: + if len(suggestions) > 0 or selectedWord is not None: valid = len(suggestions) == 0 if not valid: @@ -611,7 +611,7 @@ class textEditView(QTextEdit): spell_menu = QMenu(self.tr('Spelling Suggestions'), self) spell_menu.setIcon(F.themeIcon("spelling")) - if (match.end > match.start and selectedWord == None): + if match.end > match.start and selectedWord is None: # Select the actual area of the match cursor = self.textCursor() cursor.setPosition(match.start, QTextCursor.MoveAnchor); @@ -642,7 +642,7 @@ class textEditView(QTextEdit): correct_menu = None correct_action = None - if (len(match.replacements) > 0 and match.end > match.start): + if len(match.replacements) > 0 and match.end > match.start: # Select the actual area of the match cursor = self.textCursor() cursor.setPosition(match.start, QTextCursor.MoveAnchor); @@ -658,7 +658,7 @@ class textEditView(QTextEdit): action.correct.connect(self.correctWord) correct_menu.addAction(action) - if correct_menu == None: + if correct_menu is None: correct_action = QAction(self.tr('&Correction Suggestion'), popup_menu) correct_action.setIcon(F.themeIcon("spelling")) correct_action.setEnabled(False) @@ -670,10 +670,10 @@ class textEditView(QTextEdit): for i in range(0, len(msg_lines)): popup_menu.insertSection(popup_menu.actions()[0], msg_lines[len(msg_lines) - (i + 1)]) - if correct_menu != None: - popup_menu.insertMenu(popup_menu.actions()[0], correct_menu) - else: + if correct_menu is None: popup_menu.insertAction(popup_menu.actions()[0], correct_action) + else: + popup_menu.insertMenu(popup_menu.actions()[0], correct_menu) # If word was added to custom dict, give the possibility to remove it elif self._dict.isCustomWord(selectedWord):