From 0fecaf3fc64d1c5d540e21b06280613fa26eb77b Mon Sep 17 00:00:00 2001 From: Vincent Texier <vit@free.fr> Date: Sat, 28 Mar 2015 10:52:03 +0100 Subject: [PATCH] Pretty wallets table display --- src/cutecoin/models/wallets.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cutecoin/models/wallets.py b/src/cutecoin/models/wallets.py index 3d21870d..460a0cc7 100644 --- a/src/cutecoin/models/wallets.py +++ b/src/cutecoin/models/wallets.py @@ -35,7 +35,7 @@ class WalletsFilterProxyModel(QSortFilterProxyModel): source_data = self.sourceModel().data(source_index, role) if role == Qt.DisplayRole: if source_index.column() == self.sourceModel().columns_types.index('pubkey'): - pubkey = "pub:{0}".format(source_data[:5]) + pubkey = source_data source_data = pubkey return source_data if source_index.column() == self.sourceModel().columns_types.index('amount'): @@ -45,6 +45,10 @@ class WalletsFilterProxyModel(QSortFilterProxyModel): else: return "{0:.2f}".format(amount_ref) + if role == Qt.TextAlignmentRole: + if source_index.column() == self.sourceModel().columns_types.index('amount'): + return Qt.AlignRight | Qt.AlignVCenter + return source_data @@ -61,8 +65,8 @@ class WalletsTableModel(QAbstractTableModel): super().__init__(parent) self.account = account self.community = community - self.columns_headers = ('Name', 'Pubkey', 'Amount') - self.columns_types = ('name', 'pubkey', 'amount') + self.columns_headers = ('Name', 'Amount', 'Pubkey') + self.columns_types = ('name', 'amount', 'pubkey') @property def wallets(self): @@ -87,8 +91,7 @@ class WalletsTableModel(QAbstractTableModel): name = self.wallets[row].name amount = self.wallets[row].value(self.community) pubkey = self.wallets[row].pubkey - - return name, pubkey, amount + return name, amount, pubkey def data(self, index, role): row = index.row() -- GitLab