Browse Source

Merge pull request #2666 from suut/master

Remove usages of deprecated apply() builtin
2.9.x
ThomasV 8 years ago
committed by GitHub
parent
commit
19deb56677
  1. 4
      gui/kivy/main_window.py
  2. 2
      gui/kivy/uix/dialogs/installwizard.py
  3. 2
      gui/qt/installwizard.py
  4. 2
      gui/qt/main_window.py
  5. 2
      gui/qt/util.py
  6. 4
      lib/base_wizard.py
  7. 4
      lib/commands.py

4
gui/kivy/main_window.py

@ -841,7 +841,7 @@ class ElectrumWindow(App):
if self.wallet.has_password(): if self.wallet.has_password():
self.password_dialog(msg, f, args) self.password_dialog(msg, f, args)
else: else:
apply(f, args + (None,)) f(*args, None)
def delete_wallet(self): def delete_wallet(self):
from uix.dialogs.question import Question from uix.dialogs.question import Question
@ -918,7 +918,7 @@ class ElectrumWindow(App):
def password_dialog(self, msg, f, args): def password_dialog(self, msg, f, args):
def callback(pw): def callback(pw):
Clock.schedule_once(lambda x: apply(f, args + (pw,)), 0.1) Clock.schedule_once(lambda _: f(*args, pw), 0.1)
if self._password_dialog is None: if self._password_dialog is None:
from uix.dialogs.password_dialog import PasswordDialog from uix.dialogs.password_dialog import PasswordDialog
self._password_dialog = PasswordDialog() self._password_dialog = PasswordDialog()

2
gui/kivy/uix/dialogs/installwizard.py

@ -767,7 +767,7 @@ class InstallWizard(BaseWizard, Widget):
WizardChoiceDialog(self, **kwargs).open() WizardChoiceDialog(self, **kwargs).open()
else: else:
f = kwargs['run_next'] f = kwargs['run_next']
apply(f, (choices[0][0],)) f(choices[0][0])
def multisig_dialog(self, **kwargs): WizardMultisigDialog(self, **kwargs).open() def multisig_dialog(self, **kwargs): WizardMultisigDialog(self, **kwargs).open()
def show_seed_dialog(self, **kwargs): ShowSeedDialog(self, **kwargs).open() def show_seed_dialog(self, **kwargs): ShowSeedDialog(self, **kwargs).open()

2
gui/qt/installwizard.py

@ -87,7 +87,7 @@ def wizard_dialog(func):
# out = () # out = ()
if type(out) is not tuple: if type(out) is not tuple:
out = (out,) out = (out,)
apply(run_next, out) run_next(*out)
return func_wrapper return func_wrapper

2
gui/qt/main_window.py

@ -1708,7 +1708,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
c = commands.Commands(self.config, self.wallet, self.network, lambda: self.console.set_json(True)) c = commands.Commands(self.config, self.wallet, self.network, lambda: self.console.set_json(True))
methods = {} methods = {}
def mkfunc(f, method): def mkfunc(f, method):
return lambda *args: apply( f, (method, args, self.password_dialog )) return lambda *args: f(method, args, self.password_dialog)
for m in dir(c): for m in dir(c):
if m[0]=='_' or m in ['network','wallet']: continue if m[0]=='_' or m in ['network','wallet']: continue
methods[m] = mkfunc(c._run, m) methods[m] = mkfunc(c._run, m)

2
gui/qt/util.py

@ -69,7 +69,7 @@ class EnterButton(QPushButton):
def keyPressEvent(self, e): def keyPressEvent(self, e):
if e.key() == Qt.Key_Return: if e.key() == Qt.Key_Return:
apply(self.func,()) self.func()
class ThreadedButton(QPushButton): class ThreadedButton(QPushButton):

4
lib/base_wizard.py

@ -54,10 +54,10 @@ class BaseWizard(object):
self.plugin, action = action self.plugin, action = action
if self.plugin and hasattr(self.plugin, action): if self.plugin and hasattr(self.plugin, action):
f = getattr(self.plugin, action) f = getattr(self.plugin, action)
apply(f, (self,) + args) f(self, *args)
elif hasattr(self, action): elif hasattr(self, action):
f = getattr(self, action) f = getattr(self, action)
apply(f, args) f(*args)
else: else:
raise BaseException("unknown action", action) raise BaseException("unknown action", action)

4
lib/commands.py

@ -97,7 +97,7 @@ class Commands:
# this wrapper is called from the python console # this wrapper is called from the python console
cmd = known_commands[method] cmd = known_commands[method]
if cmd.requires_password and self.wallet.has_password(): if cmd.requires_password and self.wallet.has_password():
password = apply(password_getter, ()) password = password_getter()
if password is None: if password is None:
return return
f = getattr(self, method) f = getattr(self, method)
@ -107,7 +107,7 @@ class Commands:
result = f(*args) result = f(*args)
if self._callback: if self._callback:
apply(self._callback, ()) self._callback()
return result return result
@command('') @command('')

Loading…
Cancel
Save