Skip to content
Snippets Groups Projects
Commit 4c6a5c10 authored by Vincent Texier's avatar Vincent Texier
Browse files

More menus in transactions context menu

parent 4f9e8b62
Branches
Tags
No related merge requests found
...@@ -27,13 +27,19 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): ...@@ -27,13 +27,19 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
classdocs classdocs
''' '''
def __init__(self, account, community, password_asker): def __init__(self, account, community, password_asker, parent):
''' """
Constructor 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__() super().__init__()
logging.debug("Info") logging.debug("Info")
self.setupUi(self) self.setupUi(self)
self.parent = parent
self.community = community self.community = community
self.account = account self.account = account
self.password_asker = password_asker self.password_asker = password_asker
...@@ -124,8 +130,12 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): ...@@ -124,8 +130,12 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
self.window().refresh_contacts() self.window().refresh_contacts()
def send_money_to_member(self, person): 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 = 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.combo_community.setCurrentText(self.community.name)
dialog.radio_pubkey.setChecked(True) dialog.radio_pubkey.setChecked(True)
if dialog.exec_() == QDialog.Accepted: if dialog.exec_() == QDialog.Accepted:
...@@ -141,10 +151,12 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): ...@@ -141,10 +151,12 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
def view_wot(self): def view_wot(self):
person = self.sender().data() person = self.sender().data()
index_wot_tab = self.tabs_information.indexOf(self.wot_tab)
# redraw WoT with this member selected # 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 # 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) self.tabs_information.setCurrentIndex(index_wot_tab)
def send_membership_demand(self): def send_membership_demand(self):
......
...@@ -28,7 +28,7 @@ class ConfigureContactDialog(QDialog, Ui_ConfigureContactDialog): ...@@ -28,7 +28,7 @@ class ConfigureContactDialog(QDialog, Ui_ConfigureContactDialog):
self.main_window = parent self.main_window = parent
self.index_edit = index_edit self.index_edit = index_edit
if type(contact) is Person: if type(contact) is Person:
self.contact = {'name': contact.name, self.contact = {'name': contact.uid,
'pubkey': contact.pubkey} 'pubkey': contact.pubkey}
elif type(contact) is dict: elif type(contact) is dict:
self.contact = contact self.contact = contact
......
...@@ -39,7 +39,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): ...@@ -39,7 +39,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
logging.debug("Com") logging.debug("Com")
self.tab_community = CommunityTabWidget(self.app.current_account, self.tab_community = CommunityTabWidget(self.app.current_account,
self.community, self.community,
self.password_asker) self.password_asker,
self)
logging.debug("Wal") logging.debug("Wal")
self.tab_wallets = WalletsTabWidget(self.app, self.tab_wallets = WalletsTabWidget(self.app,
self.app.current_account, self.app.current_account,
...@@ -105,7 +106,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): ...@@ -105,7 +106,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
self.tab_community = CommunityTabWidget(self.app.current_account, self.tab_community = CommunityTabWidget(self.app.current_account,
self.community, self.community,
self.password_asker) self.password_asker,
self)
self.tabs_account.addTab(self.tab_community, self.tabs_account.addTab(self.tab_community,
QIcon(':/icons/community_icon'), QIcon(':/icons/community_icon'),
"Community") "Community")
......
...@@ -17,8 +17,16 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): ...@@ -17,8 +17,16 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
def __init__(self, app, community, password_asker, currency_tab): 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__() super().__init__()
self.setupUi(self) self.setupUi(self)
self.app = app self.app = app
...@@ -80,11 +88,34 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): ...@@ -80,11 +88,34 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
cancel.triggered.connect(self.cancel_transfer) cancel.triggered.connect(self.cancel_transfer)
cancel.setData(transfer) cancel.setData(transfer)
menu.addAction(cancel) 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 = QAction("Copy pubkey to clipboard", self)
copy_pubkey.triggered.connect(self.copy_pubkey_to_clipboard) copy_pubkey.triggered.connect(self.copy_pubkey_to_clipboard)
copy_pubkey.setData(person) copy_pubkey.setData(person)
menu.addAction(copy_pubkey) menu.addAction(copy_pubkey)
# Show the context menu. # Show the context menu.
menu.exec_(QCursor.pos()) menu.exec_(QCursor.pos())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment