Make _path_suggestion public

This commit is contained in:
Daniel 2015-09-24 12:38:52 +02:00
parent f58f6f24ee
commit 8593144fa7
2 changed files with 5 additions and 7 deletions

View File

@ -37,14 +37,12 @@ import pygments.formatters
from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners
from qutebrowser.config import config, configexc from qutebrowser.config import config, configexc
from qutebrowser.browser import webelem, inspector, urlmarks from qutebrowser.browser import webelem, inspector, urlmarks, downloads
from qutebrowser.keyinput import modeman from qutebrowser.keyinput import modeman
from qutebrowser.utils import (message, usertypes, log, qtutils, urlutils, from qutebrowser.utils import (message, usertypes, log, qtutils, urlutils,
objreg, utils) objreg, utils)
from qutebrowser.utils.usertypes import KeyMode from qutebrowser.utils.usertypes import KeyMode
from qutebrowser.misc import editor, guiprocess, mhtml from qutebrowser.misc import editor, guiprocess, mhtml
from qutebrowser.browser.downloads import (_path_suggestion as
download_path_suggestion)
class CommandDispatcher: class CommandDispatcher:
@ -1172,7 +1170,7 @@ class CommandDispatcher:
q.text = "Save page to: " q.text = "Save page to: "
q.mode = usertypes.PromptMode.text q.mode = usertypes.PromptMode.text
q.completed.connect(q.deleteLater) q.completed.connect(q.deleteLater)
q.default = download_path_suggestion(suggested_fn) q.default = downloads.path_suggestion(suggested_fn)
q.answered.connect(mhtml.start_download) q.answered.connect(mhtml.start_download)
message_bridge = objreg.get("message-bridge", scope="window", message_bridge = objreg.get("message-bridge", scope="window",
window=self._win_id) window=self._win_id)

View File

@ -70,7 +70,7 @@ def _download_dir():
return directory return directory
def _path_suggestion(filename): def path_suggestion(filename):
"""Get the suggested file path. """Get the suggested file path.
Args: Args:
@ -750,7 +750,7 @@ class DownloadManager(QAbstractListModel):
suggested_fn = utils.force_encoding(suggested_fn, encoding) suggested_fn = utils.force_encoding(suggested_fn, encoding)
q = self._prepare_question() q = self._prepare_question()
q.default = _path_suggestion(suggested_fn) q.default = path_suggestion(suggested_fn)
message_bridge = objreg.get('message-bridge', scope='window', message_bridge = objreg.get('message-bridge', scope='window',
window=self._win_id) window=self._win_id)
q.answered.connect( q.answered.connect(
@ -839,7 +839,7 @@ class DownloadManager(QAbstractListModel):
download.autoclose = False download.autoclose = False
else: else:
q = self._prepare_question() q = self._prepare_question()
q.default = _path_suggestion(suggested_filename) q.default = path_suggestion(suggested_filename)
q.answered.connect(download.set_filename) q.answered.connect(download.set_filename)
q.cancelled.connect(download.cancel) q.cancelled.connect(download.cancel)
download.cancelled.connect(q.abort) download.cancelled.connect(q.abort)