Style fixes.

This commit is contained in:
Joel Torstensson 2015-03-03 18:48:27 +01:00
parent 8e0c1cff7b
commit 68774a2c75
3 changed files with 8 additions and 6 deletions

View File

@ -289,7 +289,7 @@ class DownloadItem(QObject):
download_dir = config.get('storage', 'download-directory')
if download_dir is None:
download_dir = standarddir.get(QStandardPaths.DownloadLocation)
return download_dir + os.sep
return download_dir
def _die(self, msg):
"""Abort the download and emit an error."""
@ -375,11 +375,13 @@ class DownloadItem(QObject):
"""Get the suggestion of file path"""
suggestion = config.get('completion', 'download-path-suggestion')
if suggestion == 'path':
return self._download_dir()
return self._download_dir() + os.sep
elif suggestion == 'filename':
return self.basename
else:
elif suggestion == 'both':
return os.path.join(self._download_dir(), self.basename)
else:
raise ValueError("Invalid suggestion value {}!".format(suggestion))
def delete(self):
"""Delete the downloaded file"""

View File

@ -306,8 +306,8 @@ DATA = collections.OrderedDict([
('completion', sect.KeyValue(
('download-path-suggestion',
SettingValue(typ.DownloadPath(), 'path'),
"What to show in the suggestion for the download question."),
SettingValue(typ.DownloadPathSuggestion(), 'path'),
"What to display in the download filename input."),
('show',
SettingValue(typ.Bool(), 'true'),

View File

@ -1416,7 +1416,7 @@ class NewInstanceOpenTarget(BaseType):
('window', "Open in a new window."))
class DownloadPath(BaseType):
class DownloadPathSuggestion(BaseType):
"""How to format the question when downloading."""