diff --git a/src/cutecoin/gui/identities_tab.py b/src/cutecoin/gui/identities_tab.py index dd395728a93d3a57e2f1678b80fdc369a71bc92b..f774a59df1dd8347f45e9725fb348704c2881f99 100644 --- a/src/cutecoin/gui/identities_tab.py +++ b/src/cutecoin/gui/identities_tab.py @@ -125,11 +125,16 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): view_wot.triggered.connect(self.view_wot) view_wot.setData(identity) + copy_pubkey = QAction(self.tr("Copy pubkey"), self) + copy_pubkey.triggered.connect(self.copy_identity_pubkey) + copy_pubkey.setData(identity) + menu.addAction(informations) menu.addAction(add_contact) menu.addAction(send_money) menu.addAction(certify) menu.addAction(view_wot) + menu.addAction(copy_pubkey) # Show the context menu. menu.popup(QCursor.pos()) @@ -175,6 +180,17 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): yield from CertificationDialog.certify_identity(self.app, self.account, self.password_asker, self.community, identity) + def copy_identity_pubkey(self): + """ + Copy the identity pubkey to the clipboard + + :param cutecoin.core.registry.Identity identity: The identity + """ + identity = self.sender().data() + cb = self.app.qapp.clipboard() + cb.clear(mode=cb.Clipboard) + cb.setText(identity.pubkey, mode=cb.Clipboard) + def view_wot(self): identity = self.sender().data() self.view_in_wot.emit(identity) diff --git a/src/cutecoin/gui/views/wot.py b/src/cutecoin/gui/views/wot.py index cfa426ac44fb1bbd0a7ae47c1fcf9a93a92c8d70..cae6725a83fa2602c953609018c35dd80897adf6 100644 --- a/src/cutecoin/gui/views/wot.py +++ b/src/cutecoin/gui/views/wot.py @@ -63,6 +63,7 @@ class Scene(QGraphicsScene): node_transaction = pyqtSignal(dict, name='nodeTransaction') node_contact = pyqtSignal(dict, name='nodeContact') node_member = pyqtSignal(dict, name='nodeMember') + node_copy_pubkey = pyqtSignal(dict, name='nodeCopyPubkey') def __init__(self, parent=None): """ @@ -308,6 +309,12 @@ class Node(QGraphicsEllipseItem): self.action_sign = QAction(QCoreApplication.translate('WoT.Node', 'Certify identity'), self.scene()) self.menu.addAction(self.action_sign) self.action_sign.triggered.connect(self.sign_action) + #Â action copy identity pubkey + QT_TRANSLATE_NOOP('WoT.Node', 'Copy pubkey') + self.action_copy = QAction(QCoreApplication.translate('WoT.Node', 'Copy pubkey'), self.scene()) + self.menu.addAction(self.action_copy) + self.action_copy.triggered.connect(self.copy_action) + # run menu self.menu.exec(event.screenPos()) @@ -340,6 +347,13 @@ class Node(QGraphicsEllipseItem): # trigger scene signal self.scene().node_signed.emit(self.metadata) + def copy_action(self): + """ + Copy identity node pubkey + """ + # trigger scene signal + self.scene().node_copy_pubkey.emit(self.metadata) + def transaction_action(self): """ Transaction action to identity node diff --git a/src/cutecoin/gui/wot_tab.py b/src/cutecoin/gui/wot_tab.py index 4d06eef500ac95c0bc54f84ac1e75640b6334972..d8fd80815893417261d6c845d7e71cd3d4ea69ca 100644 --- a/src/cutecoin/gui/wot_tab.py +++ b/src/cutecoin/gui/wot_tab.py @@ -50,6 +50,7 @@ class WotTabWidget(QWidget, Ui_WotTabWidget): self.graphicsView.scene().node_transaction.connect(self.send_money_to_node) self.graphicsView.scene().node_contact.connect(self.add_node_as_contact) self.graphicsView.scene().node_member.connect(self.identity_informations) + self.graphicsView.scene().node_copy_pubkey.connect(self.copy_node_pubkey) self.account = None self.community = None @@ -334,6 +335,11 @@ class WotTabWidget(QWidget, Ui_WotTabWidget): if result == QDialog.Accepted: self.money_sent.emit() + def copy_node_pubkey(self, metadata): + cb = self.app.qapp.clipboard() + cb.clear(mode=cb.Clipboard) + cb.setText(metadata['id'], mode=cb.Clipboard) + def add_node_as_contact(self, metadata): # check if contact already exists... if metadata['id'] == self.account.pubkey \