Skip to content
Snippets Groups Projects
Commit ddf1577a authored by inso's avatar inso
Browse files

Added a transfer to wallet feature

parent 71ea58c2
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,6 @@ class NetworkWatcher(QObject): ...@@ -19,7 +19,6 @@ class NetworkWatcher(QObject):
@pyqtSlot() @pyqtSlot()
def watch(self): def watch(self):
#self.community.network.moveToThread(self.thread())
self.community.network.start_perpetual_crawling() self.community.network.start_perpetual_crawling()
@pyqtSlot() @pyqtSlot()
......
...@@ -46,7 +46,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): ...@@ -46,7 +46,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
self.password_asker) self.password_asker)
self.tab_wallets = WalletsTabWidget(self.app, self.tab_wallets = WalletsTabWidget(self.app,
self.app.current_account, self.app.current_account,
self.community) self.community,
self.password_asker)
self.tab_network = NetworkTabWidget(self.community) self.tab_network = NetworkTabWidget(self.community)
...@@ -131,7 +132,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): ...@@ -131,7 +132,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
self.tab_wallets = WalletsTabWidget(self.app, self.tab_wallets = WalletsTabWidget(self.app,
self.app.current_account, self.app.current_account,
self.community) self.community,
self.password_asker)
self.tabs_account.addTab(self.tab_wallets, self.tabs_account.addTab(self.tab_wallets,
QIcon(':/icons/wallet_icon'), QIcon(':/icons/wallet_icon'),
"Wallets") "Wallets")
......
...@@ -5,12 +5,13 @@ Created on 15 févr. 2015 ...@@ -5,12 +5,13 @@ Created on 15 févr. 2015
''' '''
import logging import logging
from PyQt5.QtWidgets import QWidget, QMenu, QAction, QApplication from PyQt5.QtWidgets import QWidget, QMenu, QAction, QApplication, QDialog
from PyQt5.QtCore import QDateTime, QModelIndex, Qt from PyQt5.QtCore import QDateTime, QModelIndex, Qt
from PyQt5.QtGui import QCursor from PyQt5.QtGui import QCursor
from ..core.person import Person from ..core.person import Person
from ..core.wallet import Wallet from ..core.wallet import Wallet
from ..models.wallets import WalletsTableModel, WalletsFilterProxyModel from ..models.wallets import WalletsTableModel, WalletsFilterProxyModel
from .transfer import TransferMoneyDialog
from ..tools.exceptions import MembershipNotFoundError from ..tools.exceptions import MembershipNotFoundError
from ..gen_resources.wallets_tab_uic import Ui_WalletsTab from ..gen_resources.wallets_tab_uic import Ui_WalletsTab
...@@ -20,7 +21,7 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): ...@@ -20,7 +21,7 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
classdocs classdocs
''' '''
def __init__(self, app, account, community): def __init__(self, app, account, community, password_asker):
''' '''
Constructor Constructor
''' '''
...@@ -29,6 +30,7 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): ...@@ -29,6 +30,7 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
self.app = app self.app = app
self.account = account self.account = account
self.community = community self.community = community
self.password_asker = password_asker
self.refresh() self.refresh()
...@@ -82,11 +84,12 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): ...@@ -82,11 +84,12 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
<tr><td align="right"><b>{:}</b></td><td>{:}</td></tr> <tr><td align="right"><b>{:}</b></td><td>{:}</td></tr>
</table> </table>
""".format("Your money share : ", "{:.2f}%".format(amount/maximum*100), """.format("Your money share : ", "{:.2f}%".format(amount/maximum*100),
"Your part : ", "{:.2f} {:} in [{:.2f} - {:.2f}] {:}".format(self.get_referential_value(amount), "Your part : ", "{:.2f} {:} in [{:.2f} - {:.2f}] {:}"
self.get_referential_name(), .format(self.get_referential_value(amount),
self.get_referential_value(0), self.get_referential_name(),
self.get_referential_value(maximum), self.get_referential_value(0),
self.get_referential_name()) self.get_referential_value(maximum),
self.get_referential_name())
) )
) )
...@@ -130,8 +133,17 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): ...@@ -130,8 +133,17 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
copy_pubkey.triggered.connect(self.copy_pubkey_to_clipboard) copy_pubkey.triggered.connect(self.copy_pubkey_to_clipboard)
copy_pubkey.setData(pubkey) copy_pubkey.setData(pubkey)
transfer_to = QMenu()
transfer_to.setTitle("Transfer to...")
for w in self.account.wallets:
transfer_action = QAction(w.name, self)
transfer_action.triggered.connect(self.transfer_to_wallet)
transfer_action.setData(w)
transfer_to.addAction(transfer_action)
menu.addAction(rename) menu.addAction(rename)
menu.addAction(copy_pubkey) menu.addAction(copy_pubkey)
menu.addMenu(transfer_to)
# Show the context menu. # Show the context menu.
menu.exec_(QCursor.pos()) menu.exec_(QCursor.pos())
...@@ -151,3 +163,13 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): ...@@ -151,3 +163,13 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
clipboard.setText(data.pubkey) clipboard.setText(data.pubkey)
elif data.__class__ is str: elif data.__class__ is str:
clipboard.setText(data) clipboard.setText(data)
def transfer_to_wallet(self):
wallet = self.sender().data()
dialog = TransferMoneyDialog(self.account, self.password_asker)
dialog.edit_pubkey.setText(wallet.pubkey)
dialog.combo_community.setCurrentText(self.community.name)
dialog.radio_pubkey.setChecked(True)
if dialog.exec_() == QDialog.Accepted:
currency_tab = self.window().currencies_tabwidget.currentWidget()
currency_tab.table_history.model().invalidate()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment