Pass win_id correctly with invalid_url_error.
This commit is contained in:
parent
202b5e2bb9
commit
15a2be877a
@ -362,7 +362,7 @@ class DownloadManager(QObject):
|
||||
page: The QWebPage to get the download from.
|
||||
"""
|
||||
if not url.isValid():
|
||||
urlutils.invalid_url_error(url, "start download")
|
||||
urlutils.invalid_url_error('current', url, "start download")
|
||||
return
|
||||
req = QNetworkRequest(url)
|
||||
reply = page.networkAccessManager().get(req)
|
||||
|
@ -66,7 +66,7 @@ def prompt_save(win_id, url):
|
||||
url: The quickmark url as a QUrl.
|
||||
"""
|
||||
if not url.isValid():
|
||||
urlutils.invalid_url_error(url, "save quickmark")
|
||||
urlutils.invalid_url_error(win_id, url, "save quickmark")
|
||||
return
|
||||
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||
message.ask_async(win_id, "Add quickmark:", usertypes.PromptMode.text,
|
||||
|
@ -262,15 +262,20 @@ def qurl_from_user_input(urlstr):
|
||||
return QUrl('http://[{}]{}'.format(ipstr, rest))
|
||||
|
||||
|
||||
def invalid_url_error(url, action):
|
||||
"""Display an error message for an URL."""
|
||||
def invalid_url_error(win_id, url, action):
|
||||
"""Display an error message for an URL.
|
||||
|
||||
Args:
|
||||
win_id: The window ID to show the error message in.
|
||||
action: The action which was interrupted by the error.
|
||||
"""
|
||||
if url.isValid():
|
||||
raise ValueError("Calling invalid_url_error with valid URL {}".format(
|
||||
url.toDisplayString()))
|
||||
errstring = "Trying to {} with invalid URL".format(action)
|
||||
if url.errorString():
|
||||
errstring += " - {}".format(url.errorString())
|
||||
message.error(errstring)
|
||||
message.error(win_id, errstring)
|
||||
|
||||
|
||||
class FuzzyUrlError(Exception):
|
||||
|
@ -259,7 +259,7 @@ class TabbedBrowser(tabwidget.TabWidget):
|
||||
entry = UndoEntry(tab.cur_url, history_data)
|
||||
self._undo_stack.append(entry)
|
||||
else:
|
||||
urlutils.invalid_url_error(tab.cur_url, "saving tab")
|
||||
urlutils.invalid_url_error(self._win_id, tab.cur_url, "saving tab")
|
||||
return
|
||||
tab.shutdown()
|
||||
self.removeTab(idx)
|
||||
|
Loading…
Reference in New Issue
Block a user