diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index cd4151d409e528aee7357818a64e59e4033ebbe1..fe2e4c0dee65eccb4fab4b3d06dd3ac96a581155 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -259,7 +259,7 @@ class Account(QObject): def progressing(value, maximum, hash): logging.debug("Loading = {0} : {1} : {2}".format(value, maximum, loaded_wallets)) values[hash] = value - maximums[maximum] = maximum + maximums[hash] = maximum account_value = sum(values.values()) account_max = sum(maximums.values()) self.loading_progressed.emit(account_value, account_max) diff --git a/src/cutecoin/core/txhistory.py b/src/cutecoin/core/txhistory.py index b54ed4f384b90921d927ce5d876af7a0a41917c2..3f8fae1a69c083ba5a97626ded3cdcca637feea5 100644 --- a/src/cutecoin/core/txhistory.py +++ b/src/cutecoin/core/txhistory.py @@ -59,10 +59,7 @@ class TxHistory(): self._stop_coroutines = True @asyncio.coroutine - def _parse_transaction(self, community, txdata, new_transfers, received_list, txid): - if len(txdata['issuers']) == 0: - return True - + def _parse_transaction(self, community, txdata, received_list, txid): tx_outputs = [OutputSource.from_inline(o) for o in txdata['outputs']] receivers = [o.pubkey for o in tx_outputs if o.pubkey != txdata['issuers'][0]] @@ -115,7 +112,7 @@ class TxHistory(): if txdata['hash'] not in [t['hash'] for t in awaiting]: transfer = Transfer.create_validated(txdata['hash'], metadata.copy()) - new_transfers.append(transfer) + return transfer # If we are not in the issuers, # maybe it we are in the recipients of this transaction elif in_outputs: @@ -127,8 +124,8 @@ class TxHistory(): metadata['amount'] = amount received = Received(txdata['hash'], metadata.copy()) received_list.append(received) - new_transfers.append(received) - return True + return received + return None @asyncio.coroutine def refresh(self, community, received_list): @@ -166,7 +163,9 @@ class TxHistory(): parsed_block, current_block)) else: - yield from self._parse_transaction(community, txdata, new_transfers, received_list, txid) + transfer = yield from self._parse_transaction(community, txdata, received_list, txid) + if transfer: + new_transfers.append(transfer) self.wallet.refresh_progressed.emit(parsed_block, current_block, self.wallet.pubkey) parsed_block += 100 diff --git a/src/cutecoin/gui/transactions_tab.py b/src/cutecoin/gui/transactions_tab.py index 1e5a4579b2a9bfd80dcc74d14b2436c090dea930..5191a5c6d7cfde024569f4417f7770cb0332375d 100644 --- a/src/cutecoin/gui/transactions_tab.py +++ b/src/cutecoin/gui/transactions_tab.py @@ -35,13 +35,14 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): self.community = community self.password_asker = password_asker self.currency_tab = currency_tab - self.app.current_account.loading_finished.connect(self.stop_progress) self.progressbar.hide() + self.community.inner_data_changed.connect(self.refresh_minimum_maximum) self.refresh() - def refresh(self): + def refresh_minimum_maximum(self): + block = self.community.get_block(1) minimum_datetime = QDateTime() - minimum_datetime.setTime_t(self.community.get_block(1)['medianTime']) + minimum_datetime.setTime_t(block['medianTime']) minimum_datetime.setTime(QTime(0, 0)) self.date_from.setMinimumDateTime(minimum_datetime) @@ -53,6 +54,8 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): self.date_to.setDateTime(tomorrow_datetime) self.date_to.setMaximumDateTime(tomorrow_datetime) + def refresh(self): + self.refresh_minimum_maximum() ts_from = self.date_from.dateTime().toTime_t() ts_to = self.date_to.dateTime().toTime_t() diff --git a/src/cutecoin/models/txhistory.py b/src/cutecoin/models/txhistory.py index c34c231ff9639662fd769cf634d8f20f9112e39f..e82f44c976a0435e70f03ddaceae875cbe52f507 100644 --- a/src/cutecoin/models/txhistory.py +++ b/src/cutecoin/models/txhistory.py @@ -236,7 +236,7 @@ class HistoryTableModel(QAbstractTableModel): self.endResetModel() def rowCount(self, parent): - return len(self.transfers) + return len(self.transfers_data) def columnCount(self, parent): return len(self.columns_types) @@ -262,7 +262,7 @@ class HistoryTableModel(QAbstractTableModel): return self.transfers_data[row][col] if role == Qt.ToolTipRole and col == 0: - return self.transfers[row].metadata['time'] + return self.transfers_data[self.columns_types.index('date')] def flags(self, index): return Qt.ItemIsSelectable | Qt.ItemIsEnabled