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.
|
page: The QWebPage to get the download from.
|
||||||
"""
|
"""
|
||||||
if not url.isValid():
|
if not url.isValid():
|
||||||
urlutils.invalid_url_error(url, "start download")
|
urlutils.invalid_url_error('current', url, "start download")
|
||||||
return
|
return
|
||||||
req = QNetworkRequest(url)
|
req = QNetworkRequest(url)
|
||||||
reply = page.networkAccessManager().get(req)
|
reply = page.networkAccessManager().get(req)
|
||||||
|
@ -66,7 +66,7 @@ def prompt_save(win_id, url):
|
|||||||
url: The quickmark url as a QUrl.
|
url: The quickmark url as a QUrl.
|
||||||
"""
|
"""
|
||||||
if not url.isValid():
|
if not url.isValid():
|
||||||
urlutils.invalid_url_error(url, "save quickmark")
|
urlutils.invalid_url_error(win_id, url, "save quickmark")
|
||||||
return
|
return
|
||||||
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
urlstr = url.toString(QUrl.RemovePassword | QUrl.FullyEncoded)
|
||||||
message.ask_async(win_id, "Add quickmark:", usertypes.PromptMode.text,
|
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))
|
return QUrl('http://[{}]{}'.format(ipstr, rest))
|
||||||
|
|
||||||
|
|
||||||
def invalid_url_error(url, action):
|
def invalid_url_error(win_id, url, action):
|
||||||
"""Display an error message for an URL."""
|
"""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():
|
if url.isValid():
|
||||||
raise ValueError("Calling invalid_url_error with valid URL {}".format(
|
raise ValueError("Calling invalid_url_error with valid URL {}".format(
|
||||||
url.toDisplayString()))
|
url.toDisplayString()))
|
||||||
errstring = "Trying to {} with invalid URL".format(action)
|
errstring = "Trying to {} with invalid URL".format(action)
|
||||||
if url.errorString():
|
if url.errorString():
|
||||||
errstring += " - {}".format(url.errorString())
|
errstring += " - {}".format(url.errorString())
|
||||||
message.error(errstring)
|
message.error(win_id, errstring)
|
||||||
|
|
||||||
|
|
||||||
class FuzzyUrlError(Exception):
|
class FuzzyUrlError(Exception):
|
||||||
|
@ -259,7 +259,7 @@ class TabbedBrowser(tabwidget.TabWidget):
|
|||||||
entry = UndoEntry(tab.cur_url, history_data)
|
entry = UndoEntry(tab.cur_url, history_data)
|
||||||
self._undo_stack.append(entry)
|
self._undo_stack.append(entry)
|
||||||
else:
|
else:
|
||||||
urlutils.invalid_url_error(tab.cur_url, "saving tab")
|
urlutils.invalid_url_error(self._win_id, tab.cur_url, "saving tab")
|
||||||
return
|
return
|
||||||
tab.shutdown()
|
tab.shutdown()
|
||||||
self.removeTab(idx)
|
self.removeTab(idx)
|
||||||
|
Loading…
Reference in New Issue
Block a user