mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-09 23:24:44 +00:00
Refactor and create a menu action adding function for the bookmark actions.
This commit is contained in:
parent
5d837ae7be
commit
8f93245c26
1 changed files with 7 additions and 3 deletions
|
|
@ -170,9 +170,8 @@ class LineEdit (QtGui.QLineEdit):
|
|||
else:
|
||||
self.listview.hide()
|
||||
|
||||
def contextMenuEvent (self, event):
|
||||
"""Add Firefox bookmark action to context menu."""
|
||||
menu = self.createStandardContextMenu()
|
||||
def addMenuEntries (self, menu):
|
||||
"""Add browser bookmark actions to menu."""
|
||||
functions = (
|
||||
(find_firefox, u"Firefox"),
|
||||
(find_chrome, u"Google Chrome"),
|
||||
|
|
@ -186,6 +185,11 @@ class LineEdit (QtGui.QLineEdit):
|
|||
name = _("Insert %(browser)s bookmark file") % args
|
||||
action = menu.addAction(name)
|
||||
action.triggered.connect(lambda: self.setText(find_function()))
|
||||
|
||||
def contextMenuEvent (self, event):
|
||||
"""Handle context menu event."""
|
||||
menu = self.createStandardContextMenu()
|
||||
self.addMenuEntries(menu)
|
||||
menu.exec_(event.globalPos())
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue