mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-28 05:25:29 +01: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
1 changed files with 10 additions and 0 deletions
|
|
@ -794,9 +794,19 @@ def contextMenuEvent(self, ev):
|
|||
a.setMenu(am)
|
||||
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))
|
||||
m.addSeparator()
|
||||
m.addAction(_('Copy selected words to clipboard'), self.copy_to_clipboard)
|
||||
|
||||
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):
|
||||
|
||||
work_finished = pyqtSignal(object, object)
|
||||
|
|
|
|||
Loading…
Reference in a new issue