Properly renamed qrcode plugin module and made menu available

for all address entries except for addressbook and blacklist
This commit is contained in:
Dmitri Bogomolov 2017-03-07 15:44:48 +02:00
parent 77e779638c
commit 08a2115412
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
3 changed files with 26 additions and 14 deletions

View File

@ -112,8 +112,7 @@ if __name__ == "__main__":
zip_safe=False,
entry_points={
'bitmessage.gui.menu': [
'popMenuYourIdentities.qrcode = '
'pybitmessage.plugins.qrcodeui [qrcode]'
'address.qrcode = pybitmessage.plugins.menu_qrcode [qrcode]'
],
'bitmessage.notification.message': [
'notify2 = pybitmessage.plugins.notification_notify2'

View File

@ -255,6 +255,18 @@ class MyForm(settingsmixin.SMainWindow):
'customContextMenuRequested(const QPoint&)'),
self.on_context_menuYourIdentities)
# load all gui.menu plugins with prefix 'address'
self.menu_plugins = {'address': []}
for plugin in get_plugins('gui.menu', 'address'):
try:
handler, title = plugin(self)
except TypeError:
continue
self.menu_plugins['address'].append(
self.ui.addressContextMenuToolbarYourIdentities.addAction(
title, handler
))
def init_chan_popup_menu(self, connectSignal=True):
# Popup menu for the Channels tab
self.ui.addressContextMenuToolbar = QtGui.QToolBar()
@ -3421,6 +3433,10 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuSubscriptions.addSeparator()
self.popMenuSubscriptions.addAction(self.actionsubscriptionsClipboard)
self.popMenuSubscriptions.addSeparator()
# preloaded gui.menu plugins with prefix 'address'
for plugin in self.menu_plugins['address']:
self.popMenuSubscriptions.addAction(plugin)
self.popMenuSubscriptions.addSeparator()
self.popMenuSubscriptions.addAction(self.actionMarkAllRead)
self.popMenuSubscriptions.exec_(
self.ui.treeWidgetSubscriptions.mapToGlobal(point))
@ -3831,13 +3847,12 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuYourIdentities.addAction(self.actionSpecialAddressBehaviorYourIdentities)
self.popMenuYourIdentities.addAction(self.actionEmailGateway)
self.popMenuYourIdentities.addSeparator()
# preloaded gui.menu plugins with prefix 'address'
for plugin in self.menu_plugins['address']:
self.popMenuYourIdentities.addAction(plugin)
self.popMenuYourIdentities.addSeparator()
self.popMenuYourIdentities.addAction(self.actionMarkAllRead)
if get_plugins:
for plugin in get_plugins(
'gui.menu', 'popMenuYourIdentities'):
plugin(self)
self.popMenuYourIdentities.exec_(
self.ui.treeWidgetYourIdentities.mapToGlobal(point))
@ -3857,6 +3872,10 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenu.addAction(self.actionEnable)
self.popMenu.addAction(self.actionSetAvatar)
self.popMenu.addSeparator()
# preloaded gui.menu plugins with prefix 'address'
for plugin in self.menu_plugins['address']:
self.popMenu.addAction(plugin)
self.popMenu.addSeparator()
self.popMenu.addAction(self.actionMarkAllRead)
self.popMenu.exec_(
self.ui.treeWidgetChans.mapToGlobal(point))

View File

@ -73,10 +73,4 @@ def connect_plugin(form):
dialog.render(str(form.getCurrentAccount()))
dialog.exec_()
# return
form.actionShowQRCode = \
form.ui.addressContextMenuToolbarYourIdentities.addAction(
_translate("MainWindow", "Show QR-code"),
on_action_ShowQR
)
form.popMenuYourIdentities.addAction(form.actionShowQRCode)
return on_action_ShowQR, _translate("MainWindow", "Show QR-code")