mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a copy to clipboard action to the context menu for the spell check dialog
This commit is contained in:
parent
003058d9ea
commit
d6e7df6b6f
@ -794,9 +794,19 @@ class WordsView(QTableView):
|
|||||||
a.setMenu(am)
|
a.setMenu(am)
|
||||||
for dic in sorted(dictionaries.active_user_dictionaries, key=lambda x:sort_key(x.name)):
|
for dic in sorted(dictionaries.active_user_dictionaries, key=lambda x:sort_key(x.name)):
|
||||||
am.addAction(dic.name, partial(self.add_all.emit, dic.name))
|
am.addAction(dic.name, partial(self.add_all.emit, dic.name))
|
||||||
|
m.addSeparator()
|
||||||
|
m.addAction(_('Copy selected words to clipboard'), self.copy_to_clipboard)
|
||||||
|
|
||||||
m.exec_(ev.globalPos())
|
m.exec_(ev.globalPos())
|
||||||
|
|
||||||
|
def copy_to_clipboard(self):
|
||||||
|
rows = {i.row() for i in self.selectedIndexes()}
|
||||||
|
words = {self.model().word_for_row(r) for r in rows}
|
||||||
|
words.discard(None)
|
||||||
|
words = sorted({w[0] for w in words}, key=sort_key)
|
||||||
|
if words:
|
||||||
|
QApplication.clipboard().setText('\n'.join(words))
|
||||||
|
|
||||||
class SpellCheck(Dialog):
|
class SpellCheck(Dialog):
|
||||||
|
|
||||||
work_finished = pyqtSignal(object, object)
|
work_finished = pyqtSignal(object, object)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user