diff --git a/.gitignore b/.gitignore index 804917e7a..484619daf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,9 @@ build/ dist/ *.egg/ -/electrum.py contrib/pyinstaller/ Electrum.egg-info/ -gui/qt/icons_rc.py +electrum/gui/qt/icons_rc.py locale/ .devlocaltmp/ *_trial_temp diff --git a/README.rst b/README.rst index 2ff43fff4..4a201e811 100644 --- a/README.rst +++ b/README.rst @@ -36,7 +36,7 @@ Electrum from its root directory, without installing it on your system; all the python dependencies are included in the 'packages' directory. To run Electrum from its root directory, just do:: - ./electrum + ./run_electrum You can also install Electrum on your system, by running this command:: @@ -73,12 +73,12 @@ Render the SVG icons to PNGs (optional):: Compile the icons file for Qt:: sudo apt-get install pyqt5-dev-tools - pyrcc5 icons.qrc -o gui/qt/icons_rc.py + pyrcc5 icons.qrc -o electrum/gui/qt/icons_rc.py Compile the protobuf description file:: sudo apt-get install protobuf-compiler - protoc --proto_path=lib/ --python_out=lib/ lib/paymentrequest.proto + protoc --proto_path=electrum --python_out=electrum electrum/paymentrequest.proto Create translations (optional):: @@ -112,4 +112,4 @@ See `contrib/build-wine/`. Android ------- -See `gui/kivy/Readme.txt` file. +See `electrum/gui/kivy/Readme.md` file. diff --git a/contrib/build-osx/make_osx b/contrib/build-osx/make_osx index 32172b635..3c3a1babd 100755 --- a/contrib/build-osx/make_osx +++ b/contrib/build-osx/make_osx @@ -46,8 +46,8 @@ git submodule update rm -rf $BUILDDIR > /dev/null 2>&1 mkdir $BUILDDIR -cp -R ./contrib/deterministic-build/electrum-locale/locale/ ./lib/locale/ -cp ./contrib/deterministic-build/electrum-icons/icons_rc.py ./gui/qt/ +cp -R ./contrib/deterministic-build/electrum-locale/locale/ ./electrum/locale/ +cp ./contrib/deterministic-build/electrum-icons/icons_rc.py ./electrum/gui/qt/ info "Downloading libusb..." diff --git a/contrib/build-osx/osx.spec b/contrib/build-osx/osx.spec index b42c6ef89..5e2e6d4d3 100644 --- a/contrib/build-osx/osx.spec +++ b/contrib/build-osx/osx.spec @@ -1,97 +1,96 @@ -# -*- mode: python -*- - -from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs - -import sys -import os - -PACKAGE='Electrum' -PYPKG='electrum' -MAIN_SCRIPT='electrum' -ICONS_FILE='electrum.icns' - -for i, x in enumerate(sys.argv): - if x == '--name': - VERSION = sys.argv[i+1] - break -else: - raise Exception('no version') - -electrum = os.path.abspath(".") + "/" -block_cipher = None - -# see https://github.com/pyinstaller/pyinstaller/issues/2005 -hiddenimports = [] -hiddenimports += collect_submodules('trezorlib') -hiddenimports += collect_submodules('btchip') -hiddenimports += collect_submodules('keepkeylib') -hiddenimports += collect_submodules('websocket') - -datas = [ - (electrum+'lib/*.json', PYPKG), - (electrum+'lib/wordlist/english.txt', PYPKG + '/wordlist'), - (electrum+'lib/locale', PYPKG + '/locale'), - (electrum+'plugins', PYPKG + '_plugins'), -] -datas += collect_data_files('trezorlib') -datas += collect_data_files('btchip') -datas += collect_data_files('keepkeylib') - -# Add libusb so Trezor will work -binaries = [(electrum + "contrib/build-osx/libusb-1.0.dylib", ".")] -binaries += [(electrum + "contrib/build-osx/libsecp256k1.0.dylib", ".")] - -# Workaround for "Retro Look": -binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]] - -# We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports -a = Analysis([electrum+MAIN_SCRIPT, - electrum+'gui/qt/main_window.py', - electrum+'gui/text.py', - electrum+'lib/util.py', - electrum+'lib/wallet.py', - electrum+'lib/simple_config.py', - electrum+'lib/bitcoin.py', - electrum+'lib/dnssec.py', - electrum+'lib/commands.py', - electrum+'plugins/cosigner_pool/qt.py', - electrum+'plugins/email_requests/qt.py', - electrum+'plugins/trezor/client.py', - electrum+'plugins/trezor/qt.py', - electrum+'plugins/keepkey/qt.py', - electrum+'plugins/ledger/qt.py', - ], - binaries=binaries, - datas=datas, - hiddenimports=hiddenimports, - hookspath=[]) - -# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal -for d in a.datas: - if 'pyconfig' in d[0]: - a.datas.remove(d) - break - -pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) - -exe = EXE(pyz, - a.scripts, - a.binaries, - a.datas, - name=PACKAGE, - debug=False, - strip=False, - upx=True, - icon=electrum+ICONS_FILE, - console=False) - -app = BUNDLE(exe, - version = VERSION, - name=PACKAGE + '.app', - icon=electrum+ICONS_FILE, - bundle_identifier=None, - info_plist={ - 'NSHighResolutionCapable': 'True', - 'NSSupportsAutomaticGraphicsSwitching': 'True' - } -) +# -*- mode: python -*- + +from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs + +import sys +import os + +PACKAGE='Electrum' +PYPKG='electrum' +MAIN_SCRIPT='run_electrum' +ICONS_FILE='electrum.icns' + +for i, x in enumerate(sys.argv): + if x == '--name': + VERSION = sys.argv[i+1] + break +else: + raise Exception('no version') + +electrum = os.path.abspath(".") + "/" +block_cipher = None + +# see https://github.com/pyinstaller/pyinstaller/issues/2005 +hiddenimports = [] +hiddenimports += collect_submodules('trezorlib') +hiddenimports += collect_submodules('btchip') +hiddenimports += collect_submodules('keepkeylib') +hiddenimports += collect_submodules('websocket') + +datas = [ + (electrum+'electrum/*.json', PYPKG), + (electrum+'electrum/wordlist/english.txt', PYPKG + '/wordlist'), + (electrum+'electrum/locale', PYPKG + '/locale') +] +datas += collect_data_files('trezorlib') +datas += collect_data_files('btchip') +datas += collect_data_files('keepkeylib') + +# Add libusb so Trezor will work +binaries = [(electrum + "contrib/build-osx/libusb-1.0.dylib", ".")] +binaries += [(electrum + "contrib/build-osx/libsecp256k1.0.dylib", ".")] + +# Workaround for "Retro Look": +binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]] + +# We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports +a = Analysis([electrum+ MAIN_SCRIPT, + electrum+'electrum/gui/qt/main_window.py', + electrum+'electrum/gui/text.py', + electrum+'electrum/util.py', + electrum+'electrum/wallet.py', + electrum+'electrum/simple_config.py', + electrum+'electrum/bitcoin.py', + electrum+'electrum/dnssec.py', + electrum+'electrum/commands.py', + electrum+'electrum/plugins/cosigner_pool/qt.py', + electrum+'electrum/plugins/email_requests/qt.py', + electrum+'electrum/plugins/trezor/client.py', + electrum+'electrum/plugins/trezor/qt.py', + electrum+'electrum/plugins/keepkey/qt.py', + electrum+'electrum/plugins/ledger/qt.py', + ], + binaries=binaries, + datas=datas, + hiddenimports=hiddenimports, + hookspath=[]) + +# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal +for d in a.datas: + if 'pyconfig' in d[0]: + a.datas.remove(d) + break + +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + +exe = EXE(pyz, + a.scripts, + a.binaries, + a.datas, + name=PACKAGE, + debug=False, + strip=False, + upx=True, + icon=electrum+ICONS_FILE, + console=False) + +app = BUNDLE(exe, + version = VERSION, + name=PACKAGE + '.app', + icon=electrum+ICONS_FILE, + bundle_identifier=None, + info_plist={ + 'NSHighResolutionCapable': 'True', + 'NSSupportsAutomaticGraphicsSwitching': 'True' + } +) diff --git a/contrib/build-wine/build-electrum-git.sh b/contrib/build-wine/build-electrum-git.sh index 2a103eba3..b3a78fd25 100755 --- a/contrib/build-wine/build-electrum-git.sh +++ b/contrib/build-wine/build-electrum-git.sh @@ -1,7 +1,7 @@ #!/bin/bash NAME_ROOT=electrum -PYTHON_VERSION=3.5.4 +PYTHON_VERSION=3.6.6 # These settings probably don't need any change export WINEPREFIX=/opt/wine64 @@ -44,8 +44,8 @@ find -exec touch -d '2000-11-11T11:11:11+00:00' {} + popd cp $WINEPREFIX/drive_c/electrum/LICENCE . -cp -r $WINEPREFIX/drive_c/electrum/contrib/deterministic-build/electrum-locale/locale $WINEPREFIX/drive_c/electrum/lib/ -cp $WINEPREFIX/drive_c/electrum/contrib/deterministic-build/electrum-icons/icons_rc.py $WINEPREFIX/drive_c/electrum/gui/qt/ +cp -r $WINEPREFIX/drive_c/electrum/contrib/deterministic-build/electrum-locale/locale $WINEPREFIX/drive_c/electrum/electrum/ +cp $WINEPREFIX/drive_c/electrum/contrib/deterministic-build/electrum-icons/icons_rc.py $WINEPREFIX/drive_c/electrum/electrum/gui/qt/ # Install frozen dependencies $PYTHON -m pip install -r ../../deterministic-build/requirements.txt diff --git a/contrib/build-wine/deterministic.spec b/contrib/build-wine/deterministic.spec index 091cea86c..6561c62c6 100644 --- a/contrib/build-wine/deterministic.spec +++ b/contrib/build-wine/deterministic.spec @@ -10,7 +10,7 @@ for i, x in enumerate(sys.argv): else: raise Exception('no name') -PYTHON_VERSION = '3.5.4' +PYTHON_VERSION = '3.6.6' PYHOME = 'c:/python' + PYTHON_VERSION home = 'C:\\electrum\\' @@ -31,10 +31,9 @@ binaries += [b for b in collect_dynamic_libs('PyQt5') if 'qwindowsvista' in b[0] binaries += [('C:/tmp/libsecp256k1.dll', '.')] datas = [ - (home+'lib/*.json', 'electrum'), - (home+'lib/wordlist/english.txt', 'electrum/wordlist'), - (home+'lib/locale', 'electrum/locale'), - (home+'plugins', 'electrum_plugins'), + (home+'electrum/*.json', 'electrum'), + (home+'electrum/wordlist/english.txt', 'electrum/wordlist'), + (home+'electrum/locale', 'electrum/locale'), ('C:\\Program Files (x86)\\ZBar\\bin\\', '.') ] datas += collect_data_files('trezorlib') @@ -42,21 +41,21 @@ datas += collect_data_files('btchip') datas += collect_data_files('keepkeylib') # We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports -a = Analysis([home+'electrum', - home+'gui/qt/main_window.py', - home+'gui/text.py', - home+'lib/util.py', - home+'lib/wallet.py', - home+'lib/simple_config.py', - home+'lib/bitcoin.py', - home+'lib/dnssec.py', - home+'lib/commands.py', - home+'plugins/cosigner_pool/qt.py', - home+'plugins/email_requests/qt.py', - home+'plugins/trezor/client.py', - home+'plugins/trezor/qt.py', - home+'plugins/keepkey/qt.py', - home+'plugins/ledger/qt.py', +a = Analysis([home+'run_electrum', + home+'electrum/gui/qt/main_window.py', + home+'electrum/gui/text.py', + home+'electrum/util.py', + home+'electrum/wallet.py', + home+'electrum/simple_config.py', + home+'electrum/bitcoin.py', + home+'electrum/dnssec.py', + home+'electrum/commands.py', + home+'electrum/plugins/cosigner_pool/qt.py', + home+'electrum/plugins/email_requests/qt.py', + home+'electrum/plugins/trezor/client.py', + home+'electrum/plugins/trezor/qt.py', + home+'electrum/plugins/keepkey/qt.py', + home+'electrum/plugins/ledger/qt.py', #home+'packages/requests/utils.py' ], binaries=binaries, @@ -68,7 +67,7 @@ a = Analysis([home+'electrum', # http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal for d in a.datas: - if 'pyconfig' in d[0]: + if 'pyconfig' in d[0]: a.datas.remove(d) break @@ -85,7 +84,7 @@ exe_standalone = EXE( pyz, a.scripts, a.binaries, - a.datas, + a.datas, name=os.path.join('build\\pyi.win32\\electrum', cmdline_name + ".exe"), debug=False, strip=None, diff --git a/contrib/build-wine/prepare-wine.sh b/contrib/build-wine/prepare-wine.sh index 2fe1d1d0d..8df8c1359 100755 --- a/contrib/build-wine/prepare-wine.sh +++ b/contrib/build-wine/prepare-wine.sh @@ -13,7 +13,7 @@ LIBUSB_FILENAME=libusb-1.0.22.7z LIBUSB_URL=https://prdownloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.22/$LIBUSB_FILENAME?download LIBUSB_SHA256=671f1a420757b4480e7fadc8313d6fb3cbb75ca00934c417c1efa6e77fb8779b -PYTHON_VERSION=3.5.4 +PYTHON_VERSION=3.6.6 ## These settings probably don't need change export WINEPREFIX=/opt/wine64 @@ -81,6 +81,11 @@ set -e wine 'wineboot' +# HACK to work around https://bugs.winehq.org/show_bug.cgi?id=42474#c22 +# needed for python 3.6+ +rm -f /opt/wine-stable/lib/wine/fakedlls/api-ms-win-core-path-l1-1-0.dll +rm -f /opt/wine-stable/lib/wine/api-ms-win-core-path-l1-1-0.dll.so + cd /tmp/electrum-build # Install Python diff --git a/contrib/deterministic-build/requirements-binaries.txt b/contrib/deterministic-build/requirements-binaries.txt index b17d0d709..02561924b 100644 --- a/contrib/deterministic-build/requirements-binaries.txt +++ b/contrib/deterministic-build/requirements-binaries.txt @@ -1,42 +1,43 @@ pip==10.0.1 \ --hash=sha256:717cdffb2833be8409433a93746744b59505f42146e8d37de6c62b430e25d6d7 \ --hash=sha256:f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68 -pycryptodomex==3.6.1 \ - --hash=sha256:1869d7735f445bbf1681afa2acce10ad829857cfb7a4a7b702e484f222021892 \ - --hash=sha256:24e054190d2b11ad3b8517d186c0b3df6f902a5f5a91be8e4bb6a3fcdc65b2cf \ - --hash=sha256:26967d31fabb0d80cb2b254a7c0f55f8dec9931e8676891edd24aa5aaeb0d021 \ - --hash=sha256:2a341b57bb5844d53b8f632f79277cd534762f502fb73bff5dc1a2f615ff91ed \ - --hash=sha256:43d6eb014aba7be354f3e8fe2693fe96446f6791da2b9570e8d54d481e3ab224 \ - --hash=sha256:4c271577f4f8c5cced55a60f4504b34545121c14facb8fc357f89c24089c81fc \ - --hash=sha256:59721f2853df9cf2265304d3b6d6d8cebe3a86b1fddc00f2bfbf18eb2a48fb78 \ - --hash=sha256:63a77a1b27d12ed1c42f4e539d9dbe588a88b70ec64b55271cdf1f56c1223bd6 \ - --hash=sha256:6d04640386c55b9f44015747496c3b6582360b5b3b4e42f9ce3fc7c6840f80d0 \ - --hash=sha256:730bd75d90e16975a112ea79863ce1faa7703d3b54f10d77656e7dadf6be0ef6 \ - --hash=sha256:75a300aa86c56e9c19a7b476c397cb22fda3be7af4cf2f105990fdd94c52f486 \ - --hash=sha256:7c6f67005c6e421f02fd7fe9d95876094307b31628d728adc6c2e038e2ed9c09 \ - --hash=sha256:82b758f870c8dd859f9b58bc9cff007403b68742f9e0376e2cbd8aa2ad3baa83 \ - --hash=sha256:8528a958b746c4da767bfba5ac370250dcb741f4c69e55873bd6efe89ac07291 \ - --hash=sha256:93582ea5bc3e8f95cb36d9dd752c01452085b54b396e3ed775ac1793b8dc486a \ - --hash=sha256:94e0105ad8d82d3bf5a032c92fc03b01e3bc9ea40b58308c2da42f8cf8c16c47 \ - --hash=sha256:a65889424bf10a884ff031e7f3fd12273dd5b420ee08ca8fcfd431a2f6cbabc1 \ - --hash=sha256:a8467982d26bfb90089f50c3c5d9ed541b7fe9f9df20803fede70d5046cd4ff1 \ - --hash=sha256:ab497d4e7361511ede562ed3cd4528f46c005781bc23b1b943612d27bfb078c3 \ - --hash=sha256:bb05caf3f6cf41d964c01e08dfaddfe48086c7b3e96708d50647f0a29ff33f56 \ - --hash=sha256:c4643647f5656855975b2aaf70fe3aa1e0c1558f8d1b5de0c9a8ccac65114c57 \ - --hash=sha256:c550e20834b679ed0b7608c345a816f97047d2297aab4f4599f95edee5d16e99 \ - --hash=sha256:cc797712add76cd658110585481c380833637b68df1404190777ba715a81c9b9 \ - --hash=sha256:dff0c883d495bf45d18acc74938d1de4d6a08b3345acb9177a46c6997a578c44 \ - --hash=sha256:e4f69af1f5b46255ec7b8116a853879a55e8e6b595a73c39f14ca430c410c469 \ - --hash=sha256:f61d0d83e9dd974849f9b0826ec20f49dbd9ed233fd90bf2592be1337231418e \ - --hash=sha256:f65f21d2b616c30ad4ba801504343eb768fd0a2894c5f587e784201320556543 +pycryptodomex==3.6.4 \ + --hash=sha256:0461e88a7199f9e88f9f90c2c1e109e9e1f7bbb94dc6192e5df52829d31510c1 \ + --hash=sha256:08d0aba5a72e8af5da118ac4b6a5d75befceca7dd92a031b040ed5ff4417cec2 \ + --hash=sha256:0e22d47935d5fa95f556d5f5857576bc6750233964de06a840d58459010c3889 \ + --hash=sha256:10ef21d1728ec0b8afc4f8e1d8d9ea66f317154ea18731a4a05bd996cdc33fdf \ + --hash=sha256:1962b81eef81bf5c42d625816904a22a0bd23d15ca5d49891a54e3c0d0189d84 \ + --hash=sha256:24aae88efe3cbcb4a9cf840b2c352e7de1d6c2c5b3df37ff99b5c7e271e8f3a8 \ + --hash=sha256:43ad6d1d7ca545d53360bf412ee70fcb9ede876b4376fc6db06fc7328f70588c \ + --hash=sha256:4daabe7c0404e673b9029aa43761c779b9b4df2cbe11ccd94daded6a0acd8808 \ + --hash=sha256:4e15af025e02b04b0d0728e8248e4384d3dc7a3a89a020f5bd4d04ef2c5d9d4c \ + --hash=sha256:5b4d3c4a069a05972e0ed7111071bbcb4727ac652b5d7e8f786e8ea2fe63306b \ + --hash=sha256:67ad8b2ad15a99ae70e287454a112f67d2abaf160ee9c97f9daebf2296066447 \ + --hash=sha256:6d7e6fb69d9fd2c57e177f8a9cdf6489a725da77568e3d0a226c7dd18504396a \ + --hash=sha256:7907d7a5adde7cd07d19f129a4afa892b68b0b52a07eaf989e48e2677040b4bf \ + --hash=sha256:88210edafd564c8ff4a68716aaf0627e3bc43e9c192a33d6f5616743f72c2d9b \ + --hash=sha256:8a6b14a90bdcbcdc268acae87126c33bf4250d3842803a93a548d7c10135893a \ + --hash=sha256:94a10446ad61965516aecd610a2dd28d79ab1dfd8723903e1bd19ffa985c208e \ + --hash=sha256:99bda900a0bf6f9e6c69bdeb6114f7f6730b9d36a47bc1fe144263ce85bfc403 \ + --hash=sha256:9dae2e738622bd35ba82fe0b06f773be137a14e6b28defb2e36efc2d809cd28a \ + --hash=sha256:a04cd6021ff2756c38135a95f81b980485507bccbff4d2b8f62e537552270471 \ + --hash=sha256:a3b61625b60dd5e72556520a77464e2ac568c20b8ad12ea1f4443bf5051dc624 \ + --hash=sha256:a9a91fd9e7967a5bad88d542c9fce09323e15d16cb6fa9b8978390e46e68cbdf \ + --hash=sha256:afc44f1b595bd736ec3762dd9a2d0ef276a6ac560c85f643acfc4c0bf0c73384 \ + --hash=sha256:b5f3c8912b36e6abb843a51eecb414a1161f80c0ca0b65066c23aa449b5f98db \ + --hash=sha256:cc07c8b7686dd7093f33067a02b92f4fed860d75ad2bcc4e60624f70fdb94576 \ + --hash=sha256:da646eddbe026306fd1cb2c392a9aee4ebea13f2a9add9af303bb3151786a5d8 \ + --hash=sha256:df93eaccd5c09e6380fab8f15c06a89944415e4bb9af64a94f467ce4c782ff8e \ + --hash=sha256:e667303019770834354c75022ab0324d5ae5bf7cd7015939678033a58f87ee70 \ + --hash=sha256:f921219040ce994c9118b7218b7f7b4e9394e507c97cfc869ce5358437fc26cd PyQt5==5.10.1 \ --hash=sha256:1e652910bd1ffd23a3a48c510ecad23a57a853ed26b782cd54b16658e6f271ac \ --hash=sha256:4db7113f464c733a99fcb66c4c093a47cf7204ad3f8b3bda502efcc0839ac14b \ --hash=sha256:9c17ab3974c1fc7bbb04cc1c9dae780522c0ebc158613f3025fccae82227b5f7 \ --hash=sha256:f6035baa009acf45e5f460cf88f73580ad5dc0e72330029acd99e477f20a5d61 -setuptools==39.2.0 \ - --hash=sha256:8fca9275c89964f13da985c3656cb00ba029d7f3916b37990927ffdf264e7926 \ - --hash=sha256:f7cddbb5f5c640311eb00eab6e849f7701fa70bf6a183fc8a2c33dd1d1672fb2 +setuptools==40.0.0 \ + --hash=sha256:012adb8e25fbfd64c652e99e7bab58799a3aaf05d39ab38561f69190a909015f \ + --hash=sha256:d68abee4eed409fbe8c302ac4d8429a1ffef912cd047a903b5701c024048dd49 SIP==4.19.8 \ --hash=sha256:09f9a4e6c28afd0bafedb26ffba43375b97fe7207bd1a0d3513f79b7d168b331 \ --hash=sha256:105edaaa1c8aa486662226360bd3999b4b89dd56de3e314d82b83ed0587d8783 \ diff --git a/contrib/deterministic-build/requirements-hw.txt b/contrib/deterministic-build/requirements-hw.txt index a49cb6001..29fae2fdd 100644 --- a/contrib/deterministic-build/requirements-hw.txt +++ b/contrib/deterministic-build/requirements-hw.txt @@ -9,36 +9,35 @@ chardet==3.0.4 \ click==6.7 \ --hash=sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d \ --hash=sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b -Cython==0.28.3 \ - --hash=sha256:0344e9352b0915910e212c38403b63f902ce1cba75dde7a43a9112ff960eb2a5 \ - --hash=sha256:0a390c39e912fc5f82d5feae2d16ea061971407099e1efb0fecb255cb96fbeff \ - --hash=sha256:0f2b2e09f94c498f555935e732b7321b5f62f00e7a789238f6c5ddd66987a54d \ - --hash=sha256:15614592616b6dd5e919e158796350ebeba6cb6b5d2998cfff41b53f568c8355 \ - --hash=sha256:1aae6d6e9858888144cea147eb5e677830f45faaff3d305d77378c3cba55f526 \ - --hash=sha256:200583297f23e558744bc4688d8a2b2605ab6ad7d1494a9fd8c8094ad65ebf3c \ - --hash=sha256:295facc211a6b55db9979455b856180f2839be22ab767ffdea55986bee83ca9f \ - --hash=sha256:36c16bf39280fe857213d8da31c07a6179d3878c3dc2e435dce0974b9f8f0729 \ - --hash=sha256:3fef8dfa9cf86ab7814ca31369374ddd5b9524f54406aa83b53b5937965b8e88 \ - --hash=sha256:439d233d3214e3d69c033a9a93516758f2c8a03e83ea51ae14b6eed13687d224 \ - --hash=sha256:455ab39c6c0849a6c008fcdf2fae42475f18d0801a3be229e8f75367bbe3b325 \ - --hash=sha256:56821e3791209e6a11992e294afbf7e3dcda7d4fd54d06396dd521928d3d14fe \ - --hash=sha256:62b594584889b33bbea7e71f9d7c5c6539091b341334ef7ca1ae7e30a9dd3e15 \ - --hash=sha256:70f81a75fb25c1c3c61843e3a6fe771a76c4ebf4d154455a7eff0740ad47dff4 \ - --hash=sha256:8011090beb09251cb4ece1e14263e574b38eda696b788552b369ad343373d0e9 \ - --hash=sha256:80d6a0369333a162fc32a22637f5870f3e87fb038c7b58860bbe00b05b58aa62 \ - --hash=sha256:85b04e32af58a3c008c0ba8169017770aaa342a5972b748f81d043d66363e437 \ - --hash=sha256:9ed273d82116fa148c92901b9639030e087979d455982bd7bf727fb486c0bd17 \ - --hash=sha256:a1af59e6c9b4acc07c429d8495fc016a35e0a1270f28c57317352f512df7e214 \ - --hash=sha256:b894ff4daf8dfaf657bf2d5e7190a4de11b2400b1e0fb0902974d35c23a26dea \ - --hash=sha256:c2659981150b4de04397dcfd4bff64e384d3ba25af60d1b22820fdf108298cb2 \ - --hash=sha256:c981a750858f1727995acf861ab030b267d264ca6efda2f01104941187a3675f \ - --hash=sha256:cc4152b19ec168391f7815d24b70c8911829ba281bd5fcd98cab9dc21abe62ff \ - --hash=sha256:d0f5b1668e7f7f6fc9849f49a20c5db10562a0ab29cd66818894dfebbca7b304 \ - --hash=sha256:d7152006ed1a3adb8f978077b57d237ddafa188240af53cd72b5c79e4ed000e3 \ - --hash=sha256:e5f877472993474296125c22b84c334b550010815e513cccce73da854a132d64 \ - --hash=sha256:e7c2c87ff2f99ed4be1bb046d6eddfb388af627928037f9e0a420c05daaf14ed \ - --hash=sha256:edd7d499685655031be5b4d33005096b6345f81eeb7ab9d2dd415db0c7bcf64e \ - --hash=sha256:f99a777fda569a88deea863eac2722b5e88957c4d5f4413949740da791857ac9 +Cython==0.28.4 \ + --hash=sha256:01487236575df8f17b46982071438dce4f7eaf8acc8fb99fca3510d343cd7a28 \ + --hash=sha256:0671d17c7a27634d6819246e535241b951141ed0e3f6f2a6d618fd32344dae3e \ + --hash=sha256:0e6190d6971c46729f712dd7307a9c0a8c027bfa5b4d8f2edef106b01759926c \ + --hash=sha256:202587c754901d0678bd6ff89c707f099987928239049a528470c06c6c922cf8 \ + --hash=sha256:345197ba9278cf6a914cb7421dc665a0531a219b0072abf6b0cebfdf68e75725 \ + --hash=sha256:3a296b8d6b02f0e01ab04bedea658f43eef5ad2f8e586a820226ead1a677d9b1 \ + --hash=sha256:484572a2b22823a967be106137a93f7d634db116b3f7accb37dbd760eda2fa9f \ + --hash=sha256:4c67c9c803e50ceff32cc5e4769c50fc8ae8df9c4e5cc592ce8310b5a1076d23 \ + --hash=sha256:539038087c321911745fc2e77049209b1231300d481cb4d682b2f95c724814b3 \ + --hash=sha256:58113e0683c3688594c112103d7e9f2d0092fd2d8297a220240bea22e184dfdd \ + --hash=sha256:65cb25ca4284804293a2404d1be3b5a98818be21a72791649bacbcfa4e431d41 \ + --hash=sha256:699e765da2580e34b08473fc0acef3a2d7bcb7f13eb29401cd25236bcf000080 \ + --hash=sha256:6b54c3470810cea49a8be90814d05c5325ceb9c5bf429fd86c36fc1b32dfc157 \ + --hash=sha256:71ac1629e4eae2ed329be8caf45efea10bfe1af3d8767e12e64b83e4ea5a3250 \ + --hash=sha256:722c179d3df8677f3daf45b1a2764678ed4f0aaddbaa7211a8a08ebfd907c0db \ + --hash=sha256:76ac2b08d3d956d77b574bb43cbf1d37bd58b9d50c04ba281303e695854ebc46 \ + --hash=sha256:7eff1157be9e26bf7494288c89979ca69d593a009e2c7420a739e2cf1e0635f5 \ + --hash=sha256:99546c8696d27d0efa639c77b2f8af6e61dc3a5073caae4f27ffd991ca926f42 \ + --hash=sha256:a0c263b31d335f29c11f4a9e98fbcd908d0731d4ea99bfd27c1c47caaeb4ca2e \ + --hash=sha256:a29c66292605bff962adc26530c030607aa699206b12dfb84f131b0454e15df4 \ + --hash=sha256:a4d3724c5a1ddd86d7d830d8e02c40151839b833791dd4b6fe9e144380fa7d37 \ + --hash=sha256:aed9f33b19d542eea56c38ef3862ca56147f7903648156cd57eabb0fe47c35d6 \ + --hash=sha256:b57e733dd8871d2cc7358c2e0fe33027453afffbcd0ea6a537f54877cad5131c \ + --hash=sha256:d5bf4db62236e82955c40bafbaa18d54b20b5ceefa06fb57c7facc443929f4bd \ + --hash=sha256:d9272dd71ab78e87fa34a0a59bbd6acc9a9c0005c834a6fc8457ff9619dc6795 \ + --hash=sha256:e9d5671bcbb90a41b0832fcb3872fcbaca3d68ff11ea09724dd6cbdf31d947fb \ + --hash=sha256:ee54646afb2b73b293c94cf079682d18d404ebd6c01122dc3980f111aec2d8ae \ + --hash=sha256:f16a87197939977824609005b73f9ebb291b9653a14e5f27afc1c5d6f981ba39 ecdsa==0.13 \ --hash=sha256:40d002cf360d0e035cf2cb985e1308d41aaa087cbfc135b2dc2d844296ea546c \ --hash=sha256:64cf1ee26d1cde3c73c6d7d107f835fed7c6a2904aef9eac223d57ad800c43fa @@ -95,15 +94,15 @@ pyblake2==1.1.2 \ requests==2.19.1 \ --hash=sha256:63b52e3c866428a224f97cab011de738c36aec0185aa91cfacd418b5d58911d1 \ --hash=sha256:ec22d826a36ed72a7358ff3fe56cbd4ba69dd7a6718ffd450ff0e9df7a47ce6a -setuptools==39.2.0 \ - --hash=sha256:8fca9275c89964f13da985c3656cb00ba029d7f3916b37990927ffdf264e7926 \ - --hash=sha256:f7cddbb5f5c640311eb00eab6e849f7701fa70bf6a183fc8a2c33dd1d1672fb2 +setuptools==40.0.0 \ + --hash=sha256:012adb8e25fbfd64c652e99e7bab58799a3aaf05d39ab38561f69190a909015f \ + --hash=sha256:d68abee4eed409fbe8c302ac4d8429a1ffef912cd047a903b5701c024048dd49 six==1.11.0 \ --hash=sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9 \ --hash=sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb -trezor==0.10.1 \ - --hash=sha256:09b4edfa83b787975c6f30728c13bb413621d5bdf722231748758ba0181b8a60 \ - --hash=sha256:5bcad3e97129fccd6f8b4cf08f81862e423373617c857feb492cfa1b1807844e +trezor==0.10.2 \ + --hash=sha256:4dba4d5c53d3ca22884d79fb4aa68905fb8353a5da5f96c734645d8cf537138d \ + --hash=sha256:d2b32f25982ab403758d870df1d0de86d0751c106ef1cd1289f452880ce68b84 urllib3==1.23 \ --hash=sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf \ --hash=sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5 diff --git a/contrib/deterministic-build/requirements.txt b/contrib/deterministic-build/requirements.txt index 743c29b19..67d1fafdd 100644 --- a/contrib/deterministic-build/requirements.txt +++ b/contrib/deterministic-build/requirements.txt @@ -41,15 +41,18 @@ pyaes==1.6.1 \ --hash=sha256:02c1b1405c38d3c370b085fb952dd8bea3fadcee6411ad99f312cc129c536d8f PySocks==1.6.8 \ --hash=sha256:3fe52c55890a248676fd69dc9e3c4e811718b777834bcaab7a8125cf9deac672 +QDarkStyle==2.5.4 \ + --hash=sha256:3eb60922b8c4d9cedecb6897ca4c9f8a259d81bdefe5791976ccdf12432de1f0 \ + --hash=sha256:51331fc6490b38c376e6ba8d8c814320c8d2d1c2663055bc396321a7c28fa8be qrcode==6.0 \ --hash=sha256:037b0db4c93f44586e37f84c3da3f763874fcac85b2974a69a98e399ac78e1bf \ --hash=sha256:de4ffc15065e6ff20a551ad32b6b41264f3c75275675406ddfa8e3530d154be3 requests==2.19.1 \ --hash=sha256:63b52e3c866428a224f97cab011de738c36aec0185aa91cfacd418b5d58911d1 \ --hash=sha256:ec22d826a36ed72a7358ff3fe56cbd4ba69dd7a6718ffd450ff0e9df7a47ce6a -setuptools==39.2.0 \ - --hash=sha256:8fca9275c89964f13da985c3656cb00ba029d7f3916b37990927ffdf264e7926 \ - --hash=sha256:f7cddbb5f5c640311eb00eab6e849f7701fa70bf6a183fc8a2c33dd1d1672fb2 +setuptools==40.0.0 \ + --hash=sha256:012adb8e25fbfd64c652e99e7bab58799a3aaf05d39ab38561f69190a909015f \ + --hash=sha256:d68abee4eed409fbe8c302ac4d8429a1ffef912cd047a903b5701c024048dd49 six==1.11.0 \ --hash=sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9 \ --hash=sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb diff --git a/contrib/make_apk b/contrib/make_apk index d80ddc382..773aeab54 100755 --- a/contrib/make_apk +++ b/contrib/make_apk @@ -1,6 +1,6 @@ #!/bin/bash -pushd ./gui/kivy/ +pushd ./electrum/gui/kivy/ if [[ -n "$1" && "$1" == "release" ]] ; then echo -n Keystore Password: diff --git a/contrib/make_locale b/contrib/make_locale index 3ab4b21cf..052f5d87f 100755 --- a/contrib/make_locale +++ b/contrib/make_locale @@ -8,8 +8,7 @@ import requests os.chdir(os.path.dirname(os.path.realpath(__file__))) os.chdir('..') -code_directories = 'gui plugins lib' -cmd = "find {} -type f -name '*.py' -o -name '*.kv'".format(code_directories) +cmd = "find electrum -type f -name '*.py' -o -name '*.kv'" files = subprocess.check_output(cmd, shell=True) @@ -19,13 +18,13 @@ with open("app.fil", "wb") as f: print("Found {} files to translate".format(len(files.splitlines()))) # Generate fresh translation template -if not os.path.exists('lib/locale'): - os.mkdir('lib/locale') -cmd = 'xgettext -s --from-code UTF-8 --language Python --no-wrap -f app.fil --output=lib/locale/messages.pot' +if not os.path.exists('electrum/locale'): + os.mkdir('electrum/locale') +cmd = 'xgettext -s --from-code UTF-8 --language Python --no-wrap -f app.fil --output=electrum/locale/messages.pot' print('Generate template') os.system(cmd) -os.chdir('lib') +os.chdir('electrum') crowdin_identifier = 'electrum' crowdin_file_name = 'files[electrum-client/messages.pot]' diff --git a/contrib/requirements/requirements-binaries.txt b/contrib/requirements/requirements-binaries.txt index 10a1c8d94..9faf682e9 100644 --- a/contrib/requirements/requirements-binaries.txt +++ b/contrib/requirements/requirements-binaries.txt @@ -1,2 +1,2 @@ -PyQt5 +PyQt5<5.11 pycryptodomex diff --git a/electrum-env b/electrum-env index 1c2e6a4e3..71dfd5958 100755 --- a/electrum-env +++ b/electrum-env @@ -22,6 +22,6 @@ fi export PYTHONPATH="/usr/local/lib/python${PYTHON_VER}/site-packages:$PYTHONPATH" -./electrum "$@" +./run_electrum "$@" deactivate diff --git a/lib/__init__.py b/electrum/__init__.py similarity index 94% rename from lib/__init__.py rename to electrum/__init__.py index 286e4b6af..d8df161f1 100644 --- a/lib/__init__.py +++ b/electrum/__init__.py @@ -10,5 +10,5 @@ from . import bitcoin from . import transaction from . import daemon from .transaction import Transaction -from .plugins import BasePlugin +from .plugin import BasePlugin from .commands import Commands, known_commands diff --git a/lib/base_crash_reporter.py b/electrum/base_crash_reporter.py similarity index 98% rename from lib/base_crash_reporter.py rename to electrum/base_crash_reporter.py index 1f3bf669e..a5702e2e6 100644 --- a/lib/base_crash_reporter.py +++ b/electrum/base_crash_reporter.py @@ -28,8 +28,9 @@ import os import requests -from electrum import ELECTRUM_VERSION, constants -from electrum.i18n import _ +from .version import ELECTRUM_VERSION +from .import constants +from .i18n import _ class BaseCrashReporter(object): diff --git a/lib/base_wizard.py b/electrum/base_wizard.py similarity index 100% rename from lib/base_wizard.py rename to electrum/base_wizard.py diff --git a/lib/bitcoin.py b/electrum/bitcoin.py similarity index 100% rename from lib/bitcoin.py rename to electrum/bitcoin.py diff --git a/lib/blockchain.py b/electrum/blockchain.py similarity index 98% rename from lib/blockchain.py rename to electrum/blockchain.py index b5f0a0b8f..3aaa80678 100644 --- a/lib/blockchain.py +++ b/electrum/blockchain.py @@ -34,6 +34,8 @@ MAX_TARGET = 0x00000000FFFF0000000000000000000000000000000000000000000000000000 class MissingHeader(Exception): pass +class InvalidHeader(Exception): + pass def serialize_header(res): s = int_to_hex(res.get('version'), 4) \ @@ -46,9 +48,9 @@ def serialize_header(res): def deserialize_header(s, height): if not s: - raise Exception('Invalid header: {}'.format(s)) + raise InvalidHeader('Invalid header: {}'.format(s)) if len(s) != 80: - raise Exception('Invalid header length: {}'.format(len(s))) + raise InvalidHeader('Invalid header length: {}'.format(len(s))) hex_to_int = lambda s: int('0x' + bh2u(s[::-1]), 16) h = {} h['version'] = hex_to_int(s[0:4]) diff --git a/lib/checkpoints.json b/electrum/checkpoints.json similarity index 100% rename from lib/checkpoints.json rename to electrum/checkpoints.json diff --git a/lib/checkpoints_testnet.json b/electrum/checkpoints_testnet.json similarity index 100% rename from lib/checkpoints_testnet.json rename to electrum/checkpoints_testnet.json diff --git a/lib/coinchooser.py b/electrum/coinchooser.py similarity index 100% rename from lib/coinchooser.py rename to electrum/coinchooser.py diff --git a/lib/commands.py b/electrum/commands.py similarity index 99% rename from lib/commands.py rename to electrum/commands.py index 71f7b2919..a95d74edc 100644 --- a/lib/commands.py +++ b/electrum/commands.py @@ -35,12 +35,12 @@ from decimal import Decimal from .import util, ecc from .util import bfh, bh2u, format_satoshis, json_decode, print_error, json_encode -from .import bitcoin +from . import bitcoin from .bitcoin import is_address, hash_160, COIN, TYPE_ADDRESS from .i18n import _ from .transaction import Transaction, multisig_script from .paymentrequest import PR_PAID, PR_UNPAID, PR_UNKNOWN, PR_EXPIRED -from .plugins import run_hook +from .plugin import run_hook known_commands = {} diff --git a/lib/constants.py b/electrum/constants.py similarity index 100% rename from lib/constants.py rename to electrum/constants.py diff --git a/lib/contacts.py b/electrum/contacts.py similarity index 100% rename from lib/contacts.py rename to electrum/contacts.py diff --git a/lib/crypto.py b/electrum/crypto.py similarity index 100% rename from lib/crypto.py rename to electrum/crypto.py diff --git a/lib/currencies.json b/electrum/currencies.json similarity index 99% rename from lib/currencies.json rename to electrum/currencies.json index af9978d68..f0fabafa9 100644 --- a/lib/currencies.json +++ b/electrum/currencies.json @@ -341,6 +341,12 @@ "Bitcointoyou": [ "BRL" ], + "BitcoinVenezuela": [ + "ARS", + "EUR", + "USD", + "VEF" + ], "Bitmarket": [ "PLN" ], @@ -814,4 +820,4 @@ "USD" ], "itBit": [] -} \ No newline at end of file +} diff --git a/lib/daemon.py b/electrum/daemon.py similarity index 99% rename from lib/daemon.py rename to electrum/daemon.py index 64a12e058..ccdce4a0a 100644 --- a/lib/daemon.py +++ b/electrum/daemon.py @@ -41,7 +41,7 @@ from .storage import WalletStorage from .commands import known_commands, Commands from .simple_config import SimpleConfig from .exchange_rate import FxThread -from .plugins import run_hook +from .plugin import run_hook def get_lockfile(config): @@ -307,7 +307,7 @@ class Daemon(DaemonThread): gui_name = config.get('gui', 'qt') if gui_name in ['lite', 'classic']: gui_name = 'qt' - gui = __import__('electrum_gui.' + gui_name, fromlist=['electrum_gui']) + gui = __import__('electrum.gui.' + gui_name, fromlist=['electrum']) self.gui = gui.ElectrumGui(config, self, plugins) try: self.gui.main() diff --git a/lib/dnssec.py b/electrum/dnssec.py similarity index 100% rename from lib/dnssec.py rename to electrum/dnssec.py diff --git a/lib/ecc.py b/electrum/ecc.py similarity index 100% rename from lib/ecc.py rename to electrum/ecc.py diff --git a/lib/ecc_fast.py b/electrum/ecc_fast.py similarity index 100% rename from lib/ecc_fast.py rename to electrum/ecc_fast.py diff --git a/electrum/electrum b/electrum/electrum new file mode 120000 index 000000000..74bf81ab6 --- /dev/null +++ b/electrum/electrum @@ -0,0 +1 @@ +../run_electrum \ No newline at end of file diff --git a/lib/exchange_rate.py b/electrum/exchange_rate.py similarity index 100% rename from lib/exchange_rate.py rename to electrum/exchange_rate.py diff --git a/gui/__init__.py b/electrum/gui/__init__.py similarity index 100% rename from gui/__init__.py rename to electrum/gui/__init__.py diff --git a/gui/kivy/Makefile b/electrum/gui/kivy/Makefile similarity index 54% rename from gui/kivy/Makefile rename to electrum/gui/kivy/Makefile index e616f9d1a..7e87afa6b 100644 --- a/gui/kivy/Makefile +++ b/electrum/gui/kivy/Makefile @@ -8,25 +8,25 @@ theming: $(PYTHON) -m kivy.atlas theming/light 1024 theming/light/*.png prepare: # running pre build setup - @cp tools/buildozer.spec ../../buildozer.spec + @cp tools/buildozer.spec ../../../buildozer.spec # copy electrum to main.py - @cp ../../electrum ../../main.py + @cp ../../../run_electrum ../../../main.py @-if [ ! -d "../../.buildozer" ];then \ - cd ../..; buildozer android debug;\ - cp -f gui/kivy/tools/blacklist.txt .buildozer/android/platform/python-for-android/src/blacklist.txt;\ + cd ../../..; buildozer android debug;\ + cp -f electrum/gui/kivy/tools/blacklist.txt .buildozer/android/platform/python-for-android/src/blacklist.txt;\ rm -rf ./.buildozer/android/platform/python-for-android/dist;\ fi apk: @make prepare - @-cd ../..; buildozer android debug deploy run + @-cd ../../..; buildozer android debug deploy run @make clean release: @make prepare - @-cd ../..; buildozer android release + @-cd ../../..; buildozer android release @make clean clean: # Cleaning up # rename main.py to electrum - @-rm ../../main.py + @-rm ../../../main.py # remove buildozer.spec - @-rm ../../buildozer.spec + @-rm ../../../buildozer.spec diff --git a/gui/kivy/Readme.md b/electrum/gui/kivy/Readme.md similarity index 95% rename from gui/kivy/Readme.md rename to electrum/gui/kivy/Readme.md index f8d881ce6..4c151accc 100644 --- a/gui/kivy/Readme.md +++ b/electrum/gui/kivy/Readme.md @@ -112,15 +112,7 @@ e.g. those needed in the next step. ~/.buildozer/android/platform/android-sdk-20/tools/android update sdk -u -t build-tools-27.0.3,android-19,extra-android-m2repository -## 9. Set apk version - -Create a file `contrib/versions.py` with contents similar to: -``` -version_apk = '3.1.999' -``` -This will be the version of the Android app. - -## 10. Build the APK +## 9. Build the APK ```sh contrib/make_apk diff --git a/gui/kivy/__init__.py b/electrum/gui/kivy/__init__.py similarity index 100% rename from gui/kivy/__init__.py rename to electrum/gui/kivy/__init__.py diff --git a/gui/kivy/data/background.png b/electrum/gui/kivy/data/background.png similarity index 100% rename from gui/kivy/data/background.png rename to electrum/gui/kivy/data/background.png diff --git a/gui/kivy/data/fonts/Roboto-Bold.ttf b/electrum/gui/kivy/data/fonts/Roboto-Bold.ttf similarity index 100% rename from gui/kivy/data/fonts/Roboto-Bold.ttf rename to electrum/gui/kivy/data/fonts/Roboto-Bold.ttf diff --git a/gui/kivy/data/fonts/Roboto-Condensed.ttf b/electrum/gui/kivy/data/fonts/Roboto-Condensed.ttf similarity index 100% rename from gui/kivy/data/fonts/Roboto-Condensed.ttf rename to electrum/gui/kivy/data/fonts/Roboto-Condensed.ttf diff --git a/gui/kivy/data/fonts/Roboto-Medium.ttf b/electrum/gui/kivy/data/fonts/Roboto-Medium.ttf similarity index 100% rename from gui/kivy/data/fonts/Roboto-Medium.ttf rename to electrum/gui/kivy/data/fonts/Roboto-Medium.ttf diff --git a/gui/kivy/data/fonts/Roboto.ttf b/electrum/gui/kivy/data/fonts/Roboto.ttf similarity index 100% rename from gui/kivy/data/fonts/Roboto.ttf rename to electrum/gui/kivy/data/fonts/Roboto.ttf diff --git a/gui/kivy/data/fonts/tron/License.txt b/electrum/gui/kivy/data/fonts/tron/License.txt similarity index 100% rename from gui/kivy/data/fonts/tron/License.txt rename to electrum/gui/kivy/data/fonts/tron/License.txt diff --git a/gui/kivy/data/fonts/tron/Readme.txt b/electrum/gui/kivy/data/fonts/tron/Readme.txt similarity index 100% rename from gui/kivy/data/fonts/tron/Readme.txt rename to electrum/gui/kivy/data/fonts/tron/Readme.txt diff --git a/gui/kivy/data/fonts/tron/Tr2n.ttf b/electrum/gui/kivy/data/fonts/tron/Tr2n.ttf similarity index 100% rename from gui/kivy/data/fonts/tron/Tr2n.ttf rename to electrum/gui/kivy/data/fonts/tron/Tr2n.ttf diff --git a/gui/kivy/data/glsl/default.fs b/electrum/gui/kivy/data/glsl/default.fs similarity index 100% rename from gui/kivy/data/glsl/default.fs rename to electrum/gui/kivy/data/glsl/default.fs diff --git a/gui/kivy/data/glsl/default.png b/electrum/gui/kivy/data/glsl/default.png similarity index 100% rename from gui/kivy/data/glsl/default.png rename to electrum/gui/kivy/data/glsl/default.png diff --git a/gui/kivy/data/glsl/default.vs b/electrum/gui/kivy/data/glsl/default.vs similarity index 100% rename from gui/kivy/data/glsl/default.vs rename to electrum/gui/kivy/data/glsl/default.vs diff --git a/gui/kivy/data/glsl/header.fs b/electrum/gui/kivy/data/glsl/header.fs similarity index 100% rename from gui/kivy/data/glsl/header.fs rename to electrum/gui/kivy/data/glsl/header.fs diff --git a/gui/kivy/data/glsl/header.vs b/electrum/gui/kivy/data/glsl/header.vs similarity index 100% rename from gui/kivy/data/glsl/header.vs rename to electrum/gui/kivy/data/glsl/header.vs diff --git a/gui/kivy/data/images/defaulttheme-0.png b/electrum/gui/kivy/data/images/defaulttheme-0.png similarity index 100% rename from gui/kivy/data/images/defaulttheme-0.png rename to electrum/gui/kivy/data/images/defaulttheme-0.png diff --git a/gui/kivy/data/images/defaulttheme.atlas b/electrum/gui/kivy/data/images/defaulttheme.atlas similarity index 100% rename from gui/kivy/data/images/defaulttheme.atlas rename to electrum/gui/kivy/data/images/defaulttheme.atlas diff --git a/gui/kivy/data/java-classes/org/electrum/qr/SimpleScannerActivity.java b/electrum/gui/kivy/data/java-classes/org/electrum/qr/SimpleScannerActivity.java similarity index 100% rename from gui/kivy/data/java-classes/org/electrum/qr/SimpleScannerActivity.java rename to electrum/gui/kivy/data/java-classes/org/electrum/qr/SimpleScannerActivity.java diff --git a/gui/kivy/data/logo/kivy-icon-32.png b/electrum/gui/kivy/data/logo/kivy-icon-32.png similarity index 100% rename from gui/kivy/data/logo/kivy-icon-32.png rename to electrum/gui/kivy/data/logo/kivy-icon-32.png diff --git a/gui/kivy/data/style.kv b/electrum/gui/kivy/data/style.kv similarity index 100% rename from gui/kivy/data/style.kv rename to electrum/gui/kivy/data/style.kv diff --git a/gui/kivy/i18n.py b/electrum/gui/kivy/i18n.py similarity index 100% rename from gui/kivy/i18n.py rename to electrum/gui/kivy/i18n.py diff --git a/gui/kivy/main.kv b/electrum/gui/kivy/main.kv similarity index 95% rename from gui/kivy/main.kv rename to electrum/gui/kivy/main.kv index b9f89ed70..b4f05188e 100644 --- a/gui/kivy/main.kv +++ b/electrum/gui/kivy/main.kv @@ -1,7 +1,7 @@ #:import Clock kivy.clock.Clock #:import Window kivy.core.window.Window #:import Factory kivy.factory.Factory -#:import _ electrum_gui.kivy.i18n._ +#:import _ electrum.gui.kivy.i18n._ ########################### @@ -189,7 +189,7 @@ Color: rgba: 0.192, .498, 0.745, 1 BorderImage: - source: 'atlas://gui/kivy/theming/light/card_bottom' + source: 'atlas://electrum/gui/kivy/theming/light/card_bottom' size: self.size pos: self.pos @@ -203,7 +203,7 @@ Color: rgba: 0.192, .498, 0.745, 1 BorderImage: - source: 'atlas://gui/kivy/theming/light/card_bottom' + source: 'atlas://electrum/gui/kivy/theming/light/card_bottom' size: self.size pos: self.pos @@ -216,7 +216,7 @@ Color: rgba: 0.192, .498, 0.745, 1 BorderImage: - source: 'atlas://gui/kivy/theming/light/card_bottom' + source: 'atlas://electrum/gui/kivy/theming/light/card_bottom' size: self.size pos: self.pos @@ -326,8 +326,8 @@ valign: 'middle' bold: True font_size: '12.5sp' - background_normal: 'atlas://gui/kivy/theming/light/tab_btn' - background_down: 'atlas://gui/kivy/theming/light/tab_btn_pressed' + background_normal: 'atlas://electrum/gui/kivy/theming/light/tab_btn' + background_down: 'atlas://electrum/gui/kivy/theming/light/tab_btn_pressed' : @@ -416,14 +416,14 @@ BoxLayout: rgb: .6, .6, .6 Rectangle: size: self.size - source: 'gui/kivy/data/background.png' + source: 'electrum/gui/kivy/data/background.png' ActionBar: ActionView: id: av ActionPrevious: - app_icon: 'atlas://gui/kivy/theming/light/logo' + app_icon: 'atlas://electrum/gui/kivy/theming/light/logo' app_icon_width: '100dp' with_previous: False size_hint_x: None diff --git a/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py similarity index 96% rename from gui/kivy/main_window.py rename to electrum/gui/kivy/main_window.py index a067f8c0a..5414543f1 100644 --- a/gui/kivy/main_window.py +++ b/electrum/gui/kivy/main_window.py @@ -7,13 +7,13 @@ import traceback from decimal import Decimal import threading -import electrum from electrum.bitcoin import TYPE_ADDRESS -from electrum import WalletStorage, Wallet -from electrum_gui.kivy.i18n import _ +from electrum.storage import WalletStorage +from electrum.wallet import Wallet +from electrum.i18n import _ from electrum.paymentrequest import InvoiceStore from electrum.util import profiler, InvalidPassword -from electrum.plugins import run_hook +from electrum.plugin import run_hook from electrum.util import format_satoshis, format_satoshis_plain from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED @@ -30,10 +30,10 @@ from kivy.metrics import inch from kivy.lang import Builder ## lazy imports for factory so that widgets can be used in kv -#Factory.register('InstallWizard', module='electrum_gui.kivy.uix.dialogs.installwizard') -#Factory.register('InfoBubble', module='electrum_gui.kivy.uix.dialogs') -#Factory.register('OutputList', module='electrum_gui.kivy.uix.dialogs') -#Factory.register('OutputItem', module='electrum_gui.kivy.uix.dialogs') +#Factory.register('InstallWizard', module='electrum.gui.kivy.uix.dialogs.installwizard') +#Factory.register('InfoBubble', module='electrum.gui.kivy.uix.dialogs') +#Factory.register('OutputList', module='electrum.gui.kivy.uix.dialogs') +#Factory.register('OutputItem', module='electrum.gui.kivy.uix.dialogs') from .uix.dialogs.installwizard import InstallWizard from .uix.dialogs import InfoBubble, crash_reporter @@ -56,16 +56,16 @@ from kivy.uix.tabbedpanel import TabbedPanel from kivy.uix.label import Label from kivy.core.clipboard import Clipboard -Factory.register('TabbedCarousel', module='electrum_gui.kivy.uix.screens') +Factory.register('TabbedCarousel', module='electrum.gui.kivy.uix.screens') # Register fonts without this you won't be able to use bold/italic... # inside markup. from kivy.core.text import Label Label.register('Roboto', - 'gui/kivy/data/fonts/Roboto.ttf', - 'gui/kivy/data/fonts/Roboto.ttf', - 'gui/kivy/data/fonts/Roboto-Bold.ttf', - 'gui/kivy/data/fonts/Roboto-Bold.ttf') + 'electrum/gui/kivy/data/fonts/Roboto.ttf', + 'electrum/gui/kivy/data/fonts/Roboto.ttf', + 'electrum/gui/kivy/data/fonts/Roboto-Bold.ttf', + 'electrum/gui/kivy/data/fonts/Roboto-Bold.ttf') from electrum.util import (base_units, NoDynamicFeeEstimates, decimal_point_to_base_unit_name, @@ -363,7 +363,7 @@ class ElectrumWindow(App): memo = req.get('memo') amount = req.get('amount') fund = req.get('fund') - popup = Builder.load_file('gui/kivy/uix/ui_screens/invoice.kv') + popup = Builder.load_file('electrum/gui/kivy/uix/ui_screens/invoice.kv') popup.is_invoice = is_invoice popup.amount = amount popup.requestor = requestor if is_invoice else req.get('address') @@ -382,7 +382,7 @@ class ElectrumWindow(App): from electrum.util import format_time fund = req.get('fund') isaddr = 'y' - popup = Builder.load_file('gui/kivy/uix/ui_screens/invoice.kv') + popup = Builder.load_file('electrum/gui/kivy/uix/ui_screens/invoice.kv') popup.isaddr = isaddr popup.is_invoice = False popup.status = status @@ -435,7 +435,7 @@ class ElectrumWindow(App): currentActivity.startActivity(it) def build(self): - return Builder.load_file('gui/kivy/main.kv') + return Builder.load_file('electrum/gui/kivy/main.kv') def _pause(self): if platform == 'android': @@ -592,7 +592,7 @@ class ElectrumWindow(App): d = WalletDialog() d.open() elif name == 'status': - popup = Builder.load_file('gui/kivy/uix/ui_screens/'+name+'.kv') + popup = Builder.load_file('electrum/gui/kivy/uix/ui_screens/'+name+'.kv') master_public_keys_layout = popup.ids.master_public_keys for xpub in self.wallet.get_master_public_keys()[1:]: master_public_keys_layout.add_widget(TopLabel(text=_('Master Public Key'))) @@ -602,7 +602,7 @@ class ElectrumWindow(App): master_public_keys_layout.add_widget(ref) popup.open() else: - popup = Builder.load_file('gui/kivy/uix/ui_screens/'+name+'.kv') + popup = Builder.load_file('electrum/gui/kivy/uix/ui_screens/'+name+'.kv') popup.open() @profiler @@ -618,9 +618,9 @@ class ElectrumWindow(App): #setup lazy imports for mainscreen Factory.register('AnimatedPopup', - module='electrum_gui.kivy.uix.dialogs') + module='electrum.gui.kivy.uix.dialogs') Factory.register('QRCodeWidget', - module='electrum_gui.kivy.uix.qrcodewidget') + module='electrum.gui.kivy.uix.qrcodewidget') # preload widgets. Remove this if you want to load the widgets on demand #Cache.append('electrum_widgets', 'AnimatedPopup', Factory.AnimatedPopup()) @@ -777,7 +777,7 @@ class ElectrumWindow(App): self.send_payment(address, amount=amount, label=label, message=message) def show_error(self, error, width='200dp', pos=None, arrow_pos=None, - exit=False, icon='atlas://gui/kivy/theming/light/error', duration=0, + exit=False, icon='atlas://electrum/gui/kivy/theming/light/error', duration=0, modal=False): ''' Show an error Message Bubble. ''' @@ -789,7 +789,7 @@ class ElectrumWindow(App): exit=False, duration=0, modal=False): ''' Show an Info Message Bubble. ''' - self.show_error(error, icon='atlas://gui/kivy/theming/light/important', + self.show_error(error, icon='atlas://electrum/gui/kivy/theming/light/important', duration=duration, modal=modal, exit=exit, pos=pos, arrow_pos=arrow_pos) @@ -829,7 +829,7 @@ class ElectrumWindow(App): info_bubble.show_arrow = False img.allow_stretch = True info_bubble.dim_background = True - info_bubble.background_image = 'atlas://gui/kivy/theming/light/card' + info_bubble.background_image = 'atlas://electrum/gui/kivy/theming/light/card' else: info_bubble.fs = False info_bubble.icon = icon diff --git a/gui/kivy/nfc_scanner/__init__.py b/electrum/gui/kivy/nfc_scanner/__init__.py similarity index 99% rename from gui/kivy/nfc_scanner/__init__.py rename to electrum/gui/kivy/nfc_scanner/__init__.py index cb441b112..81084a64c 100644 --- a/gui/kivy/nfc_scanner/__init__.py +++ b/electrum/gui/kivy/nfc_scanner/__init__.py @@ -41,4 +41,4 @@ class NFCBase(Widget): NFCScanner = core_select_lib('nfc_manager', ( # keep the dummy implementation as the last one to make it the fallback provider.NFCScanner = core_select_lib('nfc_scanner', ( ('android', 'scanner_android', 'ScannerAndroid'), - ('dummy', 'scanner_dummy', 'ScannerDummy')), True, 'electrum_gui.kivy') + ('dummy', 'scanner_dummy', 'ScannerDummy')), True, 'electrum.gui.kivy') diff --git a/gui/kivy/nfc_scanner/scanner_android.py b/electrum/gui/kivy/nfc_scanner/scanner_android.py similarity index 99% rename from gui/kivy/nfc_scanner/scanner_android.py rename to electrum/gui/kivy/nfc_scanner/scanner_android.py index 53b078cf3..32ffda169 100644 --- a/gui/kivy/nfc_scanner/scanner_android.py +++ b/electrum/gui/kivy/nfc_scanner/scanner_android.py @@ -10,7 +10,7 @@ if platform != 'android': raise ImportError import threading -from electrum_gui.kivy.nfc_scanner import NFCBase +from . import NFCBase from jnius import autoclass, cast from android.runnable import run_on_ui_thread from android import activity diff --git a/gui/kivy/nfc_scanner/scanner_dummy.py b/electrum/gui/kivy/nfc_scanner/scanner_dummy.py similarity index 96% rename from gui/kivy/nfc_scanner/scanner_dummy.py rename to electrum/gui/kivy/nfc_scanner/scanner_dummy.py index 1ad2c17a3..a0d3e2643 100644 --- a/gui/kivy/nfc_scanner/scanner_dummy.py +++ b/electrum/gui/kivy/nfc_scanner/scanner_dummy.py @@ -1,6 +1,6 @@ ''' Dummy NFC Provider to be used on desktops in case no other provider is found ''' -from electrum_gui.kivy.nfc_scanner import NFCBase +from . import NFCBase from kivy.clock import Clock from kivy.logger import Logger diff --git a/gui/kivy/theming/light/action_bar.png b/electrum/gui/kivy/theming/light/action_bar.png similarity index 100% rename from gui/kivy/theming/light/action_bar.png rename to electrum/gui/kivy/theming/light/action_bar.png diff --git a/gui/kivy/theming/light/action_button_group.png b/electrum/gui/kivy/theming/light/action_button_group.png similarity index 100% rename from gui/kivy/theming/light/action_button_group.png rename to electrum/gui/kivy/theming/light/action_button_group.png diff --git a/gui/kivy/theming/light/action_group_dark.png b/electrum/gui/kivy/theming/light/action_group_dark.png similarity index 100% rename from gui/kivy/theming/light/action_group_dark.png rename to electrum/gui/kivy/theming/light/action_group_dark.png diff --git a/gui/kivy/theming/light/action_group_light.png b/electrum/gui/kivy/theming/light/action_group_light.png similarity index 100% rename from gui/kivy/theming/light/action_group_light.png rename to electrum/gui/kivy/theming/light/action_group_light.png diff --git a/gui/kivy/theming/light/add_contact.png b/electrum/gui/kivy/theming/light/add_contact.png similarity index 100% rename from gui/kivy/theming/light/add_contact.png rename to electrum/gui/kivy/theming/light/add_contact.png diff --git a/gui/kivy/theming/light/arrow_back.png b/electrum/gui/kivy/theming/light/arrow_back.png similarity index 100% rename from gui/kivy/theming/light/arrow_back.png rename to electrum/gui/kivy/theming/light/arrow_back.png diff --git a/gui/kivy/theming/light/bit_logo.png b/electrum/gui/kivy/theming/light/bit_logo.png similarity index 100% rename from gui/kivy/theming/light/bit_logo.png rename to electrum/gui/kivy/theming/light/bit_logo.png diff --git a/gui/kivy/theming/light/blue_bg_round_rb.png b/electrum/gui/kivy/theming/light/blue_bg_round_rb.png similarity index 100% rename from gui/kivy/theming/light/blue_bg_round_rb.png rename to electrum/gui/kivy/theming/light/blue_bg_round_rb.png diff --git a/gui/kivy/theming/light/btn_create_account.png b/electrum/gui/kivy/theming/light/btn_create_account.png similarity index 100% rename from gui/kivy/theming/light/btn_create_account.png rename to electrum/gui/kivy/theming/light/btn_create_account.png diff --git a/gui/kivy/theming/light/btn_create_act_disabled.png b/electrum/gui/kivy/theming/light/btn_create_act_disabled.png similarity index 100% rename from gui/kivy/theming/light/btn_create_act_disabled.png rename to electrum/gui/kivy/theming/light/btn_create_act_disabled.png diff --git a/gui/kivy/theming/light/btn_nfc.png b/electrum/gui/kivy/theming/light/btn_nfc.png similarity index 100% rename from gui/kivy/theming/light/btn_nfc.png rename to electrum/gui/kivy/theming/light/btn_nfc.png diff --git a/gui/kivy/theming/light/btn_send_address.png b/electrum/gui/kivy/theming/light/btn_send_address.png similarity index 100% rename from gui/kivy/theming/light/btn_send_address.png rename to electrum/gui/kivy/theming/light/btn_send_address.png diff --git a/gui/kivy/theming/light/btn_send_nfc.png b/electrum/gui/kivy/theming/light/btn_send_nfc.png similarity index 100% rename from gui/kivy/theming/light/btn_send_nfc.png rename to electrum/gui/kivy/theming/light/btn_send_nfc.png diff --git a/gui/kivy/theming/light/calculator.png b/electrum/gui/kivy/theming/light/calculator.png similarity index 100% rename from gui/kivy/theming/light/calculator.png rename to electrum/gui/kivy/theming/light/calculator.png diff --git a/gui/kivy/theming/light/camera.png b/electrum/gui/kivy/theming/light/camera.png similarity index 100% rename from gui/kivy/theming/light/camera.png rename to electrum/gui/kivy/theming/light/camera.png diff --git a/gui/kivy/theming/light/card.png b/electrum/gui/kivy/theming/light/card.png similarity index 100% rename from gui/kivy/theming/light/card.png rename to electrum/gui/kivy/theming/light/card.png diff --git a/gui/kivy/theming/light/card_bottom.png b/electrum/gui/kivy/theming/light/card_bottom.png similarity index 100% rename from gui/kivy/theming/light/card_bottom.png rename to electrum/gui/kivy/theming/light/card_bottom.png diff --git a/gui/kivy/theming/light/card_btn.png b/electrum/gui/kivy/theming/light/card_btn.png similarity index 100% rename from gui/kivy/theming/light/card_btn.png rename to electrum/gui/kivy/theming/light/card_btn.png diff --git a/gui/kivy/theming/light/card_top.png b/electrum/gui/kivy/theming/light/card_top.png similarity index 100% rename from gui/kivy/theming/light/card_top.png rename to electrum/gui/kivy/theming/light/card_top.png diff --git a/gui/kivy/theming/light/carousel_deselected.png b/electrum/gui/kivy/theming/light/carousel_deselected.png similarity index 100% rename from gui/kivy/theming/light/carousel_deselected.png rename to electrum/gui/kivy/theming/light/carousel_deselected.png diff --git a/gui/kivy/theming/light/carousel_selected.png b/electrum/gui/kivy/theming/light/carousel_selected.png similarity index 100% rename from gui/kivy/theming/light/carousel_selected.png rename to electrum/gui/kivy/theming/light/carousel_selected.png diff --git a/gui/kivy/theming/light/clock1.png b/electrum/gui/kivy/theming/light/clock1.png similarity index 100% rename from gui/kivy/theming/light/clock1.png rename to electrum/gui/kivy/theming/light/clock1.png diff --git a/gui/kivy/theming/light/clock2.png b/electrum/gui/kivy/theming/light/clock2.png similarity index 100% rename from gui/kivy/theming/light/clock2.png rename to electrum/gui/kivy/theming/light/clock2.png diff --git a/gui/kivy/theming/light/clock3.png b/electrum/gui/kivy/theming/light/clock3.png similarity index 100% rename from gui/kivy/theming/light/clock3.png rename to electrum/gui/kivy/theming/light/clock3.png diff --git a/gui/kivy/theming/light/clock4.png b/electrum/gui/kivy/theming/light/clock4.png similarity index 100% rename from gui/kivy/theming/light/clock4.png rename to electrum/gui/kivy/theming/light/clock4.png diff --git a/gui/kivy/theming/light/clock5.png b/electrum/gui/kivy/theming/light/clock5.png similarity index 100% rename from gui/kivy/theming/light/clock5.png rename to electrum/gui/kivy/theming/light/clock5.png diff --git a/gui/kivy/theming/light/close.png b/electrum/gui/kivy/theming/light/close.png similarity index 100% rename from gui/kivy/theming/light/close.png rename to electrum/gui/kivy/theming/light/close.png diff --git a/gui/kivy/theming/light/closebutton.png b/electrum/gui/kivy/theming/light/closebutton.png similarity index 100% rename from gui/kivy/theming/light/closebutton.png rename to electrum/gui/kivy/theming/light/closebutton.png diff --git a/gui/kivy/theming/light/confirmed.png b/electrum/gui/kivy/theming/light/confirmed.png similarity index 100% rename from gui/kivy/theming/light/confirmed.png rename to electrum/gui/kivy/theming/light/confirmed.png diff --git a/gui/kivy/theming/light/contact.png b/electrum/gui/kivy/theming/light/contact.png similarity index 100% rename from gui/kivy/theming/light/contact.png rename to electrum/gui/kivy/theming/light/contact.png diff --git a/gui/kivy/theming/light/contact_overlay.png b/electrum/gui/kivy/theming/light/contact_overlay.png similarity index 100% rename from gui/kivy/theming/light/contact_overlay.png rename to electrum/gui/kivy/theming/light/contact_overlay.png diff --git a/gui/kivy/theming/light/create_act_text.png b/electrum/gui/kivy/theming/light/create_act_text.png similarity index 100% rename from gui/kivy/theming/light/create_act_text.png rename to electrum/gui/kivy/theming/light/create_act_text.png diff --git a/gui/kivy/theming/light/create_act_text_active.png b/electrum/gui/kivy/theming/light/create_act_text_active.png similarity index 100% rename from gui/kivy/theming/light/create_act_text_active.png rename to electrum/gui/kivy/theming/light/create_act_text_active.png diff --git a/gui/kivy/theming/light/dialog.png b/electrum/gui/kivy/theming/light/dialog.png similarity index 100% rename from gui/kivy/theming/light/dialog.png rename to electrum/gui/kivy/theming/light/dialog.png diff --git a/gui/kivy/theming/light/dropdown_background.png b/electrum/gui/kivy/theming/light/dropdown_background.png similarity index 100% rename from gui/kivy/theming/light/dropdown_background.png rename to electrum/gui/kivy/theming/light/dropdown_background.png diff --git a/gui/kivy/theming/light/electrum_icon640.png b/electrum/gui/kivy/theming/light/electrum_icon640.png similarity index 100% rename from gui/kivy/theming/light/electrum_icon640.png rename to electrum/gui/kivy/theming/light/electrum_icon640.png diff --git a/gui/kivy/theming/light/error.png b/electrum/gui/kivy/theming/light/error.png similarity index 100% rename from gui/kivy/theming/light/error.png rename to electrum/gui/kivy/theming/light/error.png diff --git a/gui/kivy/theming/light/gear.png b/electrum/gui/kivy/theming/light/gear.png similarity index 100% rename from gui/kivy/theming/light/gear.png rename to electrum/gui/kivy/theming/light/gear.png diff --git a/gui/kivy/theming/light/globe.png b/electrum/gui/kivy/theming/light/globe.png similarity index 100% rename from gui/kivy/theming/light/globe.png rename to electrum/gui/kivy/theming/light/globe.png diff --git a/gui/kivy/theming/light/icon_border.png b/electrum/gui/kivy/theming/light/icon_border.png similarity index 100% rename from gui/kivy/theming/light/icon_border.png rename to electrum/gui/kivy/theming/light/icon_border.png diff --git a/gui/kivy/theming/light/important.png b/electrum/gui/kivy/theming/light/important.png similarity index 100% rename from gui/kivy/theming/light/important.png rename to electrum/gui/kivy/theming/light/important.png diff --git a/gui/kivy/theming/light/info.png b/electrum/gui/kivy/theming/light/info.png similarity index 100% rename from gui/kivy/theming/light/info.png rename to electrum/gui/kivy/theming/light/info.png diff --git a/gui/kivy/theming/light/lightblue_bg_round_lb.png b/electrum/gui/kivy/theming/light/lightblue_bg_round_lb.png similarity index 100% rename from gui/kivy/theming/light/lightblue_bg_round_lb.png rename to electrum/gui/kivy/theming/light/lightblue_bg_round_lb.png diff --git a/gui/kivy/theming/light/logo.png b/electrum/gui/kivy/theming/light/logo.png similarity index 100% rename from gui/kivy/theming/light/logo.png rename to electrum/gui/kivy/theming/light/logo.png diff --git a/gui/kivy/theming/light/logo_atom_dull.png b/electrum/gui/kivy/theming/light/logo_atom_dull.png similarity index 100% rename from gui/kivy/theming/light/logo_atom_dull.png rename to electrum/gui/kivy/theming/light/logo_atom_dull.png diff --git a/gui/kivy/theming/light/mail_icon.png b/electrum/gui/kivy/theming/light/mail_icon.png similarity index 100% rename from gui/kivy/theming/light/mail_icon.png rename to electrum/gui/kivy/theming/light/mail_icon.png diff --git a/gui/kivy/theming/light/manualentry.png b/electrum/gui/kivy/theming/light/manualentry.png similarity index 100% rename from gui/kivy/theming/light/manualentry.png rename to electrum/gui/kivy/theming/light/manualentry.png diff --git a/gui/kivy/theming/light/network.png b/electrum/gui/kivy/theming/light/network.png similarity index 100% rename from gui/kivy/theming/light/network.png rename to electrum/gui/kivy/theming/light/network.png diff --git a/gui/kivy/theming/light/nfc.png b/electrum/gui/kivy/theming/light/nfc.png similarity index 100% rename from gui/kivy/theming/light/nfc.png rename to electrum/gui/kivy/theming/light/nfc.png diff --git a/gui/kivy/theming/light/nfc_clock.png b/electrum/gui/kivy/theming/light/nfc_clock.png similarity index 100% rename from gui/kivy/theming/light/nfc_clock.png rename to electrum/gui/kivy/theming/light/nfc_clock.png diff --git a/gui/kivy/theming/light/nfc_phone.png b/electrum/gui/kivy/theming/light/nfc_phone.png similarity index 100% rename from gui/kivy/theming/light/nfc_phone.png rename to electrum/gui/kivy/theming/light/nfc_phone.png diff --git a/gui/kivy/theming/light/nfc_stage_one.png b/electrum/gui/kivy/theming/light/nfc_stage_one.png similarity index 100% rename from gui/kivy/theming/light/nfc_stage_one.png rename to electrum/gui/kivy/theming/light/nfc_stage_one.png diff --git a/gui/kivy/theming/light/overflow_background.png b/electrum/gui/kivy/theming/light/overflow_background.png similarity index 100% rename from gui/kivy/theming/light/overflow_background.png rename to electrum/gui/kivy/theming/light/overflow_background.png diff --git a/gui/kivy/theming/light/overflow_btn_dn.png b/electrum/gui/kivy/theming/light/overflow_btn_dn.png similarity index 100% rename from gui/kivy/theming/light/overflow_btn_dn.png rename to electrum/gui/kivy/theming/light/overflow_btn_dn.png diff --git a/gui/kivy/theming/light/paste_icon.png b/electrum/gui/kivy/theming/light/paste_icon.png similarity index 100% rename from gui/kivy/theming/light/paste_icon.png rename to electrum/gui/kivy/theming/light/paste_icon.png diff --git a/gui/kivy/theming/light/pen.png b/electrum/gui/kivy/theming/light/pen.png similarity index 100% rename from gui/kivy/theming/light/pen.png rename to electrum/gui/kivy/theming/light/pen.png diff --git a/gui/kivy/theming/light/qrcode.png b/electrum/gui/kivy/theming/light/qrcode.png similarity index 100% rename from gui/kivy/theming/light/qrcode.png rename to electrum/gui/kivy/theming/light/qrcode.png diff --git a/gui/kivy/theming/light/save.png b/electrum/gui/kivy/theming/light/save.png similarity index 100% rename from gui/kivy/theming/light/save.png rename to electrum/gui/kivy/theming/light/save.png diff --git a/gui/kivy/theming/light/settings.png b/electrum/gui/kivy/theming/light/settings.png similarity index 100% rename from gui/kivy/theming/light/settings.png rename to electrum/gui/kivy/theming/light/settings.png diff --git a/gui/kivy/theming/light/shadow.png b/electrum/gui/kivy/theming/light/shadow.png similarity index 100% rename from gui/kivy/theming/light/shadow.png rename to electrum/gui/kivy/theming/light/shadow.png diff --git a/gui/kivy/theming/light/shadow_right.png b/electrum/gui/kivy/theming/light/shadow_right.png similarity index 100% rename from gui/kivy/theming/light/shadow_right.png rename to electrum/gui/kivy/theming/light/shadow_right.png diff --git a/gui/kivy/theming/light/share.png b/electrum/gui/kivy/theming/light/share.png similarity index 100% rename from gui/kivy/theming/light/share.png rename to electrum/gui/kivy/theming/light/share.png diff --git a/gui/kivy/theming/light/star_big_inactive.png b/electrum/gui/kivy/theming/light/star_big_inactive.png similarity index 100% rename from gui/kivy/theming/light/star_big_inactive.png rename to electrum/gui/kivy/theming/light/star_big_inactive.png diff --git a/gui/kivy/theming/light/stepper_full.png b/electrum/gui/kivy/theming/light/stepper_full.png similarity index 100% rename from gui/kivy/theming/light/stepper_full.png rename to electrum/gui/kivy/theming/light/stepper_full.png diff --git a/gui/kivy/theming/light/stepper_left.png b/electrum/gui/kivy/theming/light/stepper_left.png similarity index 100% rename from gui/kivy/theming/light/stepper_left.png rename to electrum/gui/kivy/theming/light/stepper_left.png diff --git a/gui/kivy/theming/light/stepper_restore_password.png b/electrum/gui/kivy/theming/light/stepper_restore_password.png similarity index 100% rename from gui/kivy/theming/light/stepper_restore_password.png rename to electrum/gui/kivy/theming/light/stepper_restore_password.png diff --git a/gui/kivy/theming/light/stepper_restore_seed.png b/electrum/gui/kivy/theming/light/stepper_restore_seed.png similarity index 100% rename from gui/kivy/theming/light/stepper_restore_seed.png rename to electrum/gui/kivy/theming/light/stepper_restore_seed.png diff --git a/gui/kivy/theming/light/tab.png b/electrum/gui/kivy/theming/light/tab.png similarity index 100% rename from gui/kivy/theming/light/tab.png rename to electrum/gui/kivy/theming/light/tab.png diff --git a/gui/kivy/theming/light/tab_btn.png b/electrum/gui/kivy/theming/light/tab_btn.png similarity index 100% rename from gui/kivy/theming/light/tab_btn.png rename to electrum/gui/kivy/theming/light/tab_btn.png diff --git a/gui/kivy/theming/light/tab_btn_disabled.png b/electrum/gui/kivy/theming/light/tab_btn_disabled.png similarity index 100% rename from gui/kivy/theming/light/tab_btn_disabled.png rename to electrum/gui/kivy/theming/light/tab_btn_disabled.png diff --git a/gui/kivy/theming/light/tab_btn_pressed.png b/electrum/gui/kivy/theming/light/tab_btn_pressed.png similarity index 100% rename from gui/kivy/theming/light/tab_btn_pressed.png rename to electrum/gui/kivy/theming/light/tab_btn_pressed.png diff --git a/gui/kivy/theming/light/tab_disabled.png b/electrum/gui/kivy/theming/light/tab_disabled.png similarity index 100% rename from gui/kivy/theming/light/tab_disabled.png rename to electrum/gui/kivy/theming/light/tab_disabled.png diff --git a/gui/kivy/theming/light/tab_strip.png b/electrum/gui/kivy/theming/light/tab_strip.png similarity index 100% rename from gui/kivy/theming/light/tab_strip.png rename to electrum/gui/kivy/theming/light/tab_strip.png diff --git a/gui/kivy/theming/light/textinput_active.png b/electrum/gui/kivy/theming/light/textinput_active.png similarity index 100% rename from gui/kivy/theming/light/textinput_active.png rename to electrum/gui/kivy/theming/light/textinput_active.png diff --git a/gui/kivy/theming/light/unconfirmed.png b/electrum/gui/kivy/theming/light/unconfirmed.png similarity index 100% rename from gui/kivy/theming/light/unconfirmed.png rename to electrum/gui/kivy/theming/light/unconfirmed.png diff --git a/gui/kivy/theming/light/wallet.png b/electrum/gui/kivy/theming/light/wallet.png similarity index 100% rename from gui/kivy/theming/light/wallet.png rename to electrum/gui/kivy/theming/light/wallet.png diff --git a/gui/kivy/theming/light/wallets.png b/electrum/gui/kivy/theming/light/wallets.png similarity index 100% rename from gui/kivy/theming/light/wallets.png rename to electrum/gui/kivy/theming/light/wallets.png diff --git a/gui/kivy/theming/light/white_bg_round_top.png b/electrum/gui/kivy/theming/light/white_bg_round_top.png similarity index 100% rename from gui/kivy/theming/light/white_bg_round_top.png rename to electrum/gui/kivy/theming/light/white_bg_round_top.png diff --git a/gui/kivy/tools/bitcoin_intent.xml b/electrum/gui/kivy/tools/bitcoin_intent.xml similarity index 100% rename from gui/kivy/tools/bitcoin_intent.xml rename to electrum/gui/kivy/tools/bitcoin_intent.xml diff --git a/gui/kivy/tools/blacklist.txt b/electrum/gui/kivy/tools/blacklist.txt similarity index 100% rename from gui/kivy/tools/blacklist.txt rename to electrum/gui/kivy/tools/blacklist.txt diff --git a/gui/kivy/tools/buildozer.spec b/electrum/gui/kivy/tools/buildozer.spec similarity index 94% rename from gui/kivy/tools/buildozer.spec rename to electrum/gui/kivy/tools/buildozer.spec index 0940100ad..ceaba7779 100644 --- a/gui/kivy/tools/buildozer.spec +++ b/electrum/gui/kivy/tools/buildozer.spec @@ -19,13 +19,13 @@ source.include_exts = py,png,jpg,kv,atlas,ttf,txt,gif,pem,mo,vs,fs,json source.exclude_exts = spec # (list) List of directory to exclude (let empty to not exclude anything) -source.exclude_dirs = bin, build, dist, contrib, gui/qt, gui/kivy/tools, gui/kivy/theming/light +source.exclude_dirs = bin, build, dist, contrib, electrum/gui/qt, electrum/gui/kivy/tools, electrum/gui/kivy/theming/light # (list) List of exclusions using pattern matching source.exclude_patterns = Makefile,setup* # (str) Application versioning (method 1) version.regex = APK_VERSION = '(.*)' -version.filename = %(source.dir)s/lib/version.py +version.filename = %(source.dir)s/electrum/version.py # (str) Application versioning (method 2) #version = 1.9.8 @@ -87,7 +87,7 @@ android.ndk_path = /opt/crystax-ndk-10.3.2 # (list) List of Java files to add to the android project (can be java or a # directory containing the files) -android.add_src = gui/kivy/data/java-classes/ +android.add_src = electrum/gui/kivy/data/java-classes/ android.gradle_dependencies = me.dm7.barcodescanner:zxing:1.9.8 @@ -105,7 +105,7 @@ android.add_activities = org.electrum.qr.SimpleScannerActivity #android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png # (str) XML file to include as an intent filters in tag -android.manifest.intent_filters = gui/kivy/tools/bitcoin_intent.xml +android.manifest.intent_filters = electrum/gui/kivy/tools/bitcoin_intent.xml # (str) launchMode to set for the main activity android.manifest.launch_mode = singleTask diff --git a/gui/kivy/uix/__init__.py b/electrum/gui/kivy/uix/__init__.py similarity index 100% rename from gui/kivy/uix/__init__.py rename to electrum/gui/kivy/uix/__init__.py diff --git a/gui/kivy/uix/combobox.py b/electrum/gui/kivy/uix/combobox.py similarity index 100% rename from gui/kivy/uix/combobox.py rename to electrum/gui/kivy/uix/combobox.py diff --git a/gui/kivy/uix/context_menu.py b/electrum/gui/kivy/uix/context_menu.py similarity index 97% rename from gui/kivy/uix/context_menu.py rename to electrum/gui/kivy/uix/context_menu.py index 884a2098e..84d5ba647 100644 --- a/gui/kivy/uix/context_menu.py +++ b/electrum/gui/kivy/uix/context_menu.py @@ -8,7 +8,7 @@ from kivy.lang import Builder from kivy.factory import Factory from kivy.clock import Clock -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ Builder.load_string(''' diff --git a/gui/kivy/uix/dialogs/__init__.py b/electrum/gui/kivy/uix/dialogs/__init__.py similarity index 99% rename from gui/kivy/uix/dialogs/__init__.py rename to electrum/gui/kivy/uix/dialogs/__init__.py index b482d78ca..9f8f7f2e3 100644 --- a/gui/kivy/uix/dialogs/__init__.py +++ b/electrum/gui/kivy/uix/dialogs/__init__.py @@ -6,7 +6,7 @@ from kivy.core.window import Window from kivy.uix.recycleview import RecycleView from kivy.uix.boxlayout import BoxLayout -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ diff --git a/gui/kivy/uix/dialogs/addresses.py b/electrum/gui/kivy/uix/dialogs/addresses.py similarity index 98% rename from gui/kivy/uix/dialogs/addresses.py rename to electrum/gui/kivy/uix/dialogs/addresses.py index 241bfad15..5b90f2f7a 100644 --- a/gui/kivy/uix/dialogs/addresses.py +++ b/electrum/gui/kivy/uix/dialogs/addresses.py @@ -98,8 +98,8 @@ Builder.load_string(''' ''') -from electrum_gui.kivy.i18n import _ -from electrum_gui.kivy.uix.context_menu import ContextMenu +from electrum.gui.kivy.i18n import _ +from electrum.gui.kivy.uix.context_menu import ContextMenu class AddressesDialog(Factory.Popup): diff --git a/gui/kivy/uix/dialogs/amount_dialog.py b/electrum/gui/kivy/uix/dialogs/amount_dialog.py similarity index 100% rename from gui/kivy/uix/dialogs/amount_dialog.py rename to electrum/gui/kivy/uix/dialogs/amount_dialog.py diff --git a/gui/kivy/uix/dialogs/bump_fee_dialog.py b/electrum/gui/kivy/uix/dialogs/bump_fee_dialog.py similarity index 98% rename from gui/kivy/uix/dialogs/bump_fee_dialog.py rename to electrum/gui/kivy/uix/dialogs/bump_fee_dialog.py index de1c71a66..854be26bd 100644 --- a/gui/kivy/uix/dialogs/bump_fee_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/bump_fee_dialog.py @@ -3,7 +3,7 @@ from kivy.factory import Factory from kivy.properties import ObjectProperty from kivy.lang import Builder -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ Builder.load_string(''' diff --git a/gui/kivy/uix/dialogs/checkbox_dialog.py b/electrum/gui/kivy/uix/dialogs/checkbox_dialog.py similarity index 100% rename from gui/kivy/uix/dialogs/checkbox_dialog.py rename to electrum/gui/kivy/uix/dialogs/checkbox_dialog.py diff --git a/gui/kivy/uix/dialogs/choice_dialog.py b/electrum/gui/kivy/uix/dialogs/choice_dialog.py similarity index 100% rename from gui/kivy/uix/dialogs/choice_dialog.py rename to electrum/gui/kivy/uix/dialogs/choice_dialog.py diff --git a/gui/kivy/uix/dialogs/crash_reporter.py b/electrum/gui/kivy/uix/dialogs/crash_reporter.py similarity index 100% rename from gui/kivy/uix/dialogs/crash_reporter.py rename to electrum/gui/kivy/uix/dialogs/crash_reporter.py diff --git a/gui/kivy/uix/dialogs/fee_dialog.py b/electrum/gui/kivy/uix/dialogs/fee_dialog.py similarity index 99% rename from gui/kivy/uix/dialogs/fee_dialog.py rename to electrum/gui/kivy/uix/dialogs/fee_dialog.py index 9f344936a..7c6293973 100644 --- a/gui/kivy/uix/dialogs/fee_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/fee_dialog.py @@ -3,7 +3,7 @@ from kivy.factory import Factory from kivy.properties import ObjectProperty from kivy.lang import Builder -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ Builder.load_string(''' diff --git a/gui/kivy/uix/dialogs/fx_dialog.py b/electrum/gui/kivy/uix/dialogs/fx_dialog.py similarity index 98% rename from gui/kivy/uix/dialogs/fx_dialog.py rename to electrum/gui/kivy/uix/dialogs/fx_dialog.py index 35a34be95..fce858290 100644 --- a/gui/kivy/uix/dialogs/fx_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/fx_dialog.py @@ -66,7 +66,7 @@ from kivy.uix.checkbox import CheckBox from kivy.uix.widget import Widget from kivy.clock import Clock -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ from functools import partial class FxDialog(Factory.Popup): diff --git a/gui/kivy/uix/dialogs/installwizard.py b/electrum/gui/kivy/uix/dialogs/installwizard.py similarity index 98% rename from gui/kivy/uix/dialogs/installwizard.py rename to electrum/gui/kivy/uix/dialogs/installwizard.py index f01d861b9..d5b51e07a 100644 --- a/gui/kivy/uix/dialogs/installwizard.py +++ b/electrum/gui/kivy/uix/dialogs/installwizard.py @@ -31,7 +31,7 @@ test_xpub = "xpub661MyMwAqRbcEbvVtRRSjqxVnaWVUMewVzMiURAKyYratih4TtBpMypzzefmv8z Builder.load_string(''' #:import Window kivy.core.window.Window -#:import _ electrum_gui.kivy.i18n._ +#:import _ electrum.gui.kivy.i18n._ @@ -41,8 +41,8 @@ Builder.load_string(''' background_color: (1, 1, 1, 1) if self.focus else (0.454, 0.698, 0.909, 1) foreground_color: (0.31, 0.31, 0.31, 1) if self.focus else (0.835, 0.909, 0.972, 1) hint_text_color: self.foreground_color - background_active: 'atlas://gui/kivy/theming/light/create_act_text_active' - background_normal: 'atlas://gui/kivy/theming/light/create_act_text_active' + background_active: 'atlas://electrum/gui/kivy/theming/light/create_act_text_active' + background_normal: 'atlas://electrum/gui/kivy/theming/light/create_act_text_active' size_hint_y: None height: '48sp' @@ -91,7 +91,7 @@ Builder.load_string(''' size_hint: 1, None height: self.texture_size[1] if self.opacity else 0 font_size: '33sp' - font_name: 'gui/kivy/data/fonts/tron/Tr2n.ttf' + font_name: 'electrum/gui/kivy/data/fonts/tron/Tr2n.ttf' GridLayout: cols: 1 id: crcontent @@ -300,7 +300,7 @@ Builder.load_string(''' font_size: '18dp' text_size: self.width - dp(24), self.height - dp(12) color: .1, .1, .1, 1 - background_normal: 'atlas://gui/kivy/theming/light/white_bg_round_top' + background_normal: 'atlas://electrum/gui/kivy/theming/light/white_bg_round_top' background_down: self.background_normal size_hint_y: None @@ -446,7 +446,7 @@ Builder.load_string(''' id: scan height: '48sp' on_release: root.scan_xpub() - icon: 'atlas://gui/kivy/theming/light/camera' + icon: 'atlas://electrum/gui/kivy/theming/light/camera' size_hint: 1, None WizardButton: text: _('Paste') @@ -961,7 +961,7 @@ class InstallWizard(BaseWizard, Widget): app = App.get_running_app() app.show_info_bubble( - text=msg, icon='atlas://gui/kivy/theming/light/important', + text=msg, icon='atlas://electrum/gui/kivy/theming/light/important', pos=Window.center, width='200sp', arrow_pos=None, modal=True) t = threading.Thread(target = target) t.start() diff --git a/gui/kivy/uix/dialogs/invoices.py b/electrum/gui/kivy/uix/dialogs/invoices.py similarity index 91% rename from gui/kivy/uix/dialogs/invoices.py rename to electrum/gui/kivy/uix/dialogs/invoices.py index d8e4f884d..4fb986df1 100644 --- a/gui/kivy/uix/dialogs/invoices.py +++ b/electrum/gui/kivy/uix/dialogs/invoices.py @@ -17,7 +17,7 @@ Builder.load_string(''' amount: '' status: '' date: '' - icon: 'atlas://gui/kivy/theming/light/important' + icon: 'atlas://electrum/gui/kivy/theming/light/important' Image: id: icon source: root.icon @@ -76,10 +76,10 @@ Builder.load_string(''' ''') from kivy.properties import BooleanProperty -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ from electrum.util import format_time from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED -from electrum_gui.kivy.uix.context_menu import ContextMenu +from electrum.gui.kivy.uix.context_menu import ContextMenu invoice_text = { PR_UNPAID:_('Pending'), @@ -88,10 +88,10 @@ invoice_text = { PR_EXPIRED:_('Expired') } pr_icon = { - PR_UNPAID: 'atlas://gui/kivy/theming/light/important', - PR_UNKNOWN: 'atlas://gui/kivy/theming/light/important', - PR_PAID: 'atlas://gui/kivy/theming/light/confirmed', - PR_EXPIRED: 'atlas://gui/kivy/theming/light/close' + PR_UNPAID: 'atlas://electrum/gui/kivy/theming/light/important', + PR_UNKNOWN: 'atlas://electrum/gui/kivy/theming/light/important', + PR_PAID: 'atlas://electrum/gui/kivy/theming/light/confirmed', + PR_EXPIRED: 'atlas://electrum/gui/kivy/theming/light/close' } diff --git a/gui/kivy/uix/dialogs/label_dialog.py b/electrum/gui/kivy/uix/dialogs/label_dialog.py similarity index 89% rename from gui/kivy/uix/dialogs/label_dialog.py rename to electrum/gui/kivy/uix/dialogs/label_dialog.py index cf7aa2def..974cd0667 100644 --- a/gui/kivy/uix/dialogs/label_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/label_dialog.py @@ -21,8 +21,8 @@ Builder.load_string(''' pos_hint: {'center_y':.5} text:'' multiline: False - background_normal: 'atlas://gui/kivy/theming/light/tab_btn' - background_active: 'atlas://gui/kivy/theming/light/textinput_active' + background_normal: 'atlas://electrum/gui/kivy/theming/light/tab_btn' + background_active: 'atlas://electrum/gui/kivy/theming/light/textinput_active' hint_text_color: self.foreground_color foreground_color: 1, 1, 1, 1 font_size: '16dp' diff --git a/gui/kivy/uix/dialogs/nfc_transaction.py b/electrum/gui/kivy/uix/dialogs/nfc_transaction.py similarity index 90% rename from gui/kivy/uix/dialogs/nfc_transaction.py rename to electrum/gui/kivy/uix/dialogs/nfc_transaction.py index cb10315e9..f6dfd5792 100644 --- a/gui/kivy/uix/dialogs/nfc_transaction.py +++ b/electrum/gui/kivy/uix/dialogs/nfc_transaction.py @@ -8,7 +8,7 @@ class NFCTransactionDialog(AnimatedPopup): # Delayed Init global NFCSCanner if NFCSCanner is None: - from electrum_gui.kivy.nfc_scanner import NFCScanner + from electrum.gui.kivy.nfc_scanner import NFCScanner self.scanner = NFCSCanner super(NFCTransactionDialog, self).__init__(**kwargs) diff --git a/gui/kivy/uix/dialogs/password_dialog.py b/electrum/gui/kivy/uix/dialogs/password_dialog.py similarity index 99% rename from gui/kivy/uix/dialogs/password_dialog.py rename to electrum/gui/kivy/uix/dialogs/password_dialog.py index 670179928..665ab136e 100644 --- a/gui/kivy/uix/dialogs/password_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/password_dialog.py @@ -6,7 +6,7 @@ from decimal import Decimal from kivy.clock import Clock from electrum.util import InvalidPassword -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ Builder.load_string(''' diff --git a/gui/kivy/uix/dialogs/qr_dialog.py b/electrum/gui/kivy/uix/dialogs/qr_dialog.py similarity index 100% rename from gui/kivy/uix/dialogs/qr_dialog.py rename to electrum/gui/kivy/uix/dialogs/qr_dialog.py diff --git a/gui/kivy/uix/dialogs/qr_scanner.py b/electrum/gui/kivy/uix/dialogs/qr_scanner.py similarity index 88% rename from gui/kivy/uix/dialogs/qr_scanner.py rename to electrum/gui/kivy/uix/dialogs/qr_scanner.py index eeb6061e2..8a565f019 100644 --- a/gui/kivy/uix/dialogs/qr_scanner.py +++ b/electrum/gui/kivy/uix/dialogs/qr_scanner.py @@ -2,7 +2,7 @@ from kivy.app import App from kivy.factory import Factory from kivy.lang import Builder -Factory.register('QRScanner', module='electrum_gui.kivy.qr_scanner') +Factory.register('QRScanner', module='electrum.gui.kivy.qr_scanner') class QrScannerDialog(Factory.AnimatedPopup): @@ -33,7 +33,7 @@ Builder.load_string(''' #separator_color: .89, .89, .89, 1 #separator_height: '1.2dp' #title_color: .437, .437, .437, 1 - #background: 'atlas://gui/kivy/theming/light/dialog' + #background: 'atlas://electrum/gui/kivy/theming/light/dialog' on_activate: qrscr.start() qrscr.size = self.size diff --git a/gui/kivy/uix/dialogs/question.py b/electrum/gui/kivy/uix/dialogs/question.py similarity index 97% rename from gui/kivy/uix/dialogs/question.py rename to electrum/gui/kivy/uix/dialogs/question.py index 3b5b36be6..4b5e085fa 100644 --- a/gui/kivy/uix/dialogs/question.py +++ b/electrum/gui/kivy/uix/dialogs/question.py @@ -6,7 +6,7 @@ from kivy.uix.checkbox import CheckBox from kivy.uix.label import Label from kivy.uix.widget import Widget -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ Builder.load_string(''' diff --git a/gui/kivy/uix/dialogs/requests.py b/electrum/gui/kivy/uix/dialogs/requests.py similarity index 90% rename from gui/kivy/uix/dialogs/requests.py rename to electrum/gui/kivy/uix/dialogs/requests.py index 266a40436..5aadae0d0 100644 --- a/gui/kivy/uix/dialogs/requests.py +++ b/electrum/gui/kivy/uix/dialogs/requests.py @@ -17,7 +17,7 @@ Builder.load_string(''' amount: '' status: '' date: '' - icon: 'atlas://gui/kivy/theming/light/important' + icon: 'atlas://electrum/gui/kivy/theming/light/important' Image: id: icon source: root.icon @@ -74,16 +74,16 @@ Builder.load_string(''' ''') from kivy.properties import BooleanProperty -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ from electrum.util import format_time from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED -from electrum_gui.kivy.uix.context_menu import ContextMenu +from electrum.gui.kivy.uix.context_menu import ContextMenu pr_icon = { - PR_UNPAID: 'atlas://gui/kivy/theming/light/important', - PR_UNKNOWN: 'atlas://gui/kivy/theming/light/important', - PR_PAID: 'atlas://gui/kivy/theming/light/confirmed', - PR_EXPIRED: 'atlas://gui/kivy/theming/light/close' + PR_UNPAID: 'atlas://electrum/gui/kivy/theming/light/important', + PR_UNKNOWN: 'atlas://electrum/gui/kivy/theming/light/important', + PR_PAID: 'atlas://electrum/gui/kivy/theming/light/confirmed', + PR_EXPIRED: 'atlas://electrum/gui/kivy/theming/light/close' } request_text = { PR_UNPAID: _('Pending'), diff --git a/gui/kivy/uix/dialogs/seed_options.py b/electrum/gui/kivy/uix/dialogs/seed_options.py similarity index 100% rename from gui/kivy/uix/dialogs/seed_options.py rename to electrum/gui/kivy/uix/dialogs/seed_options.py diff --git a/gui/kivy/uix/dialogs/settings.py b/electrum/gui/kivy/uix/dialogs/settings.py similarity index 97% rename from gui/kivy/uix/dialogs/settings.py rename to electrum/gui/kivy/uix/dialogs/settings.py index 94b5754f5..4e63c4a50 100644 --- a/gui/kivy/uix/dialogs/settings.py +++ b/electrum/gui/kivy/uix/dialogs/settings.py @@ -5,15 +5,15 @@ from kivy.lang import Builder from electrum.util import base_units_list from electrum.i18n import languages -from electrum_gui.kivy.i18n import _ -from electrum.plugins import run_hook +from electrum.gui.kivy.i18n import _ +from electrum.plugin import run_hook from electrum import coinchooser from .choice_dialog import ChoiceDialog Builder.load_string(''' #:import partial functools.partial -#:import _ electrum_gui.kivy.i18n._ +#:import _ electrum.gui.kivy.i18n._ id: settings @@ -173,7 +173,7 @@ class SettingsDialog(Factory.Popup): proxy = None self.app.network.set_parameters(server, port, protocol, proxy, auto_connect) item.status = self.proxy_status() - popup = Builder.load_file('gui/kivy/uix/ui_screens/proxy.kv') + popup = Builder.load_file('electrum/gui/kivy/uix/ui_screens/proxy.kv') popup.ids.mode.text = proxy.get('mode') if proxy else 'None' popup.ids.host.text = proxy.get('host') if proxy else '' popup.ids.port.text = proxy.get('port') if proxy else '' diff --git a/gui/kivy/uix/dialogs/tx_dialog.py b/electrum/gui/kivy/uix/dialogs/tx_dialog.py similarity index 98% rename from gui/kivy/uix/dialogs/tx_dialog.py rename to electrum/gui/kivy/uix/dialogs/tx_dialog.py index 1fdd61848..5a179fe02 100644 --- a/gui/kivy/uix/dialogs/tx_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/tx_dialog.py @@ -5,7 +5,7 @@ from kivy.lang import Builder from kivy.clock import Clock from kivy.uix.label import Label -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ from datetime import datetime from electrum.util import InvalidPassword @@ -85,7 +85,7 @@ Builder.load_string(''' IconButton: size_hint: 0.5, None height: '48dp' - icon: 'atlas://gui/kivy/theming/light/qrcode' + icon: 'atlas://electrum/gui/kivy/theming/light/qrcode' on_release: root.show_qr() Button: size_hint: 0.5, None diff --git a/gui/kivy/uix/dialogs/wallets.py b/electrum/gui/kivy/uix/dialogs/wallets.py similarity index 100% rename from gui/kivy/uix/dialogs/wallets.py rename to electrum/gui/kivy/uix/dialogs/wallets.py diff --git a/gui/kivy/uix/drawer.py b/electrum/gui/kivy/uix/drawer.py similarity index 100% rename from gui/kivy/uix/drawer.py rename to electrum/gui/kivy/uix/drawer.py diff --git a/gui/kivy/uix/gridview.py b/electrum/gui/kivy/uix/gridview.py similarity index 100% rename from gui/kivy/uix/gridview.py rename to electrum/gui/kivy/uix/gridview.py diff --git a/gui/kivy/uix/menus.py b/electrum/gui/kivy/uix/menus.py similarity index 98% rename from gui/kivy/uix/menus.py rename to electrum/gui/kivy/uix/menus.py index 17490054e..a7cdaefe2 100644 --- a/gui/kivy/uix/menus.py +++ b/electrum/gui/kivy/uix/menus.py @@ -7,7 +7,7 @@ from kivy.uix.bubble import Bubble, BubbleButton from kivy.properties import ListProperty from kivy.uix.widget import Widget -from electrum_gui.kivy.i18n import _ +from ..i18n import _ class ContextMenuItem(Widget): '''abstract class diff --git a/gui/kivy/uix/qrcodewidget.py b/electrum/gui/kivy/uix/qrcodewidget.py similarity index 100% rename from gui/kivy/uix/qrcodewidget.py rename to electrum/gui/kivy/uix/qrcodewidget.py diff --git a/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py similarity index 98% rename from gui/kivy/uix/screens.py rename to electrum/gui/kivy/uix/screens.py index 49e7b2d47..948079136 100644 --- a/gui/kivy/uix/screens.py +++ b/electrum/gui/kivy/uix/screens.py @@ -22,12 +22,12 @@ from electrum.util import profiler, parse_URI, format_time, InvalidPassword, Not from electrum import bitcoin from electrum.util import timestamp_to_datetime from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED -from electrum.plugins import run_hook +from electrum.plugin import run_hook from .context_menu import ContextMenu -from electrum_gui.kivy.i18n import _ +from electrum.gui.kivy.i18n import _ class HistoryRecycleView(RecycleView): pass @@ -61,7 +61,7 @@ class CScreen(Factory.Screen): @profiler def load_screen(self): - self.screen = Builder.load_file('gui/kivy/uix/ui_screens/' + self.kvname + '.kv') + self.screen = Builder.load_file('electrum/gui/kivy/uix/ui_screens/' + self.kvname + '.kv') self.add_widget(self.screen) self.loaded = True self.update() @@ -133,7 +133,7 @@ class HistoryScreen(CScreen): def get_card(self, tx_hash, height, conf, timestamp, value, balance): status, status_str = self.app.wallet.get_tx_status(tx_hash, height, conf, timestamp) - icon = "atlas://gui/kivy/theming/light/" + TX_ICONS[status] + icon = "atlas://electrum/gui/kivy/theming/light/" + TX_ICONS[status] label = self.app.wallet.get_label(tx_hash) if tx_hash else _('Pruned transaction outputs') ri = {} ri['screen'] = self diff --git a/gui/kivy/uix/ui_screens/about.kv b/electrum/gui/kivy/uix/ui_screens/about.kv similarity index 100% rename from gui/kivy/uix/ui_screens/about.kv rename to electrum/gui/kivy/uix/ui_screens/about.kv diff --git a/gui/kivy/uix/ui_screens/history.kv b/electrum/gui/kivy/uix/ui_screens/history.kv similarity index 92% rename from gui/kivy/uix/ui_screens/history.kv rename to electrum/gui/kivy/uix/ui_screens/history.kv index 4a0eacac7..04988a70f 100644 --- a/gui/kivy/uix/ui_screens/history.kv +++ b/electrum/gui/kivy/uix/ui_screens/history.kv @@ -1,6 +1,6 @@ -#:import _ electrum_gui.kivy.i18n._ +#:import _ electrum.gui.kivy.i18n._ #:import Factory kivy.factory.Factory -#:set font_light 'gui/kivy/data/fonts/Roboto-Condensed.ttf' +#:set font_light 'electrum/gui/kivy/data/fonts/Roboto-Condensed.ttf' #:set btc_symbol chr(171) #:set mbtc_symbol chr(187) @@ -17,7 +17,7 @@ - icon: 'atlas://gui/kivy/theming/light/important' + icon: 'atlas://electrum/gui/kivy/theming/light/important' message: '' is_mine: True amount: '--' diff --git a/gui/kivy/uix/ui_screens/invoice.kv b/electrum/gui/kivy/uix/ui_screens/invoice.kv similarity index 100% rename from gui/kivy/uix/ui_screens/invoice.kv rename to electrum/gui/kivy/uix/ui_screens/invoice.kv diff --git a/gui/kivy/uix/ui_screens/network.kv b/electrum/gui/kivy/uix/ui_screens/network.kv similarity index 100% rename from gui/kivy/uix/ui_screens/network.kv rename to electrum/gui/kivy/uix/ui_screens/network.kv diff --git a/gui/kivy/uix/ui_screens/proxy.kv b/electrum/gui/kivy/uix/ui_screens/proxy.kv similarity index 100% rename from gui/kivy/uix/ui_screens/proxy.kv rename to electrum/gui/kivy/uix/ui_screens/proxy.kv diff --git a/gui/kivy/uix/ui_screens/receive.kv b/electrum/gui/kivy/uix/ui_screens/receive.kv similarity index 90% rename from gui/kivy/uix/ui_screens/receive.kv rename to electrum/gui/kivy/uix/ui_screens/receive.kv index 650be40ff..574e16c00 100644 --- a/gui/kivy/uix/ui_screens/receive.kv +++ b/electrum/gui/kivy/uix/ui_screens/receive.kv @@ -1,8 +1,8 @@ -#:import _ electrum_gui.kivy.i18n._ +#:import _ electrum.gui.kivy.i18n._ #:import Decimal decimal.Decimal #:set btc_symbol chr(171) #:set mbtc_symbol chr(187) -#:set font_light 'gui/kivy/data/fonts/Roboto-Condensed.ttf' +#:set font_light 'electrum/gui/kivy/data/fonts/Roboto-Condensed.ttf' @@ -62,7 +62,7 @@ ReceiveScreen: height: blue_bottom.item_height spacing: '5dp' Image: - source: 'atlas://gui/kivy/theming/light/globe' + source: 'atlas://electrum/gui/kivy/theming/light/globe' size_hint: None, None size: '22dp', '22dp' pos_hint: {'center_y': .5} @@ -79,7 +79,7 @@ ReceiveScreen: height: blue_bottom.item_height spacing: '5dp' Image: - source: 'atlas://gui/kivy/theming/light/calculator' + source: 'atlas://electrum/gui/kivy/theming/light/calculator' opacity: 0.7 size_hint: None, None size: '22dp', '22dp' @@ -99,7 +99,7 @@ ReceiveScreen: height: blue_bottom.item_height spacing: '5dp' Image: - source: 'atlas://gui/kivy/theming/light/pen' + source: 'atlas://electrum/gui/kivy/theming/light/pen' size_hint: None, None size: '22dp', '22dp' pos_hint: {'center_y': .5} @@ -111,7 +111,7 @@ ReceiveScreen: size_hint: 1, None height: '48dp' IconButton: - icon: 'atlas://gui/kivy/theming/light/save' + icon: 'atlas://electrum/gui/kivy/theming/light/save' size_hint: 0.6, None height: '48dp' on_release: s.parent.do_save() @@ -126,7 +126,7 @@ ReceiveScreen: height: '48dp' on_release: s.parent.do_copy() IconButton: - icon: 'atlas://gui/kivy/theming/light/share' + icon: 'atlas://electrum/gui/kivy/theming/light/share' size_hint: 0.6, None height: '48dp' on_release: s.parent.do_share() diff --git a/gui/kivy/uix/ui_screens/send.kv b/electrum/gui/kivy/uix/ui_screens/send.kv similarity index 88% rename from gui/kivy/uix/ui_screens/send.kv rename to electrum/gui/kivy/uix/ui_screens/send.kv index 7269cb9b6..88cbcc3a9 100644 --- a/gui/kivy/uix/ui_screens/send.kv +++ b/electrum/gui/kivy/uix/ui_screens/send.kv @@ -1,8 +1,8 @@ -#:import _ electrum_gui.kivy.i18n._ +#:import _ electrum.gui.kivy.i18n._ #:import Decimal decimal.Decimal #:set btc_symbol chr(171) #:set mbtc_symbol chr(187) -#:set font_light 'gui/kivy/data/fonts/Roboto-Condensed.ttf' +#:set font_light 'electrum/gui/kivy/data/fonts/Roboto-Condensed.ttf' SendScreen: @@ -25,7 +25,7 @@ SendScreen: height: blue_bottom.item_height spacing: '5dp' Image: - source: 'atlas://gui/kivy/theming/light/globe' + source: 'atlas://electrum/gui/kivy/theming/light/globe' size_hint: None, None size: '22dp', '22dp' pos_hint: {'center_y': .5} @@ -43,7 +43,7 @@ SendScreen: height: blue_bottom.item_height spacing: '5dp' Image: - source: 'atlas://gui/kivy/theming/light/calculator' + source: 'atlas://electrum/gui/kivy/theming/light/calculator' opacity: 0.7 size_hint: None, None size: '22dp', '22dp' @@ -63,7 +63,7 @@ SendScreen: height: blue_bottom.item_height spacing: '5dp' Image: - source: 'atlas://gui/kivy/theming/light/pen' + source: 'atlas://electrum/gui/kivy/theming/light/pen' size_hint: None, None size: '22dp', '22dp' pos_hint: {'center_y': .5} @@ -80,7 +80,7 @@ SendScreen: height: blue_bottom.item_height spacing: '5dp' Image: - source: 'atlas://gui/kivy/theming/light/star_big_inactive' + source: 'atlas://electrum/gui/kivy/theming/light/star_big_inactive' opacity: 0.7 size_hint: None, None size: '22dp', '22dp' @@ -96,7 +96,7 @@ SendScreen: IconButton: size_hint: 0.6, 1 on_release: s.parent.do_save() - icon: 'atlas://gui/kivy/theming/light/save' + icon: 'atlas://electrum/gui/kivy/theming/light/save' Button: text: _('Invoices') size_hint: 1, 1 @@ -108,7 +108,7 @@ SendScreen: id: qr size_hint: 0.6, 1 on_release: Clock.schedule_once(lambda dt: app.scan_qr(on_complete=app.on_qr)) - icon: 'atlas://gui/kivy/theming/light/camera' + icon: 'atlas://electrum/gui/kivy/theming/light/camera' BoxLayout: size_hint: 1, None height: '48dp' diff --git a/gui/kivy/uix/ui_screens/server.kv b/electrum/gui/kivy/uix/ui_screens/server.kv similarity index 100% rename from gui/kivy/uix/ui_screens/server.kv rename to electrum/gui/kivy/uix/ui_screens/server.kv diff --git a/gui/kivy/uix/ui_screens/status.kv b/electrum/gui/kivy/uix/ui_screens/status.kv similarity index 100% rename from gui/kivy/uix/ui_screens/status.kv rename to electrum/gui/kivy/uix/ui_screens/status.kv diff --git a/gui/qt/__init__.py b/electrum/gui/qt/__init__.py similarity index 98% rename from gui/qt/__init__.py rename to electrum/gui/qt/__init__.py index a2c216cdf..7fa7f4e5e 100644 --- a/gui/qt/__init__.py +++ b/electrum/gui/qt/__init__.py @@ -39,8 +39,8 @@ from PyQt5.QtCore import * import PyQt5.QtCore as QtCore from electrum.i18n import _, set_language -from electrum.plugins import run_hook -from electrum import WalletStorage +from electrum.plugin import run_hook +from electrum.storage import WalletStorage from electrum.base_wizard import GoBack # from electrum.synchronizer import Synchronizer # from electrum.verifier import SPV @@ -57,7 +57,7 @@ try: except Exception as e: print(e) print("Error: Could not find icons file.") - print("Please run 'pyrcc5 icons.qrc -o gui/qt/icons_rc.py', and reinstall Electrum") + print("Please run 'pyrcc5 icons.qrc -o electrum/gui/qt/icons_rc.py'") sys.exit(1) from .util import * # * needed for plugins diff --git a/gui/qt/address_dialog.py b/electrum/gui/qt/address_dialog.py similarity index 100% rename from gui/qt/address_dialog.py rename to electrum/gui/qt/address_dialog.py diff --git a/gui/qt/address_list.py b/electrum/gui/qt/address_list.py similarity index 99% rename from gui/qt/address_list.py rename to electrum/gui/qt/address_list.py index 3e1e0a68c..7217940f6 100644 --- a/gui/qt/address_list.py +++ b/electrum/gui/qt/address_list.py @@ -26,7 +26,7 @@ import webbrowser from electrum.i18n import _ from electrum.util import block_explorer_URL -from electrum.plugins import run_hook +from electrum.plugin import run_hook from electrum.bitcoin import is_address from .util import * diff --git a/gui/qt/amountedit.py b/electrum/gui/qt/amountedit.py similarity index 100% rename from gui/qt/amountedit.py rename to electrum/gui/qt/amountedit.py diff --git a/gui/qt/completion_text_edit.py b/electrum/gui/qt/completion_text_edit.py similarity index 99% rename from gui/qt/completion_text_edit.py rename to electrum/gui/qt/completion_text_edit.py index a131712e6..4709b03d8 100644 --- a/gui/qt/completion_text_edit.py +++ b/electrum/gui/qt/completion_text_edit.py @@ -117,4 +117,4 @@ if __name__ == "__main__": te = CompletionTextEdit() te.set_completer(completer) te.show() - app.exec_() \ No newline at end of file + app.exec_() diff --git a/gui/qt/console.py b/electrum/gui/qt/console.py similarity index 100% rename from gui/qt/console.py rename to electrum/gui/qt/console.py diff --git a/gui/qt/contact_list.py b/electrum/gui/qt/contact_list.py similarity index 99% rename from gui/qt/contact_list.py rename to electrum/gui/qt/contact_list.py index 27c9efb59..b13ee9ecb 100644 --- a/gui/qt/contact_list.py +++ b/electrum/gui/qt/contact_list.py @@ -27,7 +27,7 @@ import webbrowser from electrum.i18n import _ from electrum.bitcoin import is_address from electrum.util import block_explorer_URL -from electrum.plugins import run_hook +from electrum.plugin import run_hook from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import ( diff --git a/gui/qt/exception_window.py b/electrum/gui/qt/exception_window.py similarity index 100% rename from gui/qt/exception_window.py rename to electrum/gui/qt/exception_window.py diff --git a/gui/qt/fee_slider.py b/electrum/gui/qt/fee_slider.py similarity index 100% rename from gui/qt/fee_slider.py rename to electrum/gui/qt/fee_slider.py diff --git a/gui/qt/history_list.py b/electrum/gui/qt/history_list.py similarity index 99% rename from gui/qt/history_list.py rename to electrum/gui/qt/history_list.py index ce5b97a16..83ab3fdb0 100644 --- a/gui/qt/history_list.py +++ b/electrum/gui/qt/history_list.py @@ -29,11 +29,12 @@ import datetime from electrum.wallet import AddTransactionException, TX_HEIGHT_LOCAL from .util import * from electrum.i18n import _ -from electrum.util import block_explorer_URL, profiler +from electrum.util import block_explorer_URL, profiler, print_error try: from electrum.plot import plot_history, NothingToPlotException except: + print_error("qt/history_list: could not import electrum.plot. This feature needs matplotlib to be installed.") plot_history = None # note: this list needs to be kept in sync with another in kivy diff --git a/gui/qt/installwizard.py b/electrum/gui/qt/installwizard.py similarity index 99% rename from gui/qt/installwizard.py rename to electrum/gui/qt/installwizard.py index 052b60390..79647235a 100644 --- a/gui/qt/installwizard.py +++ b/electrum/gui/qt/installwizard.py @@ -8,7 +8,8 @@ from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * -from electrum import Wallet, WalletStorage +from electrum.wallet import Wallet +from electrum.storage import WalletStorage from electrum.util import UserCancelled, InvalidPassword from electrum.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALLET, GoBack from electrum.i18n import _ diff --git a/gui/qt/invoice_list.py b/electrum/gui/qt/invoice_list.py similarity index 100% rename from gui/qt/invoice_list.py rename to electrum/gui/qt/invoice_list.py diff --git a/gui/qt/main_window.py b/electrum/gui/qt/main_window.py similarity index 99% rename from gui/qt/main_window.py rename to electrum/gui/qt/main_window.py index 7b0ae6337..ac2c52825 100644 --- a/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -39,10 +39,10 @@ import PyQt5.QtCore as QtCore from .exception_window import Exception_Hook from PyQt5.QtWidgets import * -from electrum import keystore, simple_config, ecc +from electrum import (keystore, simple_config, ecc, constants, util, bitcoin, commands, + coinchooser, paymentrequest) from electrum.bitcoin import COIN, is_address, TYPE_ADDRESS -from electrum import constants -from electrum.plugins import run_hook +from electrum.plugin import run_hook from electrum.i18n import _ from electrum.util import (format_time, format_satoshis, format_fee_satoshis, format_satoshis_plain, NotEnoughFunds, PrintError, @@ -50,9 +50,7 @@ from electrum.util import (format_time, format_satoshis, format_fee_satoshis, export_meta, import_meta, bh2u, bfh, InvalidPassword, base_units, base_units_list, base_unit_name_to_decimal_point, decimal_point_to_base_unit_name, quantize_feerate) -from electrum import Transaction -from electrum import util, bitcoin, commands, coinchooser -from electrum import paymentrequest +from electrum.transaction import Transaction from electrum.wallet import Multisig_Wallet, AddTransactionException, CannotBumpFee from .amountedit import AmountEdit, BTCAmountEdit, MyLineEdit, FeerateEdit @@ -3081,7 +3079,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): run_hook('init_qt', self.gui_object) for i, descr in enumerate(plugins.descriptions.values()): - name = descr['__name__'] + full_name = descr['__name__'] + prefix, _separator, name = full_name.rpartition('.') p = plugins.get(name) if descr.get('registers_keystore'): continue diff --git a/gui/qt/network_dialog.py b/electrum/gui/qt/network_dialog.py similarity index 100% rename from gui/qt/network_dialog.py rename to electrum/gui/qt/network_dialog.py diff --git a/gui/qt/password_dialog.py b/electrum/gui/qt/password_dialog.py similarity index 99% rename from gui/qt/password_dialog.py rename to electrum/gui/qt/password_dialog.py index 568832056..ecaf781c9 100644 --- a/gui/qt/password_dialog.py +++ b/electrum/gui/qt/password_dialog.py @@ -31,7 +31,7 @@ from .util import * import re import math -from electrum.plugins import run_hook +from electrum.plugin import run_hook def check_password_strength(password): diff --git a/gui/qt/paytoedit.py b/electrum/gui/qt/paytoedit.py similarity index 100% rename from gui/qt/paytoedit.py rename to electrum/gui/qt/paytoedit.py diff --git a/gui/qt/qrcodewidget.py b/electrum/gui/qt/qrcodewidget.py similarity index 100% rename from gui/qt/qrcodewidget.py rename to electrum/gui/qt/qrcodewidget.py diff --git a/gui/qt/qrtextedit.py b/electrum/gui/qt/qrtextedit.py similarity index 98% rename from gui/qt/qrtextedit.py rename to electrum/gui/qt/qrtextedit.py index cc5c5cf0e..6f3d1e057 100644 --- a/gui/qt/qrtextedit.py +++ b/electrum/gui/qt/qrtextedit.py @@ -1,6 +1,6 @@ from electrum.i18n import _ -from electrum.plugins import run_hook +from electrum.plugin import run_hook from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import QFileDialog diff --git a/gui/qt/qrwindow.py b/electrum/gui/qt/qrwindow.py similarity index 98% rename from gui/qt/qrwindow.py rename to electrum/gui/qt/qrwindow.py index 163c462cc..9abcc26f9 100644 --- a/gui/qt/qrwindow.py +++ b/electrum/gui/qt/qrwindow.py @@ -29,7 +29,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import * from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QLabel, QWidget -from electrum_gui.qt.qrcodewidget import QRCodeWidget +from .qrcodewidget import QRCodeWidget from electrum.i18n import _ if platform.system() == 'Windows': diff --git a/gui/qt/request_list.py b/electrum/gui/qt/request_list.py similarity index 99% rename from gui/qt/request_list.py rename to electrum/gui/qt/request_list.py index e1d28476c..7b55c5d8e 100644 --- a/gui/qt/request_list.py +++ b/electrum/gui/qt/request_list.py @@ -25,7 +25,7 @@ from electrum.i18n import _ from electrum.util import format_time, age -from electrum.plugins import run_hook +from electrum.plugin import run_hook from electrum.paymentrequest import PR_UNKNOWN from PyQt5.QtGui import * from PyQt5.QtCore import * diff --git a/gui/qt/seed_dialog.py b/electrum/gui/qt/seed_dialog.py similarity index 99% rename from gui/qt/seed_dialog.py rename to electrum/gui/qt/seed_dialog.py index 397889ec5..1006dfd90 100644 --- a/gui/qt/seed_dialog.py +++ b/electrum/gui/qt/seed_dialog.py @@ -26,7 +26,7 @@ from electrum.i18n import _ from electrum.mnemonic import Mnemonic import electrum.old_mnemonic -from electrum.plugins import run_hook +from electrum.plugin import run_hook from .util import * diff --git a/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py similarity index 99% rename from gui/qt/transaction_dialog.py rename to electrum/gui/qt/transaction_dialog.py index 4590c2688..fe7624dad 100644 --- a/gui/qt/transaction_dialog.py +++ b/electrum/gui/qt/transaction_dialog.py @@ -33,7 +33,7 @@ from PyQt5.QtWidgets import * from electrum.bitcoin import base_encode from electrum.i18n import _ -from electrum.plugins import run_hook +from electrum.plugin import run_hook from electrum import simple_config from electrum.util import bfh diff --git a/gui/qt/util.py b/electrum/gui/qt/util.py similarity index 100% rename from gui/qt/util.py rename to electrum/gui/qt/util.py diff --git a/gui/qt/utxo_list.py b/electrum/gui/qt/utxo_list.py similarity index 100% rename from gui/qt/utxo_list.py rename to electrum/gui/qt/utxo_list.py diff --git a/gui/stdio.py b/electrum/gui/stdio.py similarity index 100% rename from gui/stdio.py rename to electrum/gui/stdio.py diff --git a/gui/text.py b/electrum/gui/text.py similarity index 99% rename from gui/text.py rename to electrum/gui/text.py index b616f8734..ee051563a 100644 --- a/gui/text.py +++ b/electrum/gui/text.py @@ -6,7 +6,7 @@ import getpass import electrum from electrum.util import format_satoshis, set_verbosity from electrum.bitcoin import is_address, COIN, TYPE_ADDRESS -from electrum import Wallet, WalletStorage +from .. import Wallet, WalletStorage _ = lambda x:x diff --git a/lib/i18n.py b/electrum/i18n.py similarity index 100% rename from lib/i18n.py rename to electrum/i18n.py diff --git a/lib/interface.py b/electrum/interface.py similarity index 100% rename from lib/interface.py rename to electrum/interface.py diff --git a/lib/jsonrpc.py b/electrum/jsonrpc.py similarity index 100% rename from lib/jsonrpc.py rename to electrum/jsonrpc.py diff --git a/lib/keystore.py b/electrum/keystore.py similarity index 99% rename from lib/keystore.py rename to electrum/keystore.py index 098dd3f9b..a8e068bbf 100644 --- a/lib/keystore.py +++ b/electrum/keystore.py @@ -26,15 +26,14 @@ from unicodedata import normalize -from . import bitcoin, ecc +from . import bitcoin, ecc, constants from .bitcoin import * from .ecc import string_to_number, number_to_string from .crypto import pw_decode, pw_encode -from . import constants from .util import (PrintError, InvalidPassword, hfu, WalletFileException, BitcoinException) from .mnemonic import Mnemonic, load_wordlist -from .plugins import run_hook +from .plugin import run_hook class KeyStore(PrintError): @@ -666,7 +665,7 @@ def hardware_keystore(d): if hw_type in hw_keystores: constructor = hw_keystores[hw_type] return constructor(d) - raise WalletFileException('unknown hardware type: {}'.format(hw_type)) + raise WalletFileException('unknown hardware type: {}. hw_keystores: {}'.format(hw_type, list(hw_keystores.keys()))) def load_keystore(storage, name): d = storage.get(name, {}) diff --git a/lib/mnemonic.py b/electrum/mnemonic.py similarity index 100% rename from lib/mnemonic.py rename to electrum/mnemonic.py diff --git a/lib/msqr.py b/electrum/msqr.py similarity index 100% rename from lib/msqr.py rename to electrum/msqr.py diff --git a/lib/network.py b/electrum/network.py similarity index 98% rename from lib/network.py rename to electrum/network.py index fe6c68475..b836fbc7d 100644 --- a/lib/network.py +++ b/electrum/network.py @@ -47,6 +47,7 @@ from .interface import Connection, Interface from . import blockchain from .version import ELECTRUM_VERSION, PROTOCOL_VERSION from .i18n import _ +from .blockchain import InvalidHeader NODES_RETRY_INTERVAL = 60 @@ -78,6 +79,7 @@ def parse_servers(result): servers[host] = out return servers + def filter_version(servers): def is_recent(version): try: @@ -87,7 +89,7 @@ def filter_version(servers): return {k: v for k, v in servers.items() if is_recent(v.get('version'))} -def filter_protocol(hostmap, protocol = 's'): +def filter_protocol(hostmap, protocol='s'): '''Filters the hostmap for those implementing protocol. The result is a list in serialized form.''' eligible = [] @@ -97,12 +99,14 @@ def filter_protocol(hostmap, protocol = 's'): eligible.append(serialize_server(host, port, protocol)) return eligible + def pick_random_server(hostmap = None, protocol = 's', exclude_set = set()): if hostmap is None: hostmap = constants.net.DEFAULT_SERVERS eligible = list(set(filter_protocol(hostmap, protocol)) - exclude_set) return random.choice(eligible) if eligible else None + from .simple_config import SimpleConfig proxy_modes = ['socks4', 'socks5', 'http'] @@ -201,7 +205,7 @@ class Network(util.DaemonThread): self.pending_sends = [] self.message_id = 0 self.debug = False - self.irc_servers = {} # returned by interface (list from irc) + self.irc_servers = {} # returned by interface (list from irc) self.recent_servers = self.read_recent_servers() # note: needs self.recent_servers_lock self.banner = '' @@ -213,7 +217,7 @@ class Network(util.DaemonThread): # callbacks set by the GUI self.callbacks = defaultdict(list) # note: needs self.callback_lock - dir_path = os.path.join( self.config.path, 'certs') + dir_path = os.path.join(self.config.path, 'certs') util.make_dir(dir_path) # subscriptions and requests @@ -312,9 +316,6 @@ class Network(util.DaemonThread): def is_connecting(self): return self.connection_status == 'connecting' - def is_up_to_date(self): - return self.unanswered_requests == {} - @with_interface_lock def queue_request(self, method, params, interface=None): # If you want to queue a request on any interface it must go @@ -406,7 +407,7 @@ class Network(util.DaemonThread): except: continue if host not in out: - out[host] = { protocol:port } + out[host] = {protocol: port} return out @with_interface_lock @@ -416,7 +417,7 @@ class Network(util.DaemonThread): self.print_error("connecting to %s as new interface" % server) self.set_status('connecting') self.connecting.add(server) - c = Connection(server, self.socket_queue, self.config.path) + Connection(server, self.socket_queue, self.config.path) def start_random_interface(self): with self.interface_lock: @@ -529,9 +530,10 @@ class Network(util.DaemonThread): self.auto_connect = auto_connect if self.proxy != proxy or self.protocol != protocol: # Restart the network defaulting to the given server - self.stop_network() - self.default_server = server - self.start_network(protocol, proxy) + with self.interface_lock: + self.stop_network() + self.default_server = server + self.start_network(protocol, proxy) elif self.default_server != server: self.switch_to_interface(server) else: @@ -552,7 +554,7 @@ class Network(util.DaemonThread): if self.server_is_lagging() and self.auto_connect: # switch to one that has the correct header (not height) header = self.blockchain().read_header(self.get_local_height()) - filtered = list(map(lambda x:x[0], filter(lambda x: x[1].tip_header==header, self.interfaces.items()))) + filtered = list(map(lambda x: x[0], filter(lambda x: x[1].tip_header == header, self.interfaces.items()))) if filtered: choice = random.choice(filtered) self.switch_to_interface(choice) @@ -568,6 +570,7 @@ class Network(util.DaemonThread): self.interface = None self.start_interface(server) return + i = self.interfaces[server] if self.interface != i: self.print_error("switching to", server) @@ -600,7 +603,7 @@ class Network(util.DaemonThread): def process_response(self, interface, response, callbacks): if self.debug: - self.print_error("<--", response) + self.print_error(interface.host, "<--", response) error = response.get('error') result = response.get('result') method = response.get('method') @@ -797,6 +800,7 @@ class Network(util.DaemonThread): server, socket = self.socket_queue.get() if server in self.connecting: self.connecting.remove(server) + if socket: self.new_interface(server, socket) else: @@ -1007,6 +1011,7 @@ class Network(util.DaemonThread): interface.mode = 'default' interface.request = None self.notify('updated') + # refresh network dialog self.notify('interfaces') @@ -1071,7 +1076,11 @@ class Network(util.DaemonThread): # no point in keeping this connection without headers sub self.connection_down(interface.server) return - header = blockchain.deserialize_header(util.bfh(header_hex), height) + try: + header = blockchain.deserialize_header(util.bfh(header_hex), height) + except InvalidHeader: + self.connection_down(interface.server) + return if height < self.max_checkpoint(): self.connection_down(interface.server) return diff --git a/lib/old_mnemonic.py b/electrum/old_mnemonic.py similarity index 100% rename from lib/old_mnemonic.py rename to electrum/old_mnemonic.py diff --git a/lib/paymentrequest.proto b/electrum/paymentrequest.proto similarity index 100% rename from lib/paymentrequest.proto rename to electrum/paymentrequest.proto diff --git a/lib/paymentrequest.py b/electrum/paymentrequest.py similarity index 98% rename from lib/paymentrequest.py rename to electrum/paymentrequest.py index 528bb7e6e..03ffe6025 100644 --- a/lib/paymentrequest.py +++ b/electrum/paymentrequest.py @@ -35,16 +35,11 @@ import urllib.parse try: from . import paymentrequest_pb2 as pb2 except ImportError: - sys.exit("Error: could not find paymentrequest_pb2.py. Create it with 'protoc --proto_path=lib/ --python_out=lib/ lib/paymentrequest.proto'") + sys.exit("Error: could not find paymentrequest_pb2.py. Create it with 'protoc --proto_path=electrum/ --python_out=electrum/ electrum/paymentrequest.proto'") -from . import bitcoin -from . import ecc -from . import util +from . import bitcoin, ecc, util, transaction, x509, rsakey from .util import print_error, bh2u, bfh from .util import export_meta, import_meta -from . import transaction -from . import x509 -from . import rsakey from .bitcoin import TYPE_ADDRESS diff --git a/lib/paymentrequest_pb2.py b/electrum/paymentrequest_pb2.py similarity index 100% rename from lib/paymentrequest_pb2.py rename to electrum/paymentrequest_pb2.py diff --git a/lib/pem.py b/electrum/pem.py similarity index 100% rename from lib/pem.py rename to electrum/pem.py diff --git a/lib/plot.py b/electrum/plot.py similarity index 100% rename from lib/plot.py rename to electrum/plot.py diff --git a/lib/plugins.py b/electrum/plugin.py similarity index 97% rename from lib/plugins.py rename to electrum/plugin.py index 3c818ae98..c5223dc37 100644 --- a/lib/plugins.py +++ b/electrum/plugin.py @@ -35,6 +35,7 @@ from .util import print_error from .i18n import _ from .util import profiler, PrintError, DaemonThread, UserCancelled, ThreadJob from . import bitcoin +from . import plugins plugin_loaders = {} hook_names = set() @@ -46,11 +47,6 @@ class Plugins(DaemonThread): @profiler def __init__(self, config, is_local, gui_name): DaemonThread.__init__(self) - if is_local: - find = imp.find_module('plugins') - plugins = imp.load_module('electrum_plugins', *find) - else: - import electrum_plugins as plugins self.pkgpath = os.path.dirname(plugins.__file__) self.config = config self.hw_wallets = {} @@ -64,10 +60,8 @@ class Plugins(DaemonThread): def load_plugins(self): for loader, name, ispkg in pkgutil.iter_modules([self.pkgpath]): - # do not load deprecated plugins - if name in ['plot', 'exchange_rate']: - continue - m = loader.find_module(name).load_module(name) + mod = pkgutil.find_loader('electrum.plugins.' + name) + m = mod.load_module() d = m.__dict__ gui_good = self.gui_name in d.get('available_for', []) if not gui_good: @@ -95,12 +89,12 @@ class Plugins(DaemonThread): def load_plugin(self, name): if name in self.plugins: return self.plugins[name] - full_name = 'electrum_plugins.' + name + '.' + self.gui_name + full_name = 'electrum.plugins.' + name + '.' + self.gui_name loader = pkgutil.find_loader(full_name) if not loader: raise RuntimeError("%s implementation for %s plugin not found" % (self.gui_name, name)) - p = loader.load_module(full_name) + p = loader.load_module() plugin = p.Plugin(self, self.config, name) self.add_jobs(plugin.thread_jobs()) self.plugins[name] = plugin @@ -138,7 +132,8 @@ class Plugins(DaemonThread): for dep, s in deps: try: __import__(dep) - except ImportError: + except ImportError as e: + self.print_error('Plugin', name, 'unavailable:', type(e).__name__, ':', str(e)) return False requires = d.get('requires_wallet_type', []) return not requires or w.wallet_type in requires diff --git a/plugins/README b/electrum/plugins/README similarity index 100% rename from plugins/README rename to electrum/plugins/README diff --git a/plugins/__init__.py b/electrum/plugins/__init__.py similarity index 100% rename from plugins/__init__.py rename to electrum/plugins/__init__.py diff --git a/plugins/audio_modem/__init__.py b/electrum/plugins/audio_modem/__init__.py similarity index 100% rename from plugins/audio_modem/__init__.py rename to electrum/plugins/audio_modem/__init__.py diff --git a/plugins/audio_modem/qt.py b/electrum/plugins/audio_modem/qt.py similarity index 97% rename from plugins/audio_modem/qt.py rename to electrum/plugins/audio_modem/qt.py index 254988b9a..2b88df885 100644 --- a/plugins/audio_modem/qt.py +++ b/electrum/plugins/audio_modem/qt.py @@ -5,8 +5,8 @@ from io import BytesIO import sys import platform -from electrum.plugins import BasePlugin, hook -from electrum_gui.qt.util import WaitingDialog, EnterButton, WindowModalDialog +from electrum.plugin import BasePlugin, hook +from electrum.gui.qt.util import WaitingDialog, EnterButton, WindowModalDialog from electrum.util import print_msg, print_error from electrum.i18n import _ diff --git a/plugins/cosigner_pool/__init__.py b/electrum/plugins/cosigner_pool/__init__.py similarity index 100% rename from plugins/cosigner_pool/__init__.py rename to electrum/plugins/cosigner_pool/__init__.py diff --git a/plugins/cosigner_pool/qt.py b/electrum/plugins/cosigner_pool/qt.py similarity index 98% rename from plugins/cosigner_pool/qt.py rename to electrum/plugins/cosigner_pool/qt.py index cb82e196a..6efe73b5a 100644 --- a/plugins/cosigner_pool/qt.py +++ b/electrum/plugins/cosigner_pool/qt.py @@ -32,12 +32,12 @@ from PyQt5.QtWidgets import QPushButton from electrum import bitcoin, util, keystore, ecc from electrum import transaction -from electrum.plugins import BasePlugin, hook +from electrum.plugin import BasePlugin, hook from electrum.i18n import _ from electrum.wallet import Multisig_Wallet from electrum.util import bh2u, bfh -from electrum_gui.qt.transaction_dialog import show_transaction +from electrum.gui.qt.transaction_dialog import show_transaction import sys import traceback diff --git a/plugins/digitalbitbox/__init__.py b/electrum/plugins/digitalbitbox/__init__.py similarity index 100% rename from plugins/digitalbitbox/__init__.py rename to electrum/plugins/digitalbitbox/__init__.py diff --git a/plugins/digitalbitbox/cmdline.py b/electrum/plugins/digitalbitbox/cmdline.py similarity index 91% rename from plugins/digitalbitbox/cmdline.py rename to electrum/plugins/digitalbitbox/cmdline.py index 82192cfda..cf5d4005a 100644 --- a/plugins/digitalbitbox/cmdline.py +++ b/electrum/plugins/digitalbitbox/cmdline.py @@ -1,4 +1,4 @@ -from electrum.plugins import hook +from electrum.plugin import hook from .digitalbitbox import DigitalBitboxPlugin from ..hw_wallet import CmdLineHandler diff --git a/plugins/digitalbitbox/digitalbitbox.py b/electrum/plugins/digitalbitbox/digitalbitbox.py similarity index 99% rename from plugins/digitalbitbox/digitalbitbox.py rename to electrum/plugins/digitalbitbox/digitalbitbox.py index 60ffbb675..ed8c05f8d 100644 --- a/plugins/digitalbitbox/digitalbitbox.py +++ b/electrum/plugins/digitalbitbox/digitalbitbox.py @@ -4,7 +4,6 @@ # try: - import electrum from electrum.crypto import Hash, EncodeAES, DecodeAES from electrum.bitcoin import (TYPE_ADDRESS, push_script, var_int, public_key_to_p2pkh, is_address, serialize_xpub, deserialize_xpub) diff --git a/plugins/digitalbitbox/qt.py b/electrum/plugins/digitalbitbox/qt.py similarity index 97% rename from plugins/digitalbitbox/qt.py rename to electrum/plugins/digitalbitbox/qt.py index 0d4512529..594756969 100644 --- a/plugins/digitalbitbox/qt.py +++ b/electrum/plugins/digitalbitbox/qt.py @@ -4,7 +4,7 @@ from ..hw_wallet.qt import QtHandlerBase, QtPluginBase from .digitalbitbox import DigitalBitboxPlugin from electrum.i18n import _ -from electrum.plugins import hook +from electrum.plugin import hook from electrum.wallet import Standard_Wallet diff --git a/plugins/email_requests/__init__.py b/electrum/plugins/email_requests/__init__.py similarity index 100% rename from plugins/email_requests/__init__.py rename to electrum/plugins/email_requests/__init__.py diff --git a/plugins/email_requests/qt.py b/electrum/plugins/email_requests/qt.py similarity index 98% rename from plugins/email_requests/qt.py rename to electrum/plugins/email_requests/qt.py index a94981fc2..c5e2a10e3 100644 --- a/plugins/email_requests/qt.py +++ b/electrum/plugins/email_requests/qt.py @@ -42,11 +42,11 @@ from PyQt5.QtCore import * from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QLineEdit, QInputDialog) -from electrum.plugins import BasePlugin, hook +from electrum.plugin import BasePlugin, hook from electrum.paymentrequest import PaymentRequest from electrum.i18n import _ from electrum.util import PrintError -from electrum_gui.qt.util import (EnterButton, Buttons, CloseButton, OkButton, +from ...gui.qt.util import (EnterButton, Buttons, CloseButton, OkButton, WindowModalDialog, get_parent_main_window) diff --git a/plugins/greenaddress_instant/__init__.py b/electrum/plugins/greenaddress_instant/__init__.py similarity index 100% rename from plugins/greenaddress_instant/__init__.py rename to electrum/plugins/greenaddress_instant/__init__.py diff --git a/plugins/greenaddress_instant/qt.py b/electrum/plugins/greenaddress_instant/qt.py similarity index 98% rename from plugins/greenaddress_instant/qt.py rename to electrum/plugins/greenaddress_instant/qt.py index 96cd87b24..81e6686e1 100644 --- a/plugins/greenaddress_instant/qt.py +++ b/electrum/plugins/greenaddress_instant/qt.py @@ -30,7 +30,7 @@ import requests from PyQt5.QtWidgets import QApplication, QPushButton -from electrum.plugins import BasePlugin, hook +from electrum.plugin import BasePlugin, hook from electrum.i18n import _ diff --git a/plugins/hw_wallet/__init__.py b/electrum/plugins/hw_wallet/__init__.py similarity index 100% rename from plugins/hw_wallet/__init__.py rename to electrum/plugins/hw_wallet/__init__.py diff --git a/plugins/hw_wallet/cmdline.py b/electrum/plugins/hw_wallet/cmdline.py similarity index 100% rename from plugins/hw_wallet/cmdline.py rename to electrum/plugins/hw_wallet/cmdline.py diff --git a/plugins/hw_wallet/plugin.py b/electrum/plugins/hw_wallet/plugin.py similarity index 98% rename from plugins/hw_wallet/plugin.py rename to electrum/plugins/hw_wallet/plugin.py index 7eeb2194f..a7f1b76e2 100644 --- a/plugins/hw_wallet/plugin.py +++ b/electrum/plugins/hw_wallet/plugin.py @@ -24,7 +24,7 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from electrum.plugins import BasePlugin, hook +from electrum.plugin import BasePlugin, hook from electrum.i18n import _ from electrum.bitcoin import is_address diff --git a/plugins/hw_wallet/qt.py b/electrum/plugins/hw_wallet/qt.py similarity index 97% rename from plugins/hw_wallet/qt.py rename to electrum/plugins/hw_wallet/qt.py index a70879ff4..214ea2b55 100644 --- a/plugins/hw_wallet/qt.py +++ b/electrum/plugins/hw_wallet/qt.py @@ -27,8 +27,8 @@ import threading from PyQt5.Qt import QVBoxLayout, QLabel -from electrum_gui.qt.password_dialog import PasswordDialog, PW_PASSPHRASE -from electrum_gui.qt.util import * +from electrum.gui.qt.password_dialog import PasswordDialog, PW_PASSPHRASE +from electrum.gui.qt.util import * from electrum.i18n import _ from electrum.util import PrintError @@ -177,9 +177,9 @@ class QtHandlerBase(QObject, PrintError): -from electrum.plugins import hook +from electrum.plugin import hook from electrum.util import UserCancelled -from electrum_gui.qt.main_window import StatusBarButton +from electrum.gui.qt.main_window import StatusBarButton class QtPluginBase(object): diff --git a/plugins/keepkey/__init__.py b/electrum/plugins/keepkey/__init__.py similarity index 100% rename from plugins/keepkey/__init__.py rename to electrum/plugins/keepkey/__init__.py diff --git a/plugins/keepkey/client.py b/electrum/plugins/keepkey/client.py similarity index 100% rename from plugins/keepkey/client.py rename to electrum/plugins/keepkey/client.py diff --git a/plugins/keepkey/clientbase.py b/electrum/plugins/keepkey/clientbase.py similarity index 100% rename from plugins/keepkey/clientbase.py rename to electrum/plugins/keepkey/clientbase.py diff --git a/plugins/keepkey/cmdline.py b/electrum/plugins/keepkey/cmdline.py similarity index 91% rename from plugins/keepkey/cmdline.py rename to electrum/plugins/keepkey/cmdline.py index 4262b7019..7cbad274e 100644 --- a/plugins/keepkey/cmdline.py +++ b/electrum/plugins/keepkey/cmdline.py @@ -1,4 +1,4 @@ -from electrum.plugins import hook +from electrum.plugin import hook from .keepkey import KeepKeyPlugin from ..hw_wallet import CmdLineHandler diff --git a/plugins/keepkey/keepkey.py b/electrum/plugins/keepkey/keepkey.py similarity index 99% rename from plugins/keepkey/keepkey.py rename to electrum/plugins/keepkey/keepkey.py index 04a2d2fb6..053cfe395 100644 --- a/plugins/keepkey/keepkey.py +++ b/electrum/plugins/keepkey/keepkey.py @@ -8,7 +8,7 @@ from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, is_segwit_address) from electrum import constants from electrum.i18n import _ -from electrum.plugins import BasePlugin +from electrum.plugin import BasePlugin from electrum.transaction import deserialize, Transaction from electrum.keystore import Hardware_KeyStore, is_xpubkey, parse_xpubkey from electrum.wallet import Standard_Wallet diff --git a/plugins/keepkey/qt.py b/electrum/plugins/keepkey/qt.py similarity index 99% rename from plugins/keepkey/qt.py rename to electrum/plugins/keepkey/qt.py index 7e62dda8b..cd61d1800 100644 --- a/plugins/keepkey/qt.py +++ b/electrum/plugins/keepkey/qt.py @@ -5,9 +5,9 @@ from PyQt5.Qt import Qt from PyQt5.Qt import QGridLayout, QInputDialog, QPushButton from PyQt5.Qt import QVBoxLayout, QLabel -from electrum_gui.qt.util import * +from electrum.gui.qt.util import * from electrum.i18n import _ -from electrum.plugins import hook, DeviceMgr +from electrum.plugin import hook, DeviceMgr from electrum.util import PrintError, UserCancelled, bh2u from electrum.wallet import Wallet, Standard_Wallet @@ -250,7 +250,7 @@ class QtPlugin(QtPluginBase): else: msg = _("Enter the master private key beginning with xprv:") def set_enabled(): - from electrum.keystore import is_xprv + from keystore import is_xprv wizard.next_button.setEnabled(is_xprv(clean_text(text))) text.textChanged.connect(set_enabled) next_enabled = False diff --git a/plugins/labels/__init__.py b/electrum/plugins/labels/__init__.py similarity index 100% rename from plugins/labels/__init__.py rename to electrum/plugins/labels/__init__.py diff --git a/plugins/labels/cmdline.py b/electrum/plugins/labels/cmdline.py similarity index 87% rename from plugins/labels/cmdline.py rename to electrum/plugins/labels/cmdline.py index bd2db0077..2f9aaa069 100644 --- a/plugins/labels/cmdline.py +++ b/electrum/plugins/labels/cmdline.py @@ -1,5 +1,5 @@ from .labels import LabelsPlugin -from electrum.plugins import hook +from electrum.plugin import hook class Plugin(LabelsPlugin): diff --git a/plugins/labels/kivy.py b/electrum/plugins/labels/kivy.py similarity index 89% rename from plugins/labels/kivy.py rename to electrum/plugins/labels/kivy.py index 508a049ae..56f1d079e 100644 --- a/plugins/labels/kivy.py +++ b/electrum/plugins/labels/kivy.py @@ -1,5 +1,5 @@ from .labels import LabelsPlugin -from electrum.plugins import hook +from electrum.plugin import hook class Plugin(LabelsPlugin): diff --git a/plugins/labels/labels.py b/electrum/plugins/labels/labels.py similarity index 99% rename from plugins/labels/labels.py rename to electrum/plugins/labels/labels.py index 72c27c9b3..d5fa50b2c 100644 --- a/plugins/labels/labels.py +++ b/electrum/plugins/labels/labels.py @@ -7,8 +7,7 @@ import traceback import base64 -import electrum -from electrum.plugins import BasePlugin, hook +from electrum.plugin import BasePlugin, hook from electrum.crypto import aes_encrypt_with_iv, aes_decrypt_with_iv from electrum.i18n import _ diff --git a/plugins/labels/qt.py b/electrum/plugins/labels/qt.py similarity index 93% rename from plugins/labels/qt.py rename to electrum/plugins/labels/qt.py index c608ccf78..df4ae55c2 100644 --- a/plugins/labels/qt.py +++ b/electrum/plugins/labels/qt.py @@ -6,11 +6,11 @@ from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import (QHBoxLayout, QLabel, QVBoxLayout) -from electrum.plugins import hook +from electrum.plugin import hook from electrum.i18n import _ -from electrum_gui.qt import EnterButton -from electrum_gui.qt.util import ThreadedButton, Buttons -from electrum_gui.qt.util import WindowModalDialog, OkButton +from electrum.gui.qt import EnterButton +from electrum.gui.qt.util import ThreadedButton, Buttons +from electrum.gui.qt.util import WindowModalDialog, OkButton from .labels import LabelsPlugin diff --git a/plugins/ledger/__init__.py b/electrum/plugins/ledger/__init__.py similarity index 100% rename from plugins/ledger/__init__.py rename to electrum/plugins/ledger/__init__.py diff --git a/plugins/ledger/auth2fa.py b/electrum/plugins/ledger/auth2fa.py similarity index 99% rename from plugins/ledger/auth2fa.py rename to electrum/plugins/ledger/auth2fa.py index dd074e0f9..f6ddeab01 100644 --- a/plugins/ledger/auth2fa.py +++ b/electrum/plugins/ledger/auth2fa.py @@ -14,10 +14,10 @@ from PyQt5.QtWidgets import * from btchip.btchip import * from electrum.i18n import _ -from electrum_gui.qt.util import * from electrum.util import print_msg from electrum import constants, bitcoin -from electrum_gui.qt.qrcodewidget import QRCodeWidget +from electrum.gui.qt.qrcodewidget import QRCodeWidget +from electrum.gui.qt.util import * DEBUG = False diff --git a/plugins/ledger/cmdline.py b/electrum/plugins/ledger/cmdline.py similarity index 91% rename from plugins/ledger/cmdline.py rename to electrum/plugins/ledger/cmdline.py index 5d8c9f46d..3e8101697 100644 --- a/plugins/ledger/cmdline.py +++ b/electrum/plugins/ledger/cmdline.py @@ -1,4 +1,4 @@ -from electrum.plugins import hook +from electrum.plugin import hook from .ledger import LedgerPlugin from ..hw_wallet import CmdLineHandler diff --git a/plugins/ledger/ledger.py b/electrum/plugins/ledger/ledger.py similarity index 99% rename from plugins/ledger/ledger.py rename to electrum/plugins/ledger/ledger.py index 177c13c5b..73604a9a5 100644 --- a/plugins/ledger/ledger.py +++ b/electrum/plugins/ledger/ledger.py @@ -6,7 +6,7 @@ import traceback from electrum import bitcoin from electrum.bitcoin import TYPE_ADDRESS, int_to_hex, var_int from electrum.i18n import _ -from electrum.plugins import BasePlugin +from electrum.plugin import BasePlugin from electrum.keystore import Hardware_KeyStore from electrum.transaction import Transaction from electrum.wallet import Standard_Wallet diff --git a/plugins/ledger/qt.py b/electrum/plugins/ledger/qt.py similarity index 97% rename from plugins/ledger/qt.py rename to electrum/plugins/ledger/qt.py index 9bffe5738..d49bcb8d6 100644 --- a/plugins/ledger/qt.py +++ b/electrum/plugins/ledger/qt.py @@ -1,9 +1,9 @@ #from btchip.btchipPersoWizard import StartBTChipPersoDialog from electrum.i18n import _ -from electrum.plugins import hook +from electrum.plugin import hook from electrum.wallet import Standard_Wallet -from electrum_gui.qt.util import * +from electrum.gui.qt.util import * from .ledger import LedgerPlugin from ..hw_wallet.qt import QtHandlerBase, QtPluginBase diff --git a/plugins/revealer/DejaVuSansMono-Bold.ttf b/electrum/plugins/revealer/DejaVuSansMono-Bold.ttf similarity index 100% rename from plugins/revealer/DejaVuSansMono-Bold.ttf rename to electrum/plugins/revealer/DejaVuSansMono-Bold.ttf diff --git a/plugins/revealer/LICENSE_DEJAVU.txt b/electrum/plugins/revealer/LICENSE_DEJAVU.txt similarity index 100% rename from plugins/revealer/LICENSE_DEJAVU.txt rename to electrum/plugins/revealer/LICENSE_DEJAVU.txt diff --git a/plugins/revealer/SIL Open Font License.txt b/electrum/plugins/revealer/SIL Open Font License.txt similarity index 100% rename from plugins/revealer/SIL Open Font License.txt rename to electrum/plugins/revealer/SIL Open Font License.txt diff --git a/plugins/revealer/SourceSansPro-Bold.otf b/electrum/plugins/revealer/SourceSansPro-Bold.otf similarity index 100% rename from plugins/revealer/SourceSansPro-Bold.otf rename to electrum/plugins/revealer/SourceSansPro-Bold.otf diff --git a/plugins/revealer/__init__.py b/electrum/plugins/revealer/__init__.py similarity index 99% rename from plugins/revealer/__init__.py rename to electrum/plugins/revealer/__init__.py index cf3fde988..dcc8c31fd 100644 --- a/plugins/revealer/__init__.py +++ b/electrum/plugins/revealer/__init__.py @@ -10,7 +10,6 @@ description = ''.join(["
", _("Once activated you can access the plug-in through the icon at the seed dialog."), '
', '
', _("For more information, visit"), " https://revealer.cc", '
', '
', - ]) available_for = ['qt'] diff --git a/plugins/revealer/qt.py b/electrum/plugins/revealer/qt.py similarity index 97% rename from plugins/revealer/qt.py rename to electrum/plugins/revealer/qt.py index dd77f0235..0ce605622 100644 --- a/plugins/revealer/qt.py +++ b/electrum/plugins/revealer/qt.py @@ -1,6 +1,6 @@ ''' -Revealer +Revealer So you have something to hide? plug-in for the electrum wallet. @@ -10,7 +10,7 @@ Features: - Safety - One time pad security - Redundancy - Trustless printing & distribution - Encrypt your seedphrase or any secret you want for your revealer - - Based on crypto by legendary cryptographers Naor and Shamir + - Based on crypto by legendary cryptographers Naor and Shamir Tiago Romagnani Silveira, 2017 @@ -25,12 +25,13 @@ from decimal import Decimal from PyQt5.QtPrintSupport import QPrinter -from electrum.plugins import BasePlugin, hook +from electrum.plugin import BasePlugin, hook from electrum.i18n import _ -from electrum_gui.qt.util import * -from electrum_gui.qt.qrtextedit import ScanQRTextEdit from electrum.util import to_bytes, make_dir +from electrum.gui.qt.util import * +from electrum.gui.qt.qrtextedit import ScanQRTextEdit + class Plugin(BasePlugin): @@ -239,12 +240,12 @@ class Plugin(BasePlugin): def update_wallet_name (self, name): self.wallet_name = str(name) self.base_name = self.base_dir + self.wallet_name - + def seed_img(self, is_seed = True): - + if not self.cseed and self.txt == False: return - + if is_seed: txt = self.cseed else: @@ -374,8 +375,8 @@ class Plugin(BasePlugin): img = self.overlay_marks(self.calnoise.scaledToHeight(self.f_size.height()), False, True) self.calibration_pdf(img) QDesktopServices.openUrl (QUrl.fromLocalFile(os.path.abspath(self.base_dir+_('calibration')+'.pdf'))) - return img - + return img + def toPdf(self, image): printer = QPrinter() printer.setPaperSize(QSizeF(210, 297), QPrinter.Millimeter) @@ -385,13 +386,13 @@ class Plugin(BasePlugin): printer.setPageMargins(0,0,0,0,6) painter = QPainter() painter.begin(printer) - + delta_h = round(image.width()/self.abstand_v) - delta_v = round(image.height()/self.abstand_h) + delta_v = round(image.height()/self.abstand_h) size_h = 2028+((int(self.calibration_h)*2028/(2028-(delta_h*2)+int(self.calibration_h)))/2) size_v = 1284+((int(self.calibration_v)*1284/(1284-(delta_v*2)+int(self.calibration_v)))/2) - + image = image.scaled(size_h, size_v) painter.drawImage(553,533, image) @@ -400,7 +401,7 @@ class Plugin(BasePlugin): painter.setPen(QPen(Qt.black, 1)) painter.drawPath(wpath) painter.end() - + def calibration_pdf(self, image): printer = QPrinter() printer.setPaperSize(QSizeF(210, 297), QPrinter.Millimeter) @@ -426,7 +427,7 @@ class Plugin(BasePlugin): "match on the opposite sides. ")) painter.drawText(700, 2477, _("4. Type the numbers in the software")) painter.end() - + def pixelcode_2x2(self, img): result = QImage(img.width()*2, img.height()*2, QImage.Format_ARGB32 ) white = qRgba(255,255,255,0) @@ -441,7 +442,7 @@ class Plugin(BasePlugin): result.setPixel(x*2,y*2+1, white) result.setPixel(x*2+1,y*2, white) result.setPixel(x*2, y*2, black) - + else: result.setPixel(x*2+1,y*2+1, white) result.setPixel(x*2,y*2+1, black) @@ -481,13 +482,13 @@ class Plugin(BasePlugin): #border around img border_thick = 6 Rpath = QPainterPath() - Rpath.addRect(QRectF((total_distance_h)+(border_thick/2), - (total_distance_h)+(border_thick/2), + Rpath.addRect(QRectF((total_distance_h)+(border_thick/2), + (total_distance_h)+(border_thick/2), base_img.width()-((total_distance_h)*2)-((border_thick)-1), (base_img.height()-((total_distance_h))*2)-((border_thick)-1))) pen = QPen(Qt.black, border_thick) pen.setJoinStyle (Qt.MiterJoin) - + painter.setPen(pen) painter.drawPath(Rpath) @@ -497,12 +498,12 @@ class Plugin(BasePlugin): pen = QPen(Qt.black, 1) painter.setPen(pen) painter.drawPath(Bpath) - + pen = QPen(Qt.black, 1) painter.setPen(pen) painter.drawLine(0, base_img.height()/2, total_distance_h, base_img.height()/2) painter.drawLine(base_img.width()/2, 0, base_img.width()/2, total_distance_h) - + painter.drawLine(base_img.width()-total_distance_h, base_img.height()/2, base_img.width(), base_img.height()/2) painter.drawLine(base_img.width()/2, base_img.height(), base_img.width()/2, base_img.height() - total_distance_h) @@ -524,15 +525,15 @@ class Plugin(BasePlugin): QImage(':icons/electrumb.png').scaledToWidth(2.1*(total_distance_h), Qt.SmoothTransformation)) painter.setPen(QPen(Qt.white, border_thick*8)) - painter.drawLine(base_img.width()-((total_distance_h))-(border_thick*8)/2-(border_thick/2)-2, - (base_img.height()-((total_distance_h)))-((border_thick*8)/2)-(border_thick/2)-2, + painter.drawLine(base_img.width()-((total_distance_h))-(border_thick*8)/2-(border_thick/2)-2, + (base_img.height()-((total_distance_h)))-((border_thick*8)/2)-(border_thick/2)-2, base_img.width()-((total_distance_h))-(border_thick*8)/2-(border_thick/2)-2 - 77, (base_img.height()-((total_distance_h)))-((border_thick*8)/2)-(border_thick/2)-2) painter.setPen(QColor(0,0,0,255)) painter.drawText(QRect(0, base_img.height()-107, base_img.width()-total_distance_h - border_thick - 11, base_img.height()-total_distance_h - border_thick), Qt.AlignRight, self.version + '_'+self.code_id) painter.end() - + else: # revealer painter.setPen(QPen(border_color, 17)) @@ -550,7 +551,7 @@ class Plugin(BasePlugin): painter.drawImage((total_distance_h)+ (border_thick), ((total_distance_h))+ (border_thick), logo, Qt.SmoothTransformation) #frame around logo - painter.setPen(QPen(Qt.black, border_thick)) + painter.setPen(QPen(Qt.black, border_thick)) painter.drawLine(total_distance_h+border_thick, total_distance_h+logo.height()+3*(border_thick/2), total_distance_h+logo.width()+border_thick, total_distance_h+logo.height()+3*(border_thick/2)) painter.drawLine(logo.width()+total_distance_h+3*(border_thick/2), total_distance_h+(border_thick), @@ -607,12 +608,12 @@ class Plugin(BasePlugin): cal_img = QImage(self.f_size.width() + 100, self.f_size.height() + 100, QImage.Format_ARGB32) cal_img.fill(Qt.white) - + cal_painter = QPainter() cal_painter.begin(cal_img) cal_painter.drawImage(0,0, base_img) - #black lines in the middle of border top left only + #black lines in the middle of border top left only cal_painter.setPen(QPen(Qt.black, 1, Qt.DashDotDotLine)) cal_painter.drawLine(0, dist_v, base_img.width(), dist_v) cal_painter.drawLine(dist_h, 0, dist_h, base_img.height()) @@ -682,7 +683,7 @@ class Plugin(BasePlugin): def calibration_dialog(self, window): d = WindowModalDialog(window, _("Revealer - Printer calibration settings")) - + d.setMinimumSize(100, 200) vbox = QVBoxLayout(d) @@ -709,7 +710,7 @@ class Plugin(BasePlugin): grid.addWidget(vertical, 1, 1) vbox.addStretch() - vbox.addSpacing(13) + vbox.addSpacing(13) vbox.addLayout(Buttons(CloseButton(d), OkButton(d))) if not d.exec_(): diff --git a/plugins/trezor/__init__.py b/electrum/plugins/trezor/__init__.py similarity index 100% rename from plugins/trezor/__init__.py rename to electrum/plugins/trezor/__init__.py diff --git a/plugins/trezor/client.py b/electrum/plugins/trezor/client.py similarity index 100% rename from plugins/trezor/client.py rename to electrum/plugins/trezor/client.py diff --git a/plugins/trezor/clientbase.py b/electrum/plugins/trezor/clientbase.py similarity index 100% rename from plugins/trezor/clientbase.py rename to electrum/plugins/trezor/clientbase.py diff --git a/plugins/trezor/cmdline.py b/electrum/plugins/trezor/cmdline.py similarity index 91% rename from plugins/trezor/cmdline.py rename to electrum/plugins/trezor/cmdline.py index 630578acc..e435aad13 100644 --- a/plugins/trezor/cmdline.py +++ b/electrum/plugins/trezor/cmdline.py @@ -1,4 +1,4 @@ -from electrum.plugins import hook +from electrum.plugin import hook from .trezor import TrezorPlugin from ..hw_wallet import CmdLineHandler diff --git a/plugins/trezor/qt.py b/electrum/plugins/trezor/qt.py similarity index 99% rename from plugins/trezor/qt.py rename to electrum/plugins/trezor/qt.py index d5251178f..53340b94d 100644 --- a/plugins/trezor/qt.py +++ b/electrum/plugins/trezor/qt.py @@ -5,9 +5,9 @@ from PyQt5.Qt import Qt from PyQt5.Qt import QGridLayout, QInputDialog, QPushButton from PyQt5.Qt import QVBoxLayout, QLabel -from electrum_gui.qt.util import * +from electrum.gui.qt.util import * from electrum.i18n import _ -from electrum.plugins import hook, DeviceMgr +from electrum.plugin import hook, DeviceMgr from electrum.util import PrintError, UserCancelled, bh2u from electrum.wallet import Wallet, Standard_Wallet diff --git a/plugins/trezor/transport.py b/electrum/plugins/trezor/transport.py similarity index 100% rename from plugins/trezor/transport.py rename to electrum/plugins/trezor/transport.py diff --git a/plugins/trezor/trezor.py b/electrum/plugins/trezor/trezor.py similarity index 99% rename from plugins/trezor/trezor.py rename to electrum/plugins/trezor/trezor.py index 0a0046ead..94b0754f7 100644 --- a/plugins/trezor/trezor.py +++ b/electrum/plugins/trezor/trezor.py @@ -7,7 +7,7 @@ from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, deserial TYPE_ADDRESS, TYPE_SCRIPT, is_address) from electrum import constants from electrum.i18n import _ -from electrum.plugins import BasePlugin, Device +from electrum.plugin import BasePlugin, Device from electrum.transaction import deserialize, Transaction from electrum.keystore import Hardware_KeyStore, is_xpubkey, parse_xpubkey, xtype_from_derivation from electrum.base_wizard import ScriptTypeNotSupported diff --git a/plugins/trustedcoin/__init__.py b/electrum/plugins/trustedcoin/__init__.py similarity index 100% rename from plugins/trustedcoin/__init__.py rename to electrum/plugins/trustedcoin/__init__.py diff --git a/plugins/trustedcoin/cmdline.py b/electrum/plugins/trustedcoin/cmdline.py similarity index 98% rename from plugins/trustedcoin/cmdline.py rename to electrum/plugins/trustedcoin/cmdline.py index d70b96905..261b70ec9 100644 --- a/plugins/trustedcoin/cmdline.py +++ b/electrum/plugins/trustedcoin/cmdline.py @@ -24,7 +24,7 @@ # SOFTWARE. from electrum.i18n import _ -from electrum.plugins import hook +from electrum.plugin import hook from .trustedcoin import TrustedCoinPlugin diff --git a/plugins/trustedcoin/kivy.py b/electrum/plugins/trustedcoin/kivy.py similarity index 97% rename from plugins/trustedcoin/kivy.py rename to electrum/plugins/trustedcoin/kivy.py index 66659425f..4cd01fbe8 100644 --- a/plugins/trustedcoin/kivy.py +++ b/electrum/plugins/trustedcoin/kivy.py @@ -31,7 +31,7 @@ from decimal import Decimal from kivy.clock import Clock from electrum.i18n import _ -from electrum.plugins import hook +from electrum.plugin import hook from .trustedcoin import TrustedCoinPlugin, server, KIVY_DISCLAIMER, TrustedCoinException, ErrorConnectingServer @@ -54,7 +54,7 @@ class Plugin(TrustedCoinPlugin): wizard.run('accept_terms_of_use') def prompt_user_for_otp(self, wallet, tx, on_success, on_failure): - from electrum_gui.kivy.uix.dialogs.label_dialog import LabelDialog + from ...gui.kivy.uix.dialogs.label_dialog import LabelDialog msg = _('Please enter your Google Authenticator code') d = LabelDialog(msg, '', lambda otp: self.on_otp(wallet, tx, otp, on_success, on_failure)) d.open() diff --git a/plugins/trustedcoin/qt.py b/electrum/plugins/trustedcoin/qt.py similarity index 98% rename from plugins/trustedcoin/qt.py rename to electrum/plugins/trustedcoin/qt.py index f77ab0bb6..da4ce84cd 100644 --- a/plugins/trustedcoin/qt.py +++ b/electrum/plugins/trustedcoin/qt.py @@ -32,12 +32,12 @@ from decimal import Decimal from PyQt5.QtGui import * from PyQt5.QtCore import * -from electrum_gui.qt.util import * -from electrum_gui.qt.qrcodewidget import QRCodeWidget -from electrum_gui.qt.amountedit import AmountEdit -from electrum_gui.qt.main_window import StatusBarButton +from electrum.gui.qt.util import * +from electrum.gui.qt.qrcodewidget import QRCodeWidget +from electrum.gui.qt.amountedit import AmountEdit +from electrum.gui.qt.main_window import StatusBarButton from electrum.i18n import _ -from electrum.plugins import hook +from electrum.plugin import hook from electrum.util import PrintError, is_valid_email from .trustedcoin import TrustedCoinPlugin, server diff --git a/plugins/trustedcoin/trustedcoin.py b/electrum/plugins/trustedcoin/trustedcoin.py similarity index 99% rename from plugins/trustedcoin/trustedcoin.py rename to electrum/plugins/trustedcoin/trustedcoin.py index 3881a917f..9877da970 100644 --- a/plugins/trustedcoin/trustedcoin.py +++ b/electrum/plugins/trustedcoin/trustedcoin.py @@ -31,16 +31,12 @@ import base64 from urllib.parse import urljoin from urllib.parse import quote -import electrum -from electrum import bitcoin, ecc -from electrum import constants -from electrum import keystore +from electrum import bitcoin, ecc, constants, keystore, version from electrum.bitcoin import * from electrum.mnemonic import Mnemonic -from electrum import version from electrum.wallet import Multisig_Wallet, Deterministic_Wallet from electrum.i18n import _ -from electrum.plugins import BasePlugin, hook +from electrum.plugin import BasePlugin, hook from electrum.util import NotEnoughFunds from electrum.storage import STO_EV_USER_PW diff --git a/plugins/virtualkeyboard/__init__.py b/electrum/plugins/virtualkeyboard/__init__.py similarity index 100% rename from plugins/virtualkeyboard/__init__.py rename to electrum/plugins/virtualkeyboard/__init__.py diff --git a/plugins/virtualkeyboard/qt.py b/electrum/plugins/virtualkeyboard/qt.py similarity index 97% rename from plugins/virtualkeyboard/qt.py rename to electrum/plugins/virtualkeyboard/qt.py index 6918aa6e1..3ce78af33 100644 --- a/plugins/virtualkeyboard/qt.py +++ b/electrum/plugins/virtualkeyboard/qt.py @@ -1,6 +1,6 @@ from PyQt5.QtGui import * from PyQt5.QtWidgets import (QVBoxLayout, QGridLayout, QPushButton) -from electrum.plugins import BasePlugin, hook +from electrum.plugin import BasePlugin, hook from electrum.i18n import _ import random diff --git a/lib/qrscanner.py b/electrum/qrscanner.py similarity index 100% rename from lib/qrscanner.py rename to electrum/qrscanner.py diff --git a/lib/ripemd.py b/electrum/ripemd.py similarity index 100% rename from lib/ripemd.py rename to electrum/ripemd.py diff --git a/lib/rsakey.py b/electrum/rsakey.py similarity index 99% rename from lib/rsakey.py rename to electrum/rsakey.py index d9079c304..97efd65d0 100644 --- a/lib/rsakey.py +++ b/electrum/rsakey.py @@ -25,7 +25,7 @@ # This module uses functions from TLSLite (public domain) # -# TLSLite Authors: +# TLSLite Authors: # Trevor Perrin # Martin von Loewis - python 3 port # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2 @@ -80,7 +80,7 @@ def numberToByteArray(n, howManyBytes=None): The returned bytearray may be smaller than howManyBytes, but will not be larger. The returned bytearray will contain a big-endian encoding of the input integer (n). - """ + """ if howManyBytes == None: howManyBytes = numBytes(n) b = bytearray(howManyBytes) @@ -331,7 +331,7 @@ class RSAKey(object): @return: Whether the signature matches the passed-in data. """ hashBytes = SHA1(bytearray(bytes)) - + # Try it with/without the embedded NULL prefixedHashBytes1 = self._addPKCS1SHA1Prefix(hashBytes, False) prefixedHashBytes2 = self._addPKCS1SHA1Prefix(hashBytes, True) @@ -445,21 +445,21 @@ class RSAKey(object): # ************************************************************************** def _addPKCS1SHA1Prefix(self, bytes, withNULL=True): - # There is a long history of confusion over whether the SHA1 - # algorithmIdentifier should be encoded with a NULL parameter or - # with the parameter omitted. While the original intention was + # There is a long history of confusion over whether the SHA1 + # algorithmIdentifier should be encoded with a NULL parameter or + # with the parameter omitted. While the original intention was # apparently to omit it, many toolkits went the other way. TLS 1.2 # specifies the NULL should be included, and this behavior is also # mandated in recent versions of PKCS #1, and is what tlslite has - # always implemented. Anyways, verification code should probably - # accept both. However, nothing uses this code yet, so this is + # always implemented. Anyways, verification code should probably + # accept both. However, nothing uses this code yet, so this is # all fairly moot. if not withNULL: prefixBytes = bytearray(\ - [0x30,0x1f,0x30,0x07,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x04,0x14]) + [0x30,0x1f,0x30,0x07,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x04,0x14]) else: prefixBytes = bytearray(\ - [0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x05,0x00,0x04,0x14]) + [0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x05,0x00,0x04,0x14]) prefixedBytes = prefixBytes + bytes return prefixedBytes diff --git a/scripts/bip70 b/electrum/scripts/bip70.py similarity index 100% rename from scripts/bip70 rename to electrum/scripts/bip70.py diff --git a/scripts/block_headers b/electrum/scripts/block_headers.py similarity index 91% rename from scripts/block_headers rename to electrum/scripts/block_headers.py index cda9e14b9..d3ecb7fdb 100755 --- a/scripts/block_headers +++ b/electrum/scripts/block_headers.py @@ -1,9 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # A simple script that connects to a server and displays block headers import time -from electrum import SimpleConfig, Network +from .. import SimpleConfig, Network from electrum.util import print_msg, json_encode # start network diff --git a/electrum/scripts/estimate_fee.py b/electrum/scripts/estimate_fee.py new file mode 100755 index 000000000..85f63cef0 --- /dev/null +++ b/electrum/scripts/estimate_fee.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 +from . import util +import json +from electrum.network import filter_protocol +peers = filter_protocol(util.get_peers()) +results = util.send_request(peers, 'blockchain.estimatefee', [2]) +print(json.dumps(results, indent=4)) diff --git a/scripts/get_history b/electrum/scripts/get_history.py similarity index 92% rename from scripts/get_history rename to electrum/scripts/get_history.py index 3e25166da..c83f99d91 100755 --- a/scripts/get_history +++ b/electrum/scripts/get_history.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import sys -from electrum import Network +from .. import Network from electrum.util import json_encode, print_msg from electrum import bitcoin diff --git a/scripts/peers b/electrum/scripts/peers.py similarity index 95% rename from scripts/peers rename to electrum/scripts/peers.py index 773926915..a887f0795 100755 --- a/scripts/peers +++ b/electrum/scripts/peers.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import util +from . import util from electrum.network import filter_protocol from electrum.blockchain import hash_header diff --git a/scripts/servers b/electrum/scripts/servers.py similarity index 76% rename from scripts/servers rename to electrum/scripts/servers.py index 1f8cc6826..c7201bc38 100755 --- a/scripts/servers +++ b/electrum/scripts/servers.py @@ -1,8 +1,9 @@ #!/usr/bin/env python3 -from electrum import set_verbosity +from .. import set_verbosity from electrum.network import filter_version -import util, json +from . import util +import json set_verbosity(False) servers = filter_version(util.get_peers()) diff --git a/scripts/txradar b/electrum/scripts/txradar.py similarity index 93% rename from scripts/txradar rename to electrum/scripts/txradar.py index 5c34c0d6c..dda732274 100755 --- a/scripts/txradar +++ b/electrum/scripts/txradar.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -import util, sys +from . import util +import sys try: tx = sys.argv[1] except: diff --git a/scripts/util.py b/electrum/scripts/util.py similarity index 91% rename from scripts/util.py rename to electrum/scripts/util.py index db14a384d..266348f75 100644 --- a/scripts/util.py +++ b/electrum/scripts/util.py @@ -1,6 +1,6 @@ import select, time, queue # import electrum -from electrum import Connection, Interface, SimpleConfig +from .. import Connection, Interface, SimpleConfig from electrum.network import parse_servers from collections import defaultdict @@ -10,6 +10,7 @@ def get_interfaces(servers, timeout=10): '''Returns a map of servers to connected interfaces. If any connections fail or timeout, they will be missing from the map. ''' + assert type(servers) is list socket_queue = queue.Queue() config = SimpleConfig() connecting = {} @@ -51,6 +52,9 @@ def get_peers(): peers = {} # 1. get connected interfaces server = config.get('server') + if server is None: + print("You need to set a secure server, for example (for mainnet): 'electrum setconfig server helicarrier.bauerj.eu:50002:s'") + return [] interfaces = get_interfaces([server]) if not interfaces: print("No connection to", server) diff --git a/scripts/watch_address b/electrum/scripts/watch_address.py similarity index 94% rename from scripts/watch_address rename to electrum/scripts/watch_address.py index 9c60afba4..8fd5d4914 100755 --- a/scripts/watch_address +++ b/electrum/scripts/watch_address.py @@ -3,7 +3,7 @@ import sys import time from electrum import bitcoin -from electrum import SimpleConfig, Network +from .. import SimpleConfig, Network from electrum.util import print_msg, json_encode try: diff --git a/lib/segwit_addr.py b/electrum/segwit_addr.py similarity index 100% rename from lib/segwit_addr.py rename to electrum/segwit_addr.py diff --git a/lib/servers.json b/electrum/servers.json similarity index 100% rename from lib/servers.json rename to electrum/servers.json diff --git a/lib/servers_regtest.json b/electrum/servers_regtest.json similarity index 100% rename from lib/servers_regtest.json rename to electrum/servers_regtest.json diff --git a/lib/servers_testnet.json b/electrum/servers_testnet.json similarity index 100% rename from lib/servers_testnet.json rename to electrum/servers_testnet.json diff --git a/lib/simple_config.py b/electrum/simple_config.py similarity index 96% rename from lib/simple_config.py rename to electrum/simple_config.py index 03558cd7f..e4d75dae4 100644 --- a/lib/simple_config.py +++ b/electrum/simple_config.py @@ -5,6 +5,7 @@ import os import stat from decimal import Decimal from typing import Union +from numbers import Real from copy import deepcopy @@ -310,20 +311,28 @@ class SimpleConfig(PrintError): fee = int(fee) return fee - def fee_to_depth(self, target_fee): + def fee_to_depth(self, target_fee: Real) -> int: + """For a given sat/vbyte fee, returns an estimate of how deep + it would be in the current mempool in vbytes. + Pessimistic == overestimates the depth. + """ depth = 0 for fee, s in self.mempool_fees: depth += s if fee <= target_fee: break - else: - return 0 return depth - @impose_hard_limits_on_fee def depth_to_fee(self, slider_pos) -> int: """Returns fee in sat/kbyte.""" target = self.depth_target(slider_pos) + return self.depth_target_to_fee(target) + + @impose_hard_limits_on_fee + def depth_target_to_fee(self, target: int) -> int: + """Returns fee in sat/kbyte. + target: desired mempool depth in vbytes + """ depth = 0 for fee, s in self.mempool_fees: depth += s @@ -331,6 +340,10 @@ class SimpleConfig(PrintError): break else: return 0 + # add one sat/byte as currently that is + # the max precision of the histogram + fee += 1 + # convert to sat/kbyte return fee * 1000 def depth_target(self, slider_pos): diff --git a/lib/storage.py b/electrum/storage.py similarity index 99% rename from lib/storage.py rename to electrum/storage.py index 69875e3f1..70fb19a55 100644 --- a/lib/storage.py +++ b/electrum/storage.py @@ -34,12 +34,10 @@ import base64 import zlib from collections import defaultdict -from . import util +from . import util, bitcoin, ecc from .util import PrintError, profiler, InvalidPassword, WalletFileException, bfh -from .plugins import run_hook, plugin_loaders +from .plugin import run_hook, plugin_loaders from .keystore import bip44_derivation -from . import bitcoin -from . import ecc # seed_version is now used for the version of the wallet file diff --git a/lib/synchronizer.py b/electrum/synchronizer.py similarity index 100% rename from lib/synchronizer.py rename to electrum/synchronizer.py diff --git a/lib/tests/__init__.py b/electrum/tests/__init__.py similarity index 96% rename from lib/tests/__init__.py rename to electrum/tests/__init__.py index f10adee50..7d1d336d3 100644 --- a/lib/tests/__init__.py +++ b/electrum/tests/__init__.py @@ -1,7 +1,7 @@ import unittest import threading -from lib import constants +from electrum import constants # Set this locally to make the test suite run faster. diff --git a/lib/tests/test_bitcoin.py b/electrum/tests/test_bitcoin.py similarity index 99% rename from lib/tests/test_bitcoin.py rename to electrum/tests/test_bitcoin.py index 46a72e030..8c01f774a 100644 --- a/lib/tests/test_bitcoin.py +++ b/electrum/tests/test_bitcoin.py @@ -2,8 +2,7 @@ import base64 import unittest import sys -from lib import bitcoin -from lib.bitcoin import ( +from electrum.bitcoin import ( public_key_to_p2pkh, bip32_root, bip32_public_derivation, bip32_private_derivation, Hash, address_from_private_key, @@ -13,13 +12,14 @@ from lib.bitcoin import ( is_b58_address, address_to_scripthash, is_minikey, is_compressed, is_xpub, xpub_type, is_xprv, is_bip32_derivation, seed_type, EncodeBase58Check, script_num_to_hex, push_script, add_number_to_script, int_to_hex) -from lib import ecc, crypto, ecc_fast -from lib.ecc import number_to_string, string_to_number -from lib.transaction import opcodes -from lib.util import bfh, bh2u -from lib import constants -from lib.storage import WalletStorage -from lib.keystore import xtype_from_derivation +from electrum import ecc, crypto, constants +from electrum.ecc import number_to_string, string_to_number +from electrum.transaction import opcodes +from electrum.util import bfh, bh2u +from electrum.storage import WalletStorage +from electrum.keystore import xtype_from_derivation + +from electrum import ecc_fast from . import SequentialTestCase from . import TestCaseForTestnet diff --git a/lib/tests/test_commands.py b/electrum/tests/test_commands.py similarity index 97% rename from lib/tests/test_commands.py rename to electrum/tests/test_commands.py index f94a73968..6aa0ba715 100644 --- a/lib/tests/test_commands.py +++ b/electrum/tests/test_commands.py @@ -1,7 +1,7 @@ import unittest from decimal import Decimal -from lib.commands import Commands +from electrum.commands import Commands class TestCommands(unittest.TestCase): diff --git a/lib/tests/test_dnssec.py b/electrum/tests/test_dnssec.py similarity index 99% rename from lib/tests/test_dnssec.py rename to electrum/tests/test_dnssec.py index a73802258..e7e9ac4fb 100644 --- a/lib/tests/test_dnssec.py +++ b/electrum/tests/test_dnssec.py @@ -1,6 +1,6 @@ import dns -from lib import dnssec +from electrum import dnssec from . import SequentialTestCase from .test_bitcoin import needs_test_with_all_ecc_implementations diff --git a/lib/tests/test_interface.py b/electrum/tests/test_interface.py similarity index 97% rename from lib/tests/test_interface.py rename to electrum/tests/test_interface.py index 4f453a61f..402588ca8 100644 --- a/lib/tests/test_interface.py +++ b/electrum/tests/test_interface.py @@ -1,6 +1,6 @@ import unittest -from lib import interface +from electrum import interface from . import SequentialTestCase diff --git a/lib/tests/test_mnemonic.py b/electrum/tests/test_mnemonic.py similarity index 92% rename from lib/tests/test_mnemonic.py rename to electrum/tests/test_mnemonic.py index e19168fab..191ce9023 100644 --- a/lib/tests/test_mnemonic.py +++ b/electrum/tests/test_mnemonic.py @@ -1,8 +1,8 @@ import unittest -from lib import keystore -from lib import mnemonic -from lib import old_mnemonic -from lib.util import bh2u +from electrum import keystore +from electrum import mnemonic +from electrum import old_mnemonic +from electrum.util import bh2u from . import SequentialTestCase diff --git a/lib/tests/test_simple_config.py b/electrum/tests/test_simple_config.py similarity index 72% rename from lib/tests/test_simple_config.py rename to electrum/tests/test_simple_config.py index b62cb407f..6a3dbd023 100644 --- a/lib/tests/test_simple_config.py +++ b/electrum/tests/test_simple_config.py @@ -6,7 +6,7 @@ import tempfile import shutil from io import StringIO -from lib.simple_config import (SimpleConfig, read_user_config) +from electrum.simple_config import (SimpleConfig, read_user_config) from . import SequentialTestCase @@ -110,6 +110,43 @@ class Test_SimpleConfig(SequentialTestCase): result.pop('config_version', None) self.assertEqual({"something": "a"}, result) + def test_depth_target_to_fee(self): + config = SimpleConfig(self.options) + config.mempool_fees = [[49, 100110], [10, 121301], [6, 153731], [5, 125872], [1, 36488810]] + self.assertEqual( 2 * 1000, config.depth_target_to_fee(1000000)) + self.assertEqual( 6 * 1000, config.depth_target_to_fee( 500000)) + self.assertEqual( 7 * 1000, config.depth_target_to_fee( 250000)) + self.assertEqual(11 * 1000, config.depth_target_to_fee( 200000)) + self.assertEqual(50 * 1000, config.depth_target_to_fee( 100000)) + config.mempool_fees = [] + self.assertEqual( 1 * 1000, config.depth_target_to_fee(10 ** 5)) + self.assertEqual( 1 * 1000, config.depth_target_to_fee(10 ** 6)) + self.assertEqual( 1 * 1000, config.depth_target_to_fee(10 ** 7)) + config.mempool_fees = [[1, 36488810]] + self.assertEqual( 2 * 1000, config.depth_target_to_fee(10 ** 5)) + self.assertEqual( 2 * 1000, config.depth_target_to_fee(10 ** 6)) + self.assertEqual( 2 * 1000, config.depth_target_to_fee(10 ** 7)) + self.assertEqual( 1 * 1000, config.depth_target_to_fee(10 ** 8)) + config.mempool_fees = [[5, 125872], [1, 36488810]] + self.assertEqual( 6 * 1000, config.depth_target_to_fee(10 ** 5)) + self.assertEqual( 2 * 1000, config.depth_target_to_fee(10 ** 6)) + self.assertEqual( 2 * 1000, config.depth_target_to_fee(10 ** 7)) + self.assertEqual( 1 * 1000, config.depth_target_to_fee(10 ** 8)) + + def test_fee_to_depth(self): + config = SimpleConfig(self.options) + config.mempool_fees = [[49, 100000], [10, 120000], [6, 150000], [5, 125000], [1, 36000000]] + self.assertEqual(100000, config.fee_to_depth(500)) + self.assertEqual(100000, config.fee_to_depth(50)) + self.assertEqual(100000, config.fee_to_depth(49)) + self.assertEqual(220000, config.fee_to_depth(48)) + self.assertEqual(220000, config.fee_to_depth(10)) + self.assertEqual(370000, config.fee_to_depth(9)) + self.assertEqual(370000, config.fee_to_depth(6.5)) + self.assertEqual(370000, config.fee_to_depth(6)) + self.assertEqual(495000, config.fee_to_depth(5.5)) + self.assertEqual(36495000, config.fee_to_depth(0.5)) + class TestUserConfig(SequentialTestCase): diff --git a/lib/tests/test_storage_upgrade.py b/electrum/tests/test_storage_upgrade.py similarity index 99% rename from lib/tests/test_storage_upgrade.py rename to electrum/tests/test_storage_upgrade.py index 8583e38de..8117176fe 100644 --- a/lib/tests/test_storage_upgrade.py +++ b/electrum/tests/test_storage_upgrade.py @@ -1,10 +1,10 @@ import shutil import tempfile -from lib.storage import WalletStorage -from lib.wallet import Wallet +from electrum.storage import WalletStorage +from electrum.wallet import Wallet -from lib.tests.test_wallet import WalletTestCase +from .test_wallet import WalletTestCase from . import SequentialTestCase @@ -258,8 +258,8 @@ class TestStorageUpgrade(WalletTestCase): @classmethod def setUpClass(cls): super().setUpClass() - from lib.plugins import Plugins - from lib.simple_config import SimpleConfig + from electrum.plugin import Plugins + from electrum.simple_config import SimpleConfig cls.electrum_path = tempfile.mkdtemp() config = SimpleConfig({'electrum_path': cls.electrum_path}) diff --git a/lib/tests/test_transaction.py b/electrum/tests/test_transaction.py similarity index 99% rename from lib/tests/test_transaction.py rename to electrum/tests/test_transaction.py index f58fcbc93..4e43c3aaf 100644 --- a/lib/tests/test_transaction.py +++ b/electrum/tests/test_transaction.py @@ -1,9 +1,9 @@ import unittest -from lib import transaction -from lib.bitcoin import TYPE_ADDRESS -from lib.keystore import xpubkey_to_address -from lib.util import bh2u, bfh +from electrum import transaction +from electrum.bitcoin import TYPE_ADDRESS +from electrum.keystore import xpubkey_to_address +from electrum.util import bh2u, bfh from . import SequentialTestCase, TestCaseForTestnet from .test_bitcoin import needs_test_with_all_ecc_implementations diff --git a/lib/tests/test_util.py b/electrum/tests/test_util.py similarity index 98% rename from lib/tests/test_util.py rename to electrum/tests/test_util.py index 14cc4f617..1ffe1945f 100644 --- a/lib/tests/test_util.py +++ b/electrum/tests/test_util.py @@ -1,5 +1,5 @@ import unittest -from lib.util import format_satoshis, parse_URI +from electrum.util import format_satoshis, parse_URI from . import SequentialTestCase diff --git a/lib/tests/test_wallet.py b/electrum/tests/test_wallet.py similarity index 96% rename from lib/tests/test_wallet.py rename to electrum/tests/test_wallet.py index 3780dc6e4..a19970240 100644 --- a/lib/tests/test_wallet.py +++ b/electrum/tests/test_wallet.py @@ -6,7 +6,7 @@ import os import json from io import StringIO -from lib.storage import WalletStorage, FINAL_SEED_VERSION +from electrum.storage import WalletStorage, FINAL_SEED_VERSION from . import SequentialTestCase diff --git a/lib/tests/test_wallet_vertical.py b/electrum/tests/test_wallet_vertical.py similarity index 99% rename from lib/tests/test_wallet_vertical.py rename to electrum/tests/test_wallet_vertical.py index 1a4ffd71b..96d42dcc2 100644 --- a/lib/tests/test_wallet_vertical.py +++ b/electrum/tests/test_wallet_vertical.py @@ -4,14 +4,13 @@ import shutil import tempfile from typing import Sequence -import lib -from lib import storage, bitcoin, keystore, constants -from lib.transaction import Transaction -from lib.simple_config import SimpleConfig -from lib.wallet import TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT, sweep -from lib.util import bfh, bh2u +from electrum import storage, bitcoin, keystore, constants +from electrum import Transaction +from electrum import SimpleConfig +from electrum.wallet import TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT, sweep, Multisig_Wallet, Standard_Wallet, Imported_Wallet +from electrum.util import bfh, bh2u -from plugins.trustedcoin import trustedcoin +from electrum.plugins.trustedcoin import trustedcoin from . import TestCaseForTestnet from . import SequentialTestCase @@ -41,7 +40,7 @@ class WalletIntegrityHelper: store = storage.WalletStorage('if_this_exists_mocking_failed_648151893') store.put('keystore', ks.dump()) store.put('gap_limit', gap_limit or cls.gap_limit) - w = lib.wallet.Standard_Wallet(store) + w = Standard_Wallet(store) w.synchronize() return w @@ -51,7 +50,7 @@ class WalletIntegrityHelper: if privkeys: k = keystore.Imported_KeyStore({}) store.put('keystore', k.dump()) - w = lib.wallet.Imported_Wallet(store) + w = Imported_Wallet(store) return w @classmethod @@ -63,7 +62,7 @@ class WalletIntegrityHelper: store.put('x%d/' % cosigner_index, ks.dump()) store.put('wallet_type', multisig_type) store.put('gap_limit', gap_limit or cls.gap_limit) - w = lib.wallet.Multisig_Wallet(store) + w = Multisig_Wallet(store) w.synchronize() return w diff --git a/lib/transaction.py b/electrum/transaction.py similarity index 100% rename from lib/transaction.py rename to electrum/transaction.py diff --git a/lib/util.py b/electrum/util.py similarity index 99% rename from lib/util.py rename to electrum/util.py index dbe5bef77..0e9f1285c 100644 --- a/lib/util.py +++ b/electrum/util.py @@ -330,7 +330,10 @@ def android_data_dir(): def android_headers_dir(): d = android_ext_dir() + '/org.electrum.electrum' if not os.path.exists(d): - os.mkdir(d) + try: + os.mkdir(d) + except FileExistsError: + pass # in case of race return d def android_check_data_dir(): @@ -586,6 +589,8 @@ mainnet_block_explorers = { {'tx': 'transaction/', 'addr': 'address/'}), 'blockonomics.co': ('https://www.blockonomics.co/', {'tx': 'api/tx?txid=', 'addr': '#/search?q='}), + 'OXT.me': ('https://oxt.me/', + {'tx': 'transaction/', 'addr': 'address/'}), 'system default': ('blockchain:/', {'tx': 'tx/', 'addr': 'address/'}), } diff --git a/lib/verifier.py b/electrum/verifier.py similarity index 84% rename from lib/verifier.py rename to electrum/verifier.py index 1f94016ed..0a78ad059 100644 --- a/lib/verifier.py +++ b/electrum/verifier.py @@ -42,42 +42,44 @@ class SPV(ThreadJob): interface = self.network.interface if not interface: return + blockchain = interface.blockchain if not blockchain: return - lh = self.network.get_local_height() + + local_height = self.network.get_local_height() unverified = self.wallet.get_unverified_txs() for tx_hash, tx_height in unverified.items(): # do not request merkle branch before headers are available - if (tx_height > 0) and (tx_height <= lh): - header = blockchain.read_header(tx_height) - if header is None: - index = tx_height // 2016 - if index < len(blockchain.checkpoints): - self.network.request_chunk(interface, index) - else: - if (tx_hash not in self.requested_merkle - and tx_hash not in self.merkle_roots): - - self.network.get_merkle_for_transaction( - tx_hash, - tx_height, - self.verify_merkle) - self.print_error('requested merkle', tx_hash) - self.requested_merkle.add(tx_hash) + if tx_height <= 0 or tx_height > local_height: + continue + + header = blockchain.read_header(tx_height) + if header is None: + index = tx_height // 2016 + if index < len(blockchain.checkpoints): + self.network.request_chunk(interface, index) + elif (tx_hash not in self.requested_merkle + and tx_hash not in self.merkle_roots): + self.network.get_merkle_for_transaction( + tx_hash, + tx_height, + self.verify_merkle) + self.print_error('requested merkle', tx_hash) + self.requested_merkle.add(tx_hash) if self.network.blockchain() != self.blockchain: self.blockchain = self.network.blockchain() self.undo_verifications() - def verify_merkle(self, r): + def verify_merkle(self, response): if self.wallet.verifier is None: return # we have been killed, this was just an orphan callback - if r.get('error'): - self.print_error('received an error:', r) + if response.get('error'): + self.print_error('received an error:', response) return - params = r['params'] - merkle = r['result'] + params = response['params'] + merkle = response['result'] # Verify the hash of the server-provided merkle branch to a # transaction matches the merkle root of its block tx_hash = params[0] diff --git a/lib/version.py b/electrum/version.py similarity index 100% rename from lib/version.py rename to electrum/version.py diff --git a/lib/wallet.py b/electrum/wallet.py similarity index 99% rename from lib/wallet.py rename to electrum/wallet.py index daa93d5e9..416deffdb 100644 --- a/lib/wallet.py +++ b/electrum/wallet.py @@ -54,15 +54,12 @@ from .version import * from .keystore import load_keystore, Hardware_KeyStore from .storage import multisig_type, STO_EV_PLAINTEXT, STO_EV_USER_PW, STO_EV_XPUB_PW -from . import transaction +from . import transaction, bitcoin, coinchooser, paymentrequest, contacts from .transaction import Transaction -from .plugins import run_hook -from . import bitcoin -from . import coinchooser +from .plugin import run_hook from .synchronizer import Synchronizer from .verifier import SPV -from . import paymentrequest from .paymentrequest import PR_PAID, PR_UNPAID, PR_UNKNOWN, PR_EXPIRED from .paymentrequest import InvoiceStore from .contacts import Contacts @@ -218,10 +215,7 @@ class Abstract_Wallet(PrintError): self.load_unverified_transactions() self.remove_local_transactions_we_dont_have() - # There is a difference between wallet.up_to_date and network.is_up_to_date(). - # network.is_up_to_date() returns true when all requests have been answered and processed - # wallet.up_to_date is true when the wallet is synchronized (stronger requirement) - # Neither of them considers the verifier. + # wallet.up_to_date is true when the wallet is synchronized self.up_to_date = False # save wallet type the first time diff --git a/lib/websockets.py b/electrum/websockets.py similarity index 100% rename from lib/websockets.py rename to electrum/websockets.py diff --git a/lib/wordlist/chinese_simplified.txt b/electrum/wordlist/chinese_simplified.txt similarity index 100% rename from lib/wordlist/chinese_simplified.txt rename to electrum/wordlist/chinese_simplified.txt diff --git a/lib/wordlist/english.txt b/electrum/wordlist/english.txt similarity index 100% rename from lib/wordlist/english.txt rename to electrum/wordlist/english.txt diff --git a/lib/wordlist/japanese.txt b/electrum/wordlist/japanese.txt similarity index 100% rename from lib/wordlist/japanese.txt rename to electrum/wordlist/japanese.txt diff --git a/lib/wordlist/portuguese.txt b/electrum/wordlist/portuguese.txt similarity index 100% rename from lib/wordlist/portuguese.txt rename to electrum/wordlist/portuguese.txt diff --git a/lib/wordlist/spanish.txt b/electrum/wordlist/spanish.txt similarity index 100% rename from lib/wordlist/spanish.txt rename to electrum/wordlist/spanish.txt diff --git a/lib/x509.py b/electrum/x509.py similarity index 100% rename from lib/x509.py rename to electrum/x509.py diff --git a/electrum b/run_electrum similarity index 98% rename from electrum rename to run_electrum index 150e4adab..b5d5af00d 100755 --- a/electrum +++ b/run_electrum @@ -32,7 +32,7 @@ is_local = not is_bundle and os.path.exists(os.path.join(script_dir, "electrum.d is_android = 'ANDROID_DATA' in os.environ # move this back to gui/kivy/__init.py once plugins are moved -os.environ['KIVY_DATA_DIR'] = os.path.abspath(os.path.dirname(__file__)) + '/gui/kivy/data/' +os.environ['KIVY_DATA_DIR'] = os.path.abspath(os.path.dirname(__file__)) + '/electrum/gui/kivy/data/' if is_local or is_android: sys.path.insert(0, os.path.join(script_dir, 'packages')) @@ -64,18 +64,12 @@ def check_imports(): if not is_android: check_imports() -# load local module as electrum -if is_local or is_android: - import imp - imp.load_module('electrum', *imp.find_module('lib')) - imp.load_module('electrum_gui', *imp.find_module('gui')) - - from electrum import bitcoin, util from electrum import constants from electrum import SimpleConfig, Network from electrum.wallet import Wallet, Imported_Wallet +from electrum import bitcoin, util, constants from electrum.storage import WalletStorage, get_derivation_used_for_hw_device_encryption from electrum.util import print_msg, print_stderr, json_encode, json_decode, UserCancelled from electrum.util import set_verbosity, InvalidPassword @@ -327,7 +321,7 @@ def run_offline_command(config, config_options, plugins): return result def init_plugins(config, gui_name): - from electrum.plugins import Plugins + from electrum.plugin import Plugins return Plugins(config, is_local or is_android, gui_name) diff --git a/scripts/estimate_fee b/scripts/estimate_fee deleted file mode 100755 index a0581f5a8..000000000 --- a/scripts/estimate_fee +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python -import util, json -peers = util.get_peers() -results = util.send_request(peers, 'blockchain.estimatefee', [2]) -print(json.dumps(results, indent=4)) diff --git a/setup.py b/setup.py index ab79b00b0..937375fb4 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ with open('contrib/requirements/requirements.txt') as f: with open('contrib/requirements/requirements-hw.txt') as f: requirements_hw = f.read().splitlines() -version = imp.load_source('version', 'lib/version.py') +version = imp.load_source('version', 'electrum/version.py') if sys.version_info[:3] < (3, 4, 0): sys.exit("Error: Electrum requires Python version >= 3.4.0...") @@ -55,36 +55,34 @@ setup( extras_require=extras_require, packages=[ 'electrum', - 'electrum_gui', - 'electrum_gui.qt', - 'electrum_plugins', - 'electrum_plugins.audio_modem', - 'electrum_plugins.cosigner_pool', - 'electrum_plugins.email_requests', - 'electrum_plugins.greenaddress_instant', - 'electrum_plugins.hw_wallet', - 'electrum_plugins.keepkey', - 'electrum_plugins.labels', - 'electrum_plugins.ledger', - 'electrum_plugins.revealer', - 'electrum_plugins.trezor', - 'electrum_plugins.digitalbitbox', - 'electrum_plugins.trustedcoin', - 'electrum_plugins.virtualkeyboard', + 'electrum.gui', + 'electrum.gui.qt', + 'electrum.plugins', + 'electrum.plugins.audio_modem', + 'electrum.plugins.cosigner_pool', + 'electrum.plugins.email_requests', + 'electrum.plugins.greenaddress_instant', + 'electrum.plugins.hw_wallet', + 'electrum.plugins.keepkey', + 'electrum.plugins.labels', + 'electrum.plugins.ledger', + 'electrum.plugins.revealer', + 'electrum.plugins.trezor', + 'electrum.plugins.digitalbitbox', + 'electrum.plugins.trustedcoin', + 'electrum.plugins.virtualkeyboard', ], package_dir={ - 'electrum': 'lib', - 'electrum_gui': 'gui', - 'electrum_plugins': 'plugins', + 'electrum': 'electrum' }, package_data={ '': ['*.txt', '*.json', '*.ttf', '*.otf'], 'electrum': [ - 'wordlist/*.txt', - 'locale/*/LC_MESSAGES/electrum.mo', + 'electrum/wordlist/*.txt', + 'electrum/locale/*/LC_MESSAGES/electrum.mo', ], }, - scripts=['electrum'], + scripts=['electrum/electrum'], data_files=data_files, description="Lightweight Bitcoin Wallet", author="Thomas Voegtlin", diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 5c3fcf18f..20f2b63de 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -19,5 +19,5 @@ parts: python-version: python3 stage-packages: [python3-pyqt5] build-packages: [pyqt5-dev-tools] - install: pyrcc5 icons.qrc -o $SNAPCRAFT_PART_INSTALL/lib/python3.5/site-packages/electrum_gui/qt/icons_rc.py + install: pyrcc5 icons.qrc -o $SNAPCRAFT_PART_INSTALL/lib/python3.5/site-packages/electrum/gui/qt/icons_rc.py after: [desktop-qt5] diff --git a/tox.ini b/tox.ini index 39fc02aff..9a245bbc9 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ deps= pytest coverage commands= - coverage run --source=lib -m py.test -v + coverage run --source=electrum -m py.test -v coverage report extras= fast