commit 36aaad392dec6282c6519796057f6c7b047c25f6
parent 34955bd0f5525c83edbd95fba5ab9a3d6c3ff537
Author: Neil Booth <kyuupichan@gmail.com>
Date: Sat, 12 Dec 2015 18:11:07 +0900
Fix docstring display.
Diffstat:
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -2583,11 +2583,14 @@ class ElectrumWindow(QMainWindow, PrintError):
nz.valueChanged.connect(on_nz)
gui_widgets.append((nz_label, nz))
+ def fmt_docs(key, klass):
+ lines = [ln.lstrip(" ") for ln in klass.__doc__.split("\n")]
+ return '\n'.join([key, "", " ".join(lines)])
+
choosers = sorted(COIN_CHOOSERS.keys())
chooser_name = self.wallet.coin_chooser_name(self.config)
msg = _('Choose coin (UTXO) selection method. The following are available:\n\n')
- msg += '\n\n'.join(key + ": " + klass.__doc__
- for key, klass in COIN_CHOOSERS.items())
+ msg += '\n\n'.join(fmt_docs(*item) for item in COIN_CHOOSERS.items())
chooser_label = HelpLabel(_('Coin selection') + ':', msg)
chooser_combo = QComboBox()
chooser_combo.addItems(choosers)
diff --git a/lib/coinchooser.py b/lib/coinchooser.py
@@ -117,10 +117,9 @@ class CoinChooserBase(PrintError):
return tx
class CoinChooserClassic(CoinChooserBase):
- '''
- The classic electrum algorithm. Chooses coins starting with
- the oldest that are sufficient to cover the spent amount, and
- then removes any unneeded starting with the smallest in value.'''
+ '''The classic electrum algorithm. Chooses coins starting with the
+ oldest that are sufficient to cover the spent amount, and then
+ removes any unneeded starting with the smallest in value.'''
def keys(self, coins):
return [coin['prevout_hash'] + ':' + str(coin['prevout_n'])
@@ -179,19 +178,18 @@ class CoinChooserRandom(CoinChooserBase):
return winner
class CoinChooserPrivacy(CoinChooserRandom):
- '''
- Attempts to better preserve user privacy. First, if any coin is
+ '''Attempts to better preserve user privacy. First, if any coin is
spent from a user address, all coins are. Compared to spending
from other addresses to make up an amount, this reduces
information leakage about sender holdings. It also helps to
- reduce blockchain UTXO bloat, and reduce future privacy loss
- that would come from reusing that address' remaining UTXOs.
- Second, it penalizes change that is quite different to the sent
- amount. Third, it penalizes change that is too big. Fourth, it
- breaks large change up into amounts comparable to the spent
- amount. Finally, change is rounded to similar precision to
- sent amounts. Extra change outputs and rounding might raise
- the transaction fee slightly'''
+ reduce blockchain UTXO bloat, and reduce future privacy loss that
+ would come from reusing that address' remaining UTXOs. Second, it
+ penalizes change that is quite different to the sent amount.
+ Third, it penalizes change that is too big. Fourth, it breaks
+ large change up into amounts comparable to the spent amount.
+ Finally, change is rounded to similar precision to sent amounts.
+ Extra change outputs and rounding might raise the transaction fee
+ slightly.'''
def keys(self, coins):
return [coin['address'] for coin in coins]