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

Fixing a bug in transaction history

parent c3215a52
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ class Application(object): ...@@ -31,7 +31,7 @@ class Application(object):
config.parse_arguments(argv) config.parse_arguments(argv)
self.load() self.load()
if self.default_account != "": if self.default_account != "":
self.current_account = self.get_account(self.default_account) self.change_current_account(self.get_account(self.default_account))
def get_account(self, name): def get_account(self, name):
if not self.accounts[name]: if not self.accounts[name]:
......
...@@ -74,10 +74,11 @@ class Cache(): ...@@ -74,10 +74,11 @@ class Cache():
current_block = community.request(bma.blockchain.Current) current_block = community.request(bma.blockchain.Current)
with_tx = community.request(bma.blockchain.TX) with_tx = community.request(bma.blockchain.TX)
# We parse only blocks with transactions # We parse only blocks with transactions
parsed_blocks = reversed(range(self.latest_block, parsed_blocks = reversed(range(self.latest_block + 1,
current_block['number'] + 1)) current_block['number'] + 1))
parsed_blocks = [n for n in parsed_blocks parsed_blocks = [n for n in parsed_blocks
if n in with_tx['result']['blocks']] if n in with_tx['result']['blocks']]
for block_number in parsed_blocks: for block_number in parsed_blocks:
block = community.request(bma.blockchain.Block, block = community.request(bma.blockchain.Block,
req_args={'number': block_number}) req_args={'number': block_number})
......
...@@ -17,6 +17,7 @@ from .password_asker import PasswordAskerDialog ...@@ -17,6 +17,7 @@ from .password_asker import PasswordAskerDialog
import logging import logging
class MainWindow(QMainWindow, Ui_MainWindow): class MainWindow(QMainWindow, Ui_MainWindow):
''' '''
...@@ -96,18 +97,21 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -96,18 +97,21 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if self.app.current_account is None: if self.app.current_account is None:
self.menu_contacts.setEnabled(False) self.menu_contacts.setEnabled(False)
self.menu_actions.setEnabled(False) self.menu_actions.setEnabled(False)
self.action_configure_parameters.setEnabled(False)
self.action_set_as_default.setEnabled(False) self.action_set_as_default.setEnabled(False)
else: else:
self.action_set_as_default.setEnabled(self.app.current_account.name != self.app.default_account) self.action_set_as_default.setEnabled(self.app.current_account.name != self.app.default_account)
self.password_asker = PasswordAskerDialog(self.app.current_account) self.password_asker = PasswordAskerDialog(self.app.current_account)
self.menu_contacts.setEnabled(True) self.menu_contacts.setEnabled(True)
self.action_configure_parameters.setEnabled(True)
self.menu_actions.setEnabled(True) self.menu_actions.setEnabled(True)
self.setWindowTitle("CuteCoin - Account : {0}".format( self.setWindowTitle("CuteCoin - Account : {0}".format(
self.app.current_account.name)) self.app.current_account.name))
self.currencies_tabwidget.clear() self.currencies_tabwidget.clear()
for community in self.app.current_account.communities: for community in self.app.current_account.communities:
tab_currency = CurrencyTabWidget(self.app, community, self.password_asker) tab_currency = CurrencyTabWidget(self.app, community,
self.password_asker)
tab_currency.refresh() tab_currency.refresh()
self.currencies_tabwidget.addTab(tab_currency, self.currencies_tabwidget.addTab(tab_currency,
QIcon(":/icons/currency_icon"), QIcon(":/icons/currency_icon"),
......
...@@ -47,6 +47,7 @@ class SentListModel(QAbstractListModel): ...@@ -47,6 +47,7 @@ class SentListModel(QAbstractListModel):
receiver = Person.lookup(outputs[0].pubkey, self.community) receiver = Person.lookup(outputs[0].pubkey, self.community)
value = "{0} to {1}".format(amount, receiver.name) value = "{0} to {1}".format(amount, receiver.name)
return value return value
if role == Qt.FontRole: if role == Qt.FontRole:
if row < len(self.account.transactions_sent(self.community)): if row < len(self.account.transactions_sent(self.community)):
return QFont('Sans Serif', italic=False) return QFont('Sans Serif', italic=False)
......
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