tMerge branch 'master' of github.com:spesmilo/electrum - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 73af7ac824fa0f95b9ff37f4c3a32d664ede1ab3 DIR parent 4321950f631a607a782b21f875610ab9d18413ac HTML Author: ThomasV <thomasv@electrum.org> Date: Fri, 2 Mar 2018 09:46:22 +0100 Merge branch 'master' of github.com:spesmilo/electrum Diffstat: M contrib/build-wine/prepare-wine.sh | 41 +++++++++++++++++++------------ M gui/qt/history_list.py | 5 +++-- M gui/qt/main_window.py | 15 +++++++++++++++ M gui/qt/util.py | 1 + M lib/exchange_rate.py | 6 ++++++ M lib/wallet.py | 6 +++--- M plugins/trezor/clientbase.py | 6 ++++++ 7 files changed, 59 insertions(+), 21 deletions(-) --- DIR diff --git a/contrib/build-wine/prepare-wine.sh b/contrib/build-wine/prepare-wine.sh t@@ -1,13 +1,16 @@ #!/bin/bash # Please update these carefully, some versions won't work under Wine -NSIS_URL=https://prdownloads.sourceforge.net/nsis/nsis-3.02.1-setup.exe?download +NSIS_FILENAME=nsis-3.02.1-setup.exe +NSIS_URL=https://prdownloads.sourceforge.net/nsis/$NSIS_FILENAME?download NSIS_SHA256=736c9062a02e297e335f82252e648a883171c98e0d5120439f538c81d429552e -ZBAR_URL=https://sourceforge.net/projects/zbarw/files/zbarw-20121031-setup.exe/download +ZBAR_FILENAME=zbarw-20121031-setup.exe +ZBAR_URL=https://sourceforge.net/projects/zbarw/files/$ZBAR_FILENAME/download ZBAR_SHA256=177e32b272fa76528a3af486b74e9cb356707be1c5ace4ed3fcee9723e2c2c02 -LIBUSB_URL=https://prdownloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.21/libusb-1.0.21.7z?download +LIBUSB_FILENAME=libusb-1.0.21.7z +LIBUSB_URL=https://prdownloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.21/$LIBUSB_FILENAME?download LIBUSB_SHA256=acdde63a40b1477898aee6153f9d91d1a2e8a5d93f832ca8ab876498f3a6d2b8 PYTHON_VERSION=3.5.4 t@@ -43,6 +46,13 @@ verify_hash() { fi } +download_if_not_exist() { + local file_name=$1 url=$2 + if [ ! -e $file_name ] ; then + wget -O $PWD/$file_name "$url" + fi +} + # Let's begin! cd `dirname $0` set -e t@@ -55,7 +65,6 @@ echo "done" wine 'wineboot' echo "Cleaning tmp" -rm -rf tmp mkdir -p tmp echo "done" t@@ -70,8 +79,8 @@ KEYSERVER_PYTHON_DEV="hkp://keys.gnupg.net" gpg --no-default-keyring --keyring $KEYRING_PYTHON_DEV --keyserver $KEYSERVER_PYTHON_DEV --recv-keys $KEYLIST_PYTHON_DEV for msifile in core dev exe lib pip tools; do echo "Installing $msifile..." - wget "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi" - wget "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi.asc" + wget -nc "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi" + wget -nc "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi.asc" verify_signature "${msifile}.msi.asc" $KEYRING_PYTHON_DEV wine msiexec /i "${msifile}.msi" /qb TARGETDIR=C:/python$PYTHON_VERSION done t@@ -91,22 +100,22 @@ $PYTHON -m pip install -r ../../deterministic-build/requirements-binaries.txt $PYTHON -m pip install https://github.com/ecdsa/pyinstaller/archive/fix_2952.zip # Install ZBar -wget -q -O zbar.exe "$ZBAR_URL" -verify_hash zbar.exe $ZBAR_SHA256 -wine zbar.exe /S - +download_if_not_exist $ZBAR_FILENAME "$ZBAR_URL" +verify_hash $ZBAR_FILENAME "$ZBAR_SHA256" +wine "$PWD/$ZBAR_FILENAME" /S # Upgrade setuptools (so Electrum can be installed later) $PYTHON -m pip install setuptools --upgrade # Install NSIS installer -wget -q -O nsis.exe "$NSIS_URL" -verify_hash nsis.exe $NSIS_SHA256 -wine nsis.exe /S +download_if_not_exist $NSIS_FILENAME "$NSIS_URL" +verify_hash $NSIS_FILENAME "$NSIS_SHA256" +wine "$PWD/$NSIS_FILENAME" /S + +download_if_not_exist $LIBUSB_FILENAME "$LIBUSB_URL" +verify_hash $LIBUSB_FILENAME "$LIBUSB_SHA256" +7z x -olibusb $LIBUSB_FILENAME -aos -wget -q -O libusb.7z "$LIBUSB_URL" -verify_hash libusb.7z "$LIBUSB_SHA256" -7z x -olibusb libusb.7z cp libusb/MS32/dll/libusb-1.0.dll $WINEPREFIX/drive_c/python$PYTHON_VERSION/ # Install UPX DIR diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py t@@ -72,9 +72,10 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop): fx = self.parent.fx if fx and fx.show_history(): headers.extend(['%s '%fx.ccy + _('Value')]) - headers.extend(['%s '%fx.ccy + _('Acquisition price')]) - headers.extend(['%s '%fx.ccy + _('Capital Gains')]) self.editable_columns |= {6} + if fx.get_history_capital_gains_config(): + headers.extend(['%s '%fx.ccy + _('Acquisition price')]) + headers.extend(['%s '%fx.ccy + _('Capital Gains')]) else: self.editable_columns -= {6} self.update_headers(headers) DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -2846,6 +2846,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): # Fiat Currency hist_checkbox = QCheckBox() + hist_capgains_checkbox = QCheckBox() fiat_address_checkbox = QCheckBox() ccy_combo = QComboBox() ex_combo = QComboBox() t@@ -2867,6 +2868,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): if not self.fx: return fiat_address_checkbox.setChecked(self.fx.get_fiat_address_config()) + def update_history_capgains_cb(): + if not self.fx: return + hist_capgains_checkbox.setChecked(self.fx.get_history_capital_gains_config()) + hist_capgains_checkbox.setEnabled(hist_checkbox.isChecked()) + def update_exchanges(): if not self.fx: return b = self.fx.is_enabled() t@@ -2905,6 +2911,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): if self.fx.is_enabled() and checked: # reset timeout to get historical rates self.fx.timeout = 0 + update_history_capgains_cb() + + def on_history_capgains(checked): + if not self.fx: return + self.fx.set_history_capital_gains_config(checked) + self.history_list.refresh_headers() def on_fiat_address(checked): if not self.fx: return t@@ -2914,16 +2926,19 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): update_currencies() update_history_cb() + update_history_capgains_cb() update_fiat_address_cb() update_exchanges() ccy_combo.currentIndexChanged.connect(on_currency) hist_checkbox.stateChanged.connect(on_history) + hist_capgains_checkbox.stateChanged.connect(on_history_capgains) fiat_address_checkbox.stateChanged.connect(on_fiat_address) ex_combo.currentIndexChanged.connect(on_exchange) fiat_widgets = [] fiat_widgets.append((QLabel(_('Fiat currency')), ccy_combo)) fiat_widgets.append((QLabel(_('Show history rates')), hist_checkbox)) + fiat_widgets.append((QLabel(_('Show capital gains in history')), hist_capgains_checkbox)) fiat_widgets.append((QLabel(_('Show Fiat balance for addresses')), fiat_address_checkbox)) fiat_widgets.append((QLabel(_('Source')), ex_combo)) DIR diff --git a/gui/qt/util.py b/gui/qt/util.py t@@ -209,6 +209,7 @@ class MessageBoxMixin(object): d = QMessageBox(icon, title, str(text), buttons, parent) d.setWindowModality(Qt.WindowModal) d.setDefaultButton(defaultButton) + d.setTextInteractionFlags(Qt.TextSelectableByMouse) return d.exec_() class WindowModalDialog(QDialog, MessageBoxMixin): DIR diff --git a/lib/exchange_rate.py b/lib/exchange_rate.py t@@ -451,6 +451,12 @@ class FxThread(ThreadJob): def set_history_config(self, b): self.config.set_key('history_rates', bool(b)) + def get_history_capital_gains_config(self): + return bool(self.config.get('history_rates_capital_gains', False)) + + def set_history_capital_gains_config(self, b): + self.config.set_key('history_rates_capital_gains', bool(b)) + def get_fiat_address_config(self): return bool(self.config.get('fiat_address')) DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -830,16 +830,16 @@ class Abstract_Wallet(PrintError): prevout_hash = txi['prevout_hash'] prevout_n = txi['prevout_n'] ser = prevout_hash + ':%d'%prevout_n - # find value from prev output if addr and self.is_mine(addr): + # we only track is_mine spends + self.spent_outpoints[ser] = tx_hash + # find value from prev output dd = self.txo.get(prevout_hash, {}) for n, v, is_cb in dd.get(addr, []): if n == prevout_n: if d.get(addr) is None: d[addr] = [] d[addr].append((ser, v)) - # we only track is_mine spends - self.spent_outpoints[ser] = tx_hash break else: self.pruned_txo[ser] = tx_hash DIR diff --git a/plugins/trezor/clientbase.py b/plugins/trezor/clientbase.py t@@ -55,6 +55,9 @@ class GuiMixin(object): return self.proto.PinMatrixAck(pin=pin) def callback_PassphraseRequest(self, req): + if req and hasattr(req, 'on_device') and req.on_device is True: + return self.proto.PassphraseAck() + if self.creating_wallet: msg = _("Enter a passphrase to generate this wallet. Each time " "you use this wallet your {} will prompt you for the " t@@ -68,6 +71,9 @@ class GuiMixin(object): passphrase = bip39_normalize_passphrase(passphrase) return self.proto.PassphraseAck(passphrase=passphrase) + def callback_PassphraseStateRequest(self, msg): + return self.proto.PassphraseStateAck() + def callback_WordRequest(self, msg): self.step += 1 msg = _("Step {}/24. Enter seed word as explained on "