Make message.confirm_async keyword-only

This commit is contained in:
Florian Bruhin 2017-12-15 14:49:49 +01:00
parent 79717528ec
commit fc987ea9c0
2 changed files with 5 additions and 5 deletions

View File

@ -149,8 +149,8 @@ class WebHistory(sql.SqlTable):
if force:
self._do_clear()
else:
message.confirm_async(self._do_clear, title="Clear all browsing "
"history?")
message.confirm_async(yes_action=self._do_clear,
title="Clear all browsing history?")
def _do_clear(self):
with self._handle_sql_errors():

View File

@ -137,8 +137,8 @@ def ask_async(title, mode, handler, **kwargs):
global_bridge.ask(question, blocking=False)
def confirm_async(yes_action, no_action=None, cancel_action=None,
*args, **kwargs):
def confirm_async(*, yes_action, no_action=None, cancel_action=None,
**kwargs):
"""Ask a yes/no question to the user and execute the given actions.
Args:
@ -154,7 +154,7 @@ def confirm_async(yes_action, no_action=None, cancel_action=None,
The question object.
"""
kwargs['mode'] = usertypes.PromptMode.yesno
question = _build_question(*args, **kwargs) # pylint: disable=missing-kwoa
question = _build_question(**kwargs) # pylint: disable=missing-kwoa
question.answered_yes.connect(yes_action)
if no_action is not None:
question.answered_no.connect(no_action)