mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Workaround broken file chooser dialog on Ubuntu that does not auto-insert the specified extension. Fixes #1275125 [Edit book: cannot create new empty book when extension is not specified in the file](https://bugs.launchpad.net/calibre/+bug/1275125)
This commit is contained in:
parent
42b8155440
commit
3b1d24a907
@ -156,10 +156,12 @@ class Boss(QObject):
|
|||||||
return
|
return
|
||||||
d = NewBook(self.gui)
|
d = NewBook(self.gui)
|
||||||
if d.exec_() == d.Accepted:
|
if d.exec_() == d.Accepted:
|
||||||
fmt = d.fmt
|
fmt = d.fmt.lower()
|
||||||
path = choose_save_file(self.gui, 'edit-book-new-book', _('Choose file location'),
|
path = choose_save_file(self.gui, 'edit-book-new-book', _('Choose file location'),
|
||||||
filters=[(fmt.upper(), (fmt,))], all_files=False)
|
filters=[(fmt.upper(), (fmt,))], all_files=False)
|
||||||
if path is not None:
|
if path is not None:
|
||||||
|
if not path.lower().endswith('.' + fmt):
|
||||||
|
path = path + '.' + fmt
|
||||||
from calibre.ebooks.oeb.polish.create import create_book
|
from calibre.ebooks.oeb.polish.create import create_book
|
||||||
create_book(d.mi, path, fmt=fmt)
|
create_book(d.mi, path, fmt=fmt)
|
||||||
self.open_book(path=path)
|
self.open_book(path=path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user