Take text as pos. argument for _build_question
This commit is contained in:
parent
6d7748f05f
commit
75bb2265be
@ -99,7 +99,8 @@ class BrowserPage(QWebPage):
|
||||
config.get('content', 'ignore-javascript-prompt')):
|
||||
return (False, "")
|
||||
answer = message.ask(self._win_id, 'Javascript prompt', msg,
|
||||
usertypes.PromptMode.text, default=default,
|
||||
mode=usertypes.PromptMode.text,
|
||||
default=default,
|
||||
abort_on=[self.loadStarted,
|
||||
self.shutting_down])
|
||||
if answer is None:
|
||||
@ -451,7 +452,7 @@ class BrowserPage(QWebPage):
|
||||
config.get('content', 'ignore-javascript-alert')):
|
||||
return
|
||||
message.ask(self._win_id, 'Javascript alert', msg,
|
||||
usertypes.PromptMode.alert,
|
||||
mode=usertypes.PromptMode.alert,
|
||||
abort_on=[self.loadStarted, self.shutting_down])
|
||||
|
||||
def javaScriptConfirm(self, frame, msg):
|
||||
@ -463,7 +464,7 @@ class BrowserPage(QWebPage):
|
||||
if self._is_shutting_down:
|
||||
return False
|
||||
ans = message.ask(self._win_id, 'Javascript confirm', msg,
|
||||
usertypes.PromptMode.yesno,
|
||||
mode=usertypes.PromptMode.yesno,
|
||||
abort_on=[self.loadStarted, self.shutting_down])
|
||||
return bool(ans)
|
||||
|
||||
|
@ -521,7 +521,7 @@ class MainWindow(QWidget):
|
||||
if quit_texts or 'always' in confirm_quit:
|
||||
text = '\n'.join(['Really quit?'] + quit_texts)
|
||||
confirmed = message.ask(self.win_id, text,
|
||||
usertypes.PromptMode.yesno,
|
||||
mode=usertypes.PromptMode.yesno,
|
||||
default=True)
|
||||
# Stop asking if the user cancels
|
||||
if not confirmed:
|
||||
|
@ -76,7 +76,7 @@ def info(message):
|
||||
global_bridge.show_message.emit(usertypes.MessageLevel.info, message)
|
||||
|
||||
|
||||
def _build_question(title, mode, *, default=None, text=None, abort_on=()):
|
||||
def _build_question(title, text=None, *, mode, default=None, abort_on=()):
|
||||
"""Common function for ask/ask_async."""
|
||||
if not isinstance(mode, usertypes.PromptMode):
|
||||
raise TypeError("Mode {} is no PromptMode member!".format(mode))
|
||||
@ -123,7 +123,7 @@ def ask_async(win_id, text, mode, handler, **kwargs):
|
||||
default: The default value to display.
|
||||
text: Additional text to show.
|
||||
"""
|
||||
question = _build_question(text, mode, **kwargs)
|
||||
question = _build_question(text, mode=mode, **kwargs)
|
||||
question.answered.connect(handler)
|
||||
question.completed.connect(question.deleteLater)
|
||||
bridge = objreg.get('message-bridge', scope='window', window=win_id)
|
||||
|
Loading…
Reference in New Issue
Block a user