mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 23:57:13 -05:00
when context menu activated outside editor, show only copy
This commit is contained in:
parent
e99b5610c5
commit
07b859ff98
2 changed files with 16 additions and 5 deletions
|
|
@ -1127,3 +1127,13 @@ class EditorWebView(AnkiWebView):
|
||||||
return
|
return
|
||||||
html = mime.html()
|
html = mime.html()
|
||||||
mime.setHtml("<!--anki-->" + mime.html())
|
mime.setHtml("<!--anki-->" + mime.html())
|
||||||
|
|
||||||
|
def contextMenuEvent(self, evt):
|
||||||
|
m = QMenu(self)
|
||||||
|
a = m.addAction(_("Cut"))
|
||||||
|
a.connect(a, SIGNAL("activated()"), self.onCut)
|
||||||
|
a = m.addAction(_("Copy"))
|
||||||
|
a.connect(a, SIGNAL("activated()"), self.onCopy)
|
||||||
|
a = m.addAction(_("Paste"))
|
||||||
|
a.connect(a, SIGNAL("activated()"), self.onPaste)
|
||||||
|
m.popup(QCursor.pos())
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,14 @@ class AnkiWebView(QWebView):
|
||||||
QWebView.keyPressEvent(self, evt)
|
QWebView.keyPressEvent(self, evt)
|
||||||
|
|
||||||
def contextMenuEvent(self, evt):
|
def contextMenuEvent(self, evt):
|
||||||
|
# lazy: only run in reviewer
|
||||||
|
import aqt
|
||||||
|
if aqt.mw.state != "review":
|
||||||
|
return
|
||||||
m = QMenu(self)
|
m = QMenu(self)
|
||||||
a = m.addAction(_("Cut"))
|
|
||||||
a.connect(a, SIGNAL("activated()"), self.onCut)
|
|
||||||
a = m.addAction(_("Copy"))
|
a = m.addAction(_("Copy"))
|
||||||
a.connect(a, SIGNAL("activated()"), self.onCopy)
|
a.connect(a, SIGNAL("activated()"),
|
||||||
a = m.addAction(_("Paste"))
|
lambda: self.triggerPageAction(QWebPage.Copy))
|
||||||
a.connect(a, SIGNAL("activated()"), self.onPaste)
|
|
||||||
m.popup(QCursor.pos())
|
m.popup(QCursor.pos())
|
||||||
|
|
||||||
def dropEvent(self, evt):
|
def dropEvent(self, evt):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue