mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
ebook-edit: Allow specifying multiple internal files to open and get rid of the unneeded --edit-file option.
This commit is contained in:
parent
f5345785f7
commit
e20fedd52a
@ -230,7 +230,7 @@ class Boss(QObject):
|
||||
'''
|
||||
Open the ebook at ``path`` for editing. Will show an error if the ebook is not in a supported format or the current book has unsaved changes.
|
||||
|
||||
:param edit_file: The name of a file inside the newly openend book to start editing.
|
||||
:param edit_file: The name of a file inside the newly openend book to start editing. Can also be a list of names.
|
||||
'''
|
||||
if not self._check_before_open():
|
||||
return
|
||||
@ -308,7 +308,9 @@ class Boss(QObject):
|
||||
tprefs['recent-books'] = recent_books[:10]
|
||||
self.gui.update_recent_books()
|
||||
if ef:
|
||||
self.gui.file_list.request_edit(ef)
|
||||
if isinstance(ef, type('')):
|
||||
ef = [ef]
|
||||
map(self.gui.file_list.request_edit, ef)
|
||||
self.gui.toc_view.update_if_visible()
|
||||
self.add_savepoint(_('Start of editing session'))
|
||||
|
||||
|
@ -17,13 +17,12 @@ from calibre.utils.config import OptionParser
|
||||
|
||||
def option_parser():
|
||||
parser = OptionParser(_('''\
|
||||
%prog [opts] [path_to_ebook]
|
||||
%prog [opts] [path_to_ebook] [name_of_file_inside_book ...]
|
||||
|
||||
Launch the calibre edit book tool.
|
||||
Launch the calibre edit book tool. You can optionally also specify the names of
|
||||
files inside the book which will be opened for editing automatically.
|
||||
'''))
|
||||
setup_gui_option_parser(parser)
|
||||
parser.add_option('--edit-file', help=_(
|
||||
'Edit the named file inside the book'))
|
||||
return parser
|
||||
|
||||
def gui_main(path=None, notify=None):
|
||||
@ -65,7 +64,7 @@ def _run(args, notify=None):
|
||||
sys.excepthook = main.unhandled_exception
|
||||
main.show()
|
||||
if len(args) > 1:
|
||||
main.boss.open_book(args[1], edit_file=opts.edit_file, clear_notify_data=False)
|
||||
main.boss.open_book(args[1], edit_file=args[2:], clear_notify_data=False)
|
||||
app.exec_()
|
||||
# Ensure that the parse worker has quit so that temp files can be deleted
|
||||
# on windows
|
||||
|
Loading…
x
Reference in New Issue
Block a user