Fix #1643228 [UnboundLocalError while creating icon theme](https://bugs.launchpad.net/calibre/+bug/1643228)

This commit is contained in:
Kovid Goyal 2016-11-20 08:47:00 +05:30
parent ba786a2de1
commit 67709b515a

View File

@ -18,6 +18,7 @@ HELPER = os.path.join(base, 'calibre-file-dialog.exe')
def is_ok(): def is_ok():
return os.path.exists(HELPER) return os.path.exists(HELPER)
try: try:
from calibre.constants import filesystem_encoding from calibre.constants import filesystem_encoding
from calibre.utils.filenames import expanduser from calibre.utils.filenames import expanduser
@ -266,7 +267,7 @@ def choose_save_file(window, name, title, filters=[], all_files=True, initial_pa
if all_files: if all_files:
file_types.append((_('All files'), ['*'])) file_types.append((_('All files'), ['*']))
all_exts = [] all_exts = []
for _, exts in file_types: for ftext, exts in file_types:
for ext in exts: for ext in exts:
if '*' not in ext: if '*' not in ext:
all_exts.append(ext.lower()) all_exts.append(ext.lower())
@ -355,5 +356,7 @@ def test(helper=HELPER):
if q != echo: if q != echo:
raise RuntimeError('Unexpected response: %r' % server.data) raise RuntimeError('Unexpected response: %r' % server.data)
if __name__ == '__main__': if __name__ == '__main__':
choose_save_file(None, 'xxx', 'yyy')
test(sys.argv[-1]) test(sys.argv[-1])