mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-15 18:32:27 +12:00
Cleanup code
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
acd23e9651
commit
414cd0f8a3
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue