parent
6f89ab628b
commit
9428338389
@ -911,12 +911,22 @@ class CommandDispatcher:
|
||||
cur.inspector.show()
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||
def download_page(self):
|
||||
"""Download the current page."""
|
||||
page = self._current_widget().page()
|
||||
def download(self, url=None, dest=None):
|
||||
"""Download a given URL, or current page if none given.
|
||||
|
||||
Args:
|
||||
url: The URL to download, or None to download current page.
|
||||
dest: The file path to write the download to, or None to ask.
|
||||
"""
|
||||
download_manager = objreg.get('download-manager', scope='window',
|
||||
window=self._win_id)
|
||||
download_manager.get(self._current_url(), page)
|
||||
if (url):
|
||||
url = urlutils.qurl_from_user_input(url)
|
||||
urlutils.raise_cmdexc_if_invalid(url)
|
||||
download_manager.get(url, filename=dest)
|
||||
else:
|
||||
page = self._current_widget().page()
|
||||
download_manager.get(self._current_url(), page)
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||
def view_source(self):
|
||||
|
@ -580,18 +580,6 @@ class DownloadManager(QAbstractListModel):
|
||||
self.questions.append(q)
|
||||
return q
|
||||
|
||||
@cmdutils.register(instance='download-manager', scope='window')
|
||||
def download(self, url, dest=None):
|
||||
"""Download a given URL, given as string.
|
||||
|
||||
Args:
|
||||
url: The URL to download
|
||||
dest: The file path to write the download to, or None to ask.
|
||||
"""
|
||||
url = urlutils.qurl_from_user_input(url)
|
||||
urlutils.raise_cmdexc_if_invalid(url)
|
||||
self.get(url, filename=dest)
|
||||
|
||||
@pyqtSlot('QUrl', 'QWebPage')
|
||||
def get(self, url, page=None, fileobj=None, filename=None,
|
||||
auto_remove=False):
|
||||
|
@ -1028,7 +1028,7 @@ KEY_DATA = collections.OrderedDict([
|
||||
('navigate increment', ['<Ctrl-A>']),
|
||||
('navigate decrement', ['<Ctrl-X>']),
|
||||
('inspector', ['wi']),
|
||||
('download-page', ['gd']),
|
||||
('download', ['gd']),
|
||||
('download-cancel', ['ad']),
|
||||
('view-source', ['gf']),
|
||||
('tab-focus last', ['<Ctrl-Tab>']),
|
||||
|
Loading…
Reference in New Issue
Block a user