mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Spell check dialog: Allow sorting words case sensitively
This commit is contained in:
parent
d022c7e012
commit
2d76655ddc
@ -45,6 +45,7 @@ d['pretty_print_on_open'] = False
|
|||||||
d['disable_completion_popup_for_search'] = False
|
d['disable_completion_popup_for_search'] = False
|
||||||
d['saved_searches'] = []
|
d['saved_searches'] = []
|
||||||
d['insert_tag_mru'] = ['p', 'div', 'li', 'h1', 'h2', 'h3', 'h4', 'em', 'strong', 'td', 'tr']
|
d['insert_tag_mru'] = ['p', 'div', 'li', 'h1', 'h2', 'h3', 'h4', 'em', 'strong', 'td', 'tr']
|
||||||
|
d['spell_check_case_sensitive_sort'] = False
|
||||||
|
|
||||||
del d
|
del d
|
||||||
|
|
||||||
|
@ -584,8 +584,9 @@ class WordsModel(QAbstractTableModel):
|
|||||||
|
|
||||||
def sort_key(self, col):
|
def sort_key(self, col):
|
||||||
if col == 0:
|
if col == 0:
|
||||||
|
f = (lambda x: x) if tprefs['spell_check_case_sensitive_sort'] else primary_sort_key
|
||||||
def key(w):
|
def key(w):
|
||||||
return primary_sort_key(w[0])
|
return f(w[0])
|
||||||
elif col == 1:
|
elif col == 1:
|
||||||
def key(w):
|
def key(w):
|
||||||
return len(self.words[w])
|
return len(self.words[w])
|
||||||
@ -807,12 +808,22 @@ class SpellCheck(Dialog):
|
|||||||
l.addWidget(sl)
|
l.addWidget(sl)
|
||||||
|
|
||||||
hh.setSectionHidden(3, m.show_only_misspelt)
|
hh.setSectionHidden(3, m.show_only_misspelt)
|
||||||
self.show_only_misspelled = om = QCheckBox(_('Show only misspelled words'))
|
self.show_only_misspelled = om = QCheckBox(_('Show &only misspelled words'))
|
||||||
om.setChecked(m.show_only_misspelt)
|
om.setChecked(m.show_only_misspelt)
|
||||||
om.stateChanged.connect(self.update_show_only_misspelt)
|
om.stateChanged.connect(self.update_show_only_misspelt)
|
||||||
|
self.case_sensitive_sort = cs = QCheckBox(_('Case &sensitive sort'))
|
||||||
|
cs.setChecked(tprefs['spell_check_case_sensitive_sort'])
|
||||||
|
cs.stateChanged.connect(self.sort_type_changed)
|
||||||
self.hb = h = QHBoxLayout()
|
self.hb = h = QHBoxLayout()
|
||||||
self.summary = s = QLabel('')
|
self.summary = s = QLabel('')
|
||||||
self.main.l.addLayout(h), h.addWidget(s), h.addWidget(om), h.addStretch(10)
|
self.main.l.addLayout(h), h.addWidget(s), h.addWidget(om), h.addWidget(cs), h.addStretch(1)
|
||||||
|
|
||||||
|
def sort_type_changed(self):
|
||||||
|
tprefs['spell_check_case_sensitive_sort'] = bool(self.case_sensitive_sort.isChecked())
|
||||||
|
if self.words_model.sort_on[0] == 0:
|
||||||
|
with self:
|
||||||
|
hh = self.words_view.horizontalHeader()
|
||||||
|
self.words_view.sortByColumn(hh.sortIndicatorSection(), hh.sortIndicatorOrder())
|
||||||
|
|
||||||
def show_next_occurrence(self):
|
def show_next_occurrence(self):
|
||||||
self.word_activated(self.words_view.currentIndex())
|
self.word_activated(self.words_view.currentIndex())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user