Browse Source

fix: qt icons not available when installed as python package

follow-up #5053
sqlite_db
SomberNight 6 years ago
parent
commit
4fa87d8595
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 1
      electrum/gui/icons
  2. 2
      electrum/gui/qt/util.py
  3. 6
      electrum/util.py
  4. 5
      setup.py

1
electrum/gui/icons

@ -0,0 +1 @@
../../icons/

2
electrum/gui/qt/util.py

@ -797,7 +797,7 @@ def get_parent_main_window(widget):
def icon_path(icon_basename): def icon_path(icon_basename):
return resource_path('icons', icon_basename) return resource_path('gui', 'icons', icon_basename)
@lru_cache(maxsize=1000) @lru_cache(maxsize=1000)

6
electrum/util.py

@ -490,11 +490,11 @@ def user_dir():
def resource_path(*parts): 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 # absolute path to python package folder of electrum ("lib")
base_dir = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] pkg_dir = os.path.split(os.path.realpath(__file__))[0]
def is_valid_email(s): def is_valid_email(s):

5
setup.py

@ -47,7 +47,7 @@ if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']:
usr_share = os.path.expanduser('~/.local/share') usr_share = os.path.expanduser('~/.local/share')
data_files += [ data_files += [
(os.path.join(usr_share, 'applications/'), ['electrum.desktop']), (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 = { extras_require = {
@ -79,6 +79,9 @@ setup(
'wordlist/*.txt', 'wordlist/*.txt',
'locale/*/LC_MESSAGES/electrum.mo', 'locale/*/LC_MESSAGES/electrum.mo',
], ],
'electrum.gui': [
'icons/*',
],
}, },
scripts=['electrum/electrum'], scripts=['electrum/electrum'],
data_files=data_files, data_files=data_files,

Loading…
Cancel
Save