electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 66f7a6d28ea7e890f67b4da16836cd66412c4123
parent 7d79ecce73fd213f65ba0d61e7583a152ee87a4c
Author: ThomasV <thomasv@gitorious>
Date:   Sat, 28 Mar 2015 20:26:30 +0100

show own addresses in green

Diffstat:
Mgui/qt/transaction_dialog.py | 36+++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py @@ -201,27 +201,41 @@ class TxDialog(QDialog): vbox.addWidget(QLabel("LockTime: %d\n" % self.tx.locktime)) vbox.addWidget(QLabel(_("Inputs"))) - def format_input(x): - if x.get('is_coinbase'): - return 'coinbase' - else: - _hash = x.get('prevout_hash') - return _hash[0:8] + '...' + _hash[-8:] + ":%d"%x.get('prevout_n') + u'\t' + "%s"%x.get('address') - lines = map(format_input, self.tx.inputs ) + + ext = QTextCharFormat() + own = QTextCharFormat() + own.setBackground(QBrush(QColor("lightgreen"))) + own.setToolTip(_("Own address")) + i_text = QTextEdit() i_text.setFont(QFont(MONOSPACE_FONT)) - i_text.setText('\n'.join(lines)) i_text.setReadOnly(True) i_text.setMaximumHeight(100) - vbox.addWidget(i_text) + cursor = i_text.textCursor() + for x in self.tx.inputs: + if x.get('is_coinbase'): + cursor.insertText('coinbase') + else: + _hash = x.get('prevout_hash') + cursor.insertText(_hash[0:8] + '...' + _hash[-8:] + ":%d"%x.get('prevout_n'), ext) + cursor.insertText('\t') + addr = x.get('address') + cursor.insertText(addr, own if self.wallet.is_mine(addr) else ext) + cursor.insertBlock() + vbox.addWidget(i_text) vbox.addWidget(QLabel(_("Outputs"))) - lines = map(lambda x: x[0] + u'\t\t' + self.parent.format_amount(x[1]) if x[1] else x[0], self.tx.get_outputs()) o_text = QTextEdit() o_text.setFont(QFont(MONOSPACE_FONT)) - o_text.setText('\n'.join(lines)) o_text.setReadOnly(True) o_text.setMaximumHeight(100) + cursor = o_text.textCursor() + for addr, v in self.tx.get_outputs(): + cursor.insertText(addr, own if self.wallet.is_mine(addr) else ext) + if v is not None: + cursor.insertText('\t', ext) + cursor.insertText(self.parent.format_amount(v), ext) + cursor.insertBlock() vbox.addWidget(o_text)