Browse Source

qml: simplify path_protect decorator

master
Sander van Grieken 3 years ago
parent
commit
6733665dac
  1. 7
      electrum/gui/qml/auth.py

7
electrum/gui/qml/auth.py

@ -4,11 +4,9 @@ from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty
from electrum.logging import get_logger from electrum.logging import get_logger
def auth_protect(message='', method='pin', reject=None): def auth_protect(func=None, reject=None, method='pin', message=''):
def decorator(func=None):
if func is None: if func is None:
return partial(auth_protect, reject=reject, method=method) return partial(auth_protect, reject=reject, method=method, message=message)
@wraps(func) @wraps(func)
def wrapper(self, *args, **kwargs): def wrapper(self, *args, **kwargs):
@ -21,7 +19,6 @@ def auth_protect(message='', method='pin', reject=None):
getattr(self, 'authRequired').emit(method, message) getattr(self, 'authRequired').emit(method, message)
return wrapper return wrapper
return decorator
class AuthMixin: class AuthMixin:
_auth_logger = get_logger(__name__) _auth_logger = get_logger(__name__)

Loading…
Cancel
Save