tQt: addresses tab - align text - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit f0daf2d37bb7043105230d32ca3b179e06b17b15 DIR parent 10c07462872c425a3d3336e81c78b5ac90c44ce2 HTML Author: SomberNight <somber.night@protonmail.com> Date: Mon, 4 Jun 2018 22:37:34 +0200 Qt: addresses tab - align text Diffstat: M gui/qt/address_list.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) --- DIR diff --git a/gui/qt/address_list.py b/gui/qt/address_list.py t@@ -107,27 +107,34 @@ class AddressList(MyTreeWidget): continue balance_text = self.parent.format_amount(balance, whitespaces=True) fx = self.parent.fx + # create item if fx and fx.get_fiat_address_config(): rate = fx.exchange_rate() fiat_balance = fx.value_str(balance, rate) address_item = SortableTreeWidgetItem(['', address, label, balance_text, fiat_balance, "%d"%num]) - address_item.setTextAlignment(4, Qt.AlignRight) - address_item.setFont(4, QFont(MONOSPACE_FONT)) else: address_item = SortableTreeWidgetItem(['', address, label, balance_text, "%d"%num]) - address_item.setFont(3, QFont(MONOSPACE_FONT)) + # align text and set fonts + for i in range(address_item.columnCount()): + address_item.setTextAlignment(i, Qt.AlignVCenter) + if i not in (0, 2): + address_item.setFont(i, QFont(MONOSPACE_FONT)) + if fx and fx.get_fiat_address_config(): + address_item.setTextAlignment(4, Qt.AlignRight | Qt.AlignVCenter) + # setup column 0 if self.wallet.is_change(address): address_item.setText(0, _('change')) address_item.setBackground(0, ColorScheme.YELLOW.as_color(True)) else: address_item.setText(0, _('receiving')) address_item.setBackground(0, ColorScheme.GREEN.as_color(True)) - address_item.setFont(1, QFont(MONOSPACE_FONT)) address_item.setData(0, Qt.UserRole, address) # column 0; independent from address column + # setup column 1 if self.wallet.is_frozen(address): address_item.setBackground(1, ColorScheme.BLUE.as_color(True)) if self.wallet.is_beyond_limit(address): address_item.setBackground(1, ColorScheme.RED.as_color(True)) + # add item self.addChild(address_item) if address == current_address: self.setCurrentItem(address_item)