qml: fix doNotify for Windows. lol
```
319.55 | E | gui.qml.qeapp.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
File "...\electrum\electrum\util.py", line 1130, in run_with_except_hook
run_original(*args2, **kwargs2)
File "...\Python310\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "...\plyer\platforms\win\libs\balloontip.py", line 206, in balloon_tip
WindowsBalloonTip(**kwargs)
File "...\plyer\platforms\win\libs\balloontip.py", line 130, in __init__
raise Exception('Could not load icon {}'.format(app_icon))
Exception: Could not load icon ...\electrum\electrum\gui\icons\electrum.png
```
This commit is contained in:
@@ -161,14 +161,17 @@ class QEAppController(BaseCrashReporter, QObject):
|
||||
|
||||
def doNotify(self, wallet_name, message):
|
||||
self.logger.debug(f'sending push notification to OS: {message=!r}')
|
||||
if os.name == 'nt':
|
||||
icon = "" # plyer wants image to be in .ico format on Windows
|
||||
else:
|
||||
icon = os.path.join(
|
||||
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "icons", "electrum.png",
|
||||
)
|
||||
try:
|
||||
# TODO: lazy load not in UI thread please
|
||||
global notification
|
||||
if not notification:
|
||||
from plyer import notification
|
||||
icon = os.path.join(
|
||||
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "icons", "electrum.png",
|
||||
)
|
||||
notification.notify('Electrum', message, app_icon=icon, app_name='Electrum')
|
||||
except ImportError:
|
||||
self.logger.warning('Notification: needs plyer; `python3 -m pip install plyer`')
|
||||
|
||||
Reference in New Issue
Block a user