From 4fa87d8595fa02f8d7503da27eef19a03cb365fb Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 1 Feb 2019 23:32:24 +0100 Subject: [PATCH] fix: qt icons not available when installed as python package follow-up #5053 --- electrum/gui/icons | 1 + electrum/gui/qt/util.py | 2 +- electrum/util.py | 6 +++--- setup.py | 5 ++++- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 120000 electrum/gui/icons diff --git a/electrum/gui/icons b/electrum/gui/icons new file mode 120000 index 000000000..9a5906b77 --- /dev/null +++ b/electrum/gui/icons @@ -0,0 +1 @@ +../../icons/ \ No newline at end of file diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py index 6aaa65b69..215cdc6de 100644 --- a/electrum/gui/qt/util.py +++ b/electrum/gui/qt/util.py @@ -797,7 +797,7 @@ def get_parent_main_window(widget): def icon_path(icon_basename): - return resource_path('icons', icon_basename) + return resource_path('gui', 'icons', icon_basename) @lru_cache(maxsize=1000) diff --git a/electrum/util.py b/electrum/util.py index 4154a4c74..f04f0c801 100644 --- a/electrum/util.py +++ b/electrum/util.py @@ -490,11 +490,11 @@ def user_dir(): def resource_path(*parts): - return os.path.join(base_dir, *parts) + return os.path.join(pkg_dir, *parts) -# absolute path to project root dir when running from source -base_dir = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] +# absolute path to python package folder of electrum ("lib") +pkg_dir = os.path.split(os.path.realpath(__file__))[0] def is_valid_email(s): diff --git a/setup.py b/setup.py index 10404550b..f39a04717 100755 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']: usr_share = os.path.expanduser('~/.local/share') data_files += [ (os.path.join(usr_share, 'applications/'), ['electrum.desktop']), - (os.path.join(usr_share, icons_dirname), ['icons/electrum.png']) + (os.path.join(usr_share, icons_dirname), ['icons/electrum.png']), ] extras_require = { @@ -79,6 +79,9 @@ setup( 'wordlist/*.txt', 'locale/*/LC_MESSAGES/electrum.mo', ], + 'electrum.gui': [ + 'icons/*', + ], }, scripts=['electrum/electrum'], data_files=data_files,