diff --git a/src/cutecoin/gui/community_tab.py b/src/cutecoin/gui/community_tab.py index d12cd9d0f98b001a75ddfbfbe62710bfe2fb808d..4ae8ed19402704c4feb917b1de20976c037696b9 100644 --- a/src/cutecoin/gui/community_tab.py +++ b/src/cutecoin/gui/community_tab.py @@ -27,13 +27,19 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): classdocs ''' - def __init__(self, account, community, password_asker): - ''' - Constructor - ''' + def __init__(self, account, community, password_asker, parent): + """ + Init + :param cutecoin.core.account.Account account: Accoun instance + :param cutecoin.core.community.Community community: Community instance + :param cutecoin.gui.password_asker.PasswordAskerDialog password_asker: Password asker dialog + :param cutecoin.gui.currency_tab.CurrencyTabWidget parent: TabWidget instance + :return: + """ super().__init__() logging.debug("Info") self.setupUi(self) + self.parent = parent self.community = community self.account = account self.password_asker = password_asker @@ -124,8 +130,12 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): self.window().refresh_contacts() def send_money_to_member(self, person): + if isinstance(person, str): + pubkey = person + else: + pubkey = person.pubkey dialog = TransferMoneyDialog(self.account, self.password_asker) - dialog.edit_pubkey.setText(person.pubkey) + dialog.edit_pubkey.setText(pubkey) dialog.combo_community.setCurrentText(self.community.name) dialog.radio_pubkey.setChecked(True) if dialog.exec_() == QDialog.Accepted: @@ -141,10 +151,12 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): def view_wot(self): person = self.sender().data() - index_wot_tab = self.tabs_information.indexOf(self.wot_tab) # redraw WoT with this member selected - self.wot_tab.draw_graph(person.pubkey) + self.wot_tab.draw_graph({'text': person.uid, 'id': person.pubkey}) # change page to WoT + index_community_tab = self.parent.tabs_account.indexOf(self) + self.parent.tabs_account.setCurrentIndex(index_community_tab) + index_wot_tab = self.tabs_information.indexOf(self.wot_tab) self.tabs_information.setCurrentIndex(index_wot_tab) def send_membership_demand(self): diff --git a/src/cutecoin/gui/contact.py b/src/cutecoin/gui/contact.py index a753de202864aee35ab44c27925702b8d7f0c3c1..284bda8aa27caf30dde2d4b82da1f7fd639332e0 100644 --- a/src/cutecoin/gui/contact.py +++ b/src/cutecoin/gui/contact.py @@ -28,7 +28,7 @@ class ConfigureContactDialog(QDialog, Ui_ConfigureContactDialog): self.main_window = parent self.index_edit = index_edit if type(contact) is Person: - self.contact = {'name': contact.name, + self.contact = {'name': contact.uid, 'pubkey': contact.pubkey} elif type(contact) is dict: self.contact = contact diff --git a/src/cutecoin/gui/currency_tab.py b/src/cutecoin/gui/currency_tab.py index 56b130b866485cb64877cc6161d4ce50e7a1a357..f162c2ce92ff48471371474313da99273612fdc5 100644 --- a/src/cutecoin/gui/currency_tab.py +++ b/src/cutecoin/gui/currency_tab.py @@ -38,8 +38,9 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): self.status_label = status_label logging.debug("Com") self.tab_community = CommunityTabWidget(self.app.current_account, - self.community, - self.password_asker) + self.community, + self.password_asker, + self) logging.debug("Wal") self.tab_wallets = WalletsTabWidget(self.app, self.app.current_account, @@ -105,7 +106,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): self.tab_community = CommunityTabWidget(self.app.current_account, self.community, - self.password_asker) + self.password_asker, + self) self.tabs_account.addTab(self.tab_community, QIcon(':/icons/community_icon'), "Community") diff --git a/src/cutecoin/gui/transactions_tab.py b/src/cutecoin/gui/transactions_tab.py index f367d562dc4d3504d31d00da9f1ca456850d22c7..43e61eec393520f446feb37150603e4fb5113f59 100644 --- a/src/cutecoin/gui/transactions_tab.py +++ b/src/cutecoin/gui/transactions_tab.py @@ -17,8 +17,16 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): def __init__(self, app, community, password_asker, currency_tab): """ - Constructor + Init + + :param cutecoin.core.app.Application app: Application instance + :param cutecoin.core.community.Community community: Community instance + :param cutecoin.gui.password_asker.PasswordAskerDialog password_asker: Password dialog instance + :param cutecoin.gui.currency_tab.CurrencyTabWidget currency_tab: Currency tab widget + :return: """ + + super().__init__() self.setupUi(self) self.app = app @@ -80,11 +88,34 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): cancel.triggered.connect(self.cancel_transfer) cancel.setData(transfer) menu.addAction(cancel) + else: + if isinstance(person, Person): + informations = QAction("Informations", self) + informations.triggered.connect(self.currency_tab.tab_community.menu_informations) + informations.setData(person) + menu.addAction(informations) + + add_as_contact = QAction("Add as contact", self) + add_as_contact.triggered.connect(self.currency_tab.tab_community.menu_add_as_contact) + add_as_contact.setData(person) + menu.addAction(add_as_contact) + + send_money = QAction("Send money to", self) + send_money.triggered.connect(self.currency_tab.tab_community.menu_send_money) + send_money.setData(person) + menu.addAction(send_money) + + if isinstance(person, Person): + view_wot = QAction("View in WoT", self) + view_wot.triggered.connect(self.currency_tab.tab_community.view_wot) + view_wot.setData(person) + menu.addAction(view_wot) copy_pubkey = QAction("Copy pubkey to clipboard", self) copy_pubkey.triggered.connect(self.copy_pubkey_to_clipboard) copy_pubkey.setData(person) menu.addAction(copy_pubkey) + # Show the context menu. menu.exec_(QCursor.pos())