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

Fix bugs #285 and #283

parent 8aff292a
Branches
Tags
No related merge requests found
......@@ -12,15 +12,13 @@ import logging
import time
import asyncio
from PyQt5.QtCore import QObject, pyqtSignal, QCoreApplication
from PyQt5.QtNetwork import QNetworkReply
from PyQt5.QtCore import QObject, pyqtSignal
from . import money
from .wallet import Wallet
from .community import Community
from .registry import LocalState
from ..tools.exceptions import ContactAlreadyExists, NoPeerAvailable
from ..tools.decorators import asyncify
from ucoinpy.api import bma
from ucoinpy.api.bma import PROTOCOL_VERSION
from aiohttp.errors import ClientError
......
......@@ -121,26 +121,31 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
self.progressbar.show()
self.progressbar.setValue(value)
self.progressbar.setMaximum(maximum)
self.app.current_account.loading_progressed.connect(progressing)
self.app.current_account.loading_finished.connect(self.stop_progress)
self.account.loading_progressed.connect(progressing)
self.account.loading_finished.connect(self.stop_progress)
@pyqtSlot(list)
def stop_progress(self, community, received_list):
if community == self.community:
self.progressbar.hide()
self.table_history.model().sourceModel().refresh_transfers()
self.table_history.resizeColumnsToContents()
self.notification_reception(received_list)
@asyncify
@asyncio.coroutine
def notification_reception(self, received_list):
if len(received_list) > 0:
amount = 0
for r in received_list:
amount += r.metadata['amount']
self.progressbar.hide()
if len(received_list) > 0:
text = self.tr("Received {0} {1} from {2} transfers").format(amount,
self.community.currency,
len(received_list))
localized_amount = yield from self.app.current_account.current_ref(amount, self.community, self.app)\
.localized(units=True,
international_system=self.app.preferences['international_system_of_units'])
text = self.tr("Received {amount} from {number} transfers").format(amount=localized_amount ,
number=len(received_list))
if self.app.preferences['notifications']:
toast.display(self.tr("New transactions received"), text)
self.table_history.model().sourceModel().refresh_transfers()
self.table_history.resizeColumnsToContents()
@once_at_a_time
@asyncify
@asyncio.coroutine
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment