Rename Tweak Book to Edit Book

This commit is contained in:
Kovid Goyal 2013-12-10 17:21:51 +05:30
parent 2b6529336b
commit 289ef5f0b9
13 changed files with 40 additions and 40 deletions

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -14,7 +14,7 @@ you just want greater control over the conversion system, |app| has a lot of
options to fine tune the conversion process. Note however that |app|'s options to fine tune the conversion process. Note however that |app|'s
conversion system is not a substitute for a full blown ebook editor. To edit conversion system is not a substitute for a full blown ebook editor. To edit
ebooks, I recommend first converting them to EPUB or AZW3 using |app| and ebooks, I recommend first converting them to EPUB or AZW3 using |app| and
then using the Tweak Book feature to get them into perfect shape. You can then then using the Edit Book feature to get them into perfect shape. You can then
use the edited ebook as input for conversion into other formats in |app|. use the edited ebook as input for conversion into other formats in |app|.
This document will refer mainly to the conversion settings as found in the This document will refer mainly to the conversion settings as found in the
@ -325,7 +325,7 @@ remove all non-breaking-space entities, or may include false positive matches re
tags, i.e. horizontal rules, and <img> tags are exceptions. Horizontal rules can optionally be specified with styles, if you tags, i.e. horizontal rules, and <img> tags are exceptions. Horizontal rules can optionally be specified with styles, if you
choose to add your own style be sure to include the 'width' setting, otherwise the style information will be discarded. Image choose to add your own style be sure to include the 'width' setting, otherwise the style information will be discarded. Image
tags can used, but |app| does not provide the ability to add the image during conversion, this must be done after the fact using tags can used, but |app| does not provide the ability to add the image during conversion, this must be done after the fact using
the 'Tweak Book' feature, or Sigil. the 'Edit Book' feature.
Example image tag (place the image within an 'Images' folder inside the epub after conversion): Example image tag (place the image within an 'Images' folder inside the epub after conversion):
<img style="width:10%" src="../Images/scenebreak.png" /> <img style="width:10%" src="../Images/scenebreak.png" />

View File

@ -30,7 +30,7 @@ machine = 'X64' if is64bit else 'X86'
DESCRIPTIONS = { DESCRIPTIONS = {
'calibre' : 'The main calibre program', 'calibre' : 'The main calibre program',
'ebook-viewer' : 'Viewer for all e-book formats', 'ebook-viewer' : 'Viewer for all e-book formats',
'ebook-tweak' : 'Edit e-books', 'ebook-edit' : 'Edit e-books',
'lrfviewer' : 'Viewer for LRF files', 'lrfviewer' : 'Viewer for LRF files',
'ebook-convert': 'Command line interface to the conversion/news download system', 'ebook-convert': 'Command line interface to the conversion/news download system',
'ebook-meta' : 'Command line interface for manipulating e-book metadata', 'ebook-meta' : 'Command line interface for manipulating e-book metadata',
@ -335,7 +335,7 @@ class Win32Freeze(Command, WixMixIn):
def embed_resources(self, module, desc=None, extra_data=None, def embed_resources(self, module, desc=None, extra_data=None,
product_description=None): product_description=None):
icon_base = self.j(self.src_root, 'icons') icon_base = self.j(self.src_root, 'icons')
icon_map = {'calibre':'library', 'ebook-viewer':'viewer', 'ebook-tweak':'ebook-tweak', icon_map = {'calibre':'library', 'ebook-viewer':'viewer', 'ebook-edit':'ebook-edit',
'lrfviewer':'viewer', 'calibre-portable':'library'} 'lrfviewer':'viewer', 'calibre-portable':'library'}
file_type = 'DLL' if module.endswith('.dll') else 'APP' file_type = 'DLL' if module.endswith('.dll') else 'APP'
template = open(self.rc_template, 'rb').read() template = open(self.rc_template, 'rb').read()

View File

@ -72,9 +72,9 @@
Description="Viewer for all the major e-book formats" Description="Viewer for all the major e-book formats"
Target="[#{exe_map[ebook-viewer]}]" Target="[#{exe_map[ebook-viewer]}]"
WorkingDirectory="APPLICATIONROOTDIRECTORY" /> WorkingDirectory="APPLICATIONROOTDIRECTORY" />
<Shortcut Id="s4" Name="E-book Tweak{x64}" <Shortcut Id="s4" Name="Edit E-book{x64}"
Description="Edit e-books" Description="Edit e-books"
Target="[#{exe_map[ebook-tweak]}]" Target="[#{exe_map[ebook-edit]}]"
WorkingDirectory="APPLICATIONROOTDIRECTORY" /> WorkingDirectory="APPLICATIONROOTDIRECTORY" />
<Shortcut Id="s3" Name="LRF viewer{x64}" <Shortcut Id="s3" Name="LRF viewer{x64}"
Description="Viewer for LRF format e-books" Description="Viewer for LRF format e-books"

View File

@ -905,7 +905,7 @@ class ActionCopyToLibrary(InterfaceActionBase):
class ActionTweakEpub(InterfaceActionBase): class ActionTweakEpub(InterfaceActionBase):
name = 'Tweak ePub' name = 'Tweak ePub'
actual_plugin = 'calibre.gui2.actions.tweak_epub:TweakEpubAction' actual_plugin = 'calibre.gui2.actions.tweak_epub:TweakEpubAction'
description = _('Make small tweaks to epub or htmlz files in your calibre library') description = _('Edit ebooks in the epub or azw3 formats')
class ActionUnpackBook(InterfaceActionBase): class ActionUnpackBook(InterfaceActionBase):
name = 'Unpack Book' name = 'Unpack Book'

View File

@ -671,7 +671,7 @@ class Cache(object):
''' '''
Return absolute path to the ebook file of format `format` Return absolute path to the ebook file of format `format`
Currently used only in calibredb list, the viewer, tweak book and the Currently used only in calibredb list, the viewer, edit book and the
catalogs (via get_data_as_dict()). catalogs (via get_data_as_dict()).
Apart from the viewer, I don't believe any of the others do any file Apart from the viewer, I don't believe any of the others do any file

View File

@ -20,7 +20,7 @@ this command starts an embedded python interpreter. You can also run the main
calibre GUI and the calibre viewer in debug mode. calibre GUI and the calibre viewer in debug mode.
It also contains interfaces to various bits of calibre that do not have It also contains interfaces to various bits of calibre that do not have
dedicated command line tools, such as font subsetting, tweaking ebooks and so dedicated command line tools, such as font subsetting, editing ebooks and so
on. on.
You can also use %prog to run standalone scripts. To do that use it like this: You can also use %prog to run standalone scripts. To do that use it like this:
@ -60,8 +60,8 @@ Everything after the -- is passed to the script.
parser.add_option('-m', '--inspect-mobi', action='store_true', parser.add_option('-m', '--inspect-mobi', action='store_true',
default=False, default=False,
help='Inspect the MOBI file(s) at the specified path(s)') help='Inspect the MOBI file(s) at the specified path(s)')
parser.add_option('-t', '--tweak-book', action='store_true', parser.add_option('-t', '--edit-book', action='store_true',
help='Launch the calibre Tweak Book tool in debug mode.') help='Launch the calibre Edit Book tool in debug mode.')
parser.add_option('-x', '--explode-book', default=None, parser.add_option('-x', '--explode-book', default=None,
help='Explode the book (exports the book as a collection of HTML ' help='Explode the book (exports the book as a collection of HTML '
'files and metadata, which you can edit using standard HTML ' 'files and metadata, which you can edit using standard HTML '
@ -250,9 +250,9 @@ def main(args=sys.argv):
elif opts.inspect_mobi: elif opts.inspect_mobi:
for path in args[1:]: for path in args[1:]:
inspect_mobi(path) inspect_mobi(path)
elif opts.tweak_book: elif opts.edit_book:
from calibre.gui2.tweak_book.main import main from calibre.gui2.tweak_book.main import main
main(['ebook-tweak'] + args[1:]) main(['ebook-edit'] + args[1:])
elif opts.explode_book: elif opts.explode_book:
from calibre.ebooks.tweak import tweak from calibre.ebooks.tweak import tweak
tweak(opts.explode_book) tweak(opts.explode_book)

View File

@ -19,10 +19,10 @@ class Choose(QDialog):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
self.l = l = QVBoxLayout(self) self.l = l = QVBoxLayout(self)
self.setLayout(l) self.setLayout(l)
self.setWindowTitle(_('Choose format to tweak')) self.setWindowTitle(_('Choose format to edit'))
self.la = la = QLabel(_( self.la = la = QLabel(_(
'This book has multiple formats that can be tweaked. Choose the format you want to tweak.')) 'This book has multiple formats that can be edited. Choose the format you want to edit.'))
l.addWidget(la) l.addWidget(la)
self.rem = QCheckBox(_('Always ask when more than one format is available')) self.rem = QCheckBox(_('Always ask when more than one format is available'))
@ -54,7 +54,7 @@ class Choose(QDialog):
class TweakEpubAction(InterfaceAction): class TweakEpubAction(InterfaceAction):
name = 'Tweak ePub' name = 'Tweak ePub'
action_spec = (_('Tweak Book'), 'tweak.png', _('Edit eBooks'), _('T')) action_spec = (_('Edit Book'), 'tweak.png', _('Edit eBooks'), _('T'))
dont_add_to = frozenset(['context-menu-device']) dont_add_to = frozenset(['context-menu-device'])
action_type = 'current' action_type = 'current'
@ -90,7 +90,7 @@ class TweakEpubAction(InterfaceAction):
def tweak_book(self): def tweak_book(self):
row = self.gui.library_view.currentIndex() row = self.gui.library_view.currentIndex()
if not row.isValid(): if not row.isValid():
return error_dialog(self.gui, _('Cannot Tweak Book'), return error_dialog(self.gui, _('Cannot Edit Book'),
_('No book selected'), show=True) _('No book selected'), show=True)
book_id = self.gui.library_view.model().id(row) book_id = self.gui.library_view.model().id(row)
@ -103,8 +103,8 @@ class TweakEpubAction(InterfaceAction):
fmts = [x.upper().strip() for x in fmts.split(',')] fmts = [x.upper().strip() for x in fmts.split(',')]
tweakable_fmts = set(fmts).intersection(SUPPORTED) tweakable_fmts = set(fmts).intersection(SUPPORTED)
if not tweakable_fmts: if not tweakable_fmts:
return error_dialog(self.gui, _('Cannot Tweak Book'), return error_dialog(self.gui, _('Cannot Edit Book'),
_('The book must be in the %s formats to tweak.' _('The book must be in the %s formats to edit.'
'\n\nFirst convert the book to one of these formats.') % (_(' or '.join(SUPPORTED))), '\n\nFirst convert the book to one of these formats.') % (_(' or '.join(SUPPORTED))),
show=True) show=True)
from calibre.gui2.tweak_book import tprefs from calibre.gui2.tweak_book import tprefs
@ -126,7 +126,7 @@ class TweakEpubAction(InterfaceAction):
return error_dialog(self.gui, _('File missing'), _( return error_dialog(self.gui, _('File missing'), _(
'The %s format is missing from the calibre library. You should run' 'The %s format is missing from the calibre library. You should run'
' library maintenance.') % fmt, show=True) ' library maintenance.') % fmt, show=True)
tweak = 'ebook-tweak' tweak = 'ebook-edit'
self.gui.setCursor(Qt.BusyCursor) self.gui.setCursor(Qt.BusyCursor)
if tprefs['update_metadata_from_calibre']: if tprefs['update_metadata_from_calibre']:
from calibre.ebooks.metadata.opf2 import pretty_print from calibre.ebooks.metadata.opf2 import pretty_print

View File

@ -16,11 +16,11 @@ from calibre.ptempfile import reset_base_dir
from calibre.utils.config import OptionParser from calibre.utils.config import OptionParser
def option_parser(): def option_parser():
parser = OptionParser('''\ parser = OptionParser(_('''\
%prog [opts] [path_to_ebook] %prog [opts] [path_to_ebook]
Launch the calibre tweak book tool. Launch the calibre edit book tool.
''') '''))
setup_gui_option_parser(parser) setup_gui_option_parser(parser)
parser.add_option('--edit-file', help=_( parser.add_option('--edit-file', help=_(
'Edit the named file inside the book')) 'Edit the named file inside the book'))
@ -42,7 +42,7 @@ def main(args=sys.argv):
opts, args = parser.parse_args(args) opts, args = parser.parse_args(args)
if getattr(opts, 'detach', False): if getattr(opts, 'detach', False):
detach_gui() detach_gui()
override = 'calibre-tweak-book' if islinux else None override = 'calibre-edit-book' if islinux else None
app = Application(args, override_program_name=override) app = Application(args, override_program_name=override)
app.load_builtin_fonts() app.load_builtin_fonts()
app.setWindowIcon(QIcon(I('tweak.png'))) app.setWindowIcon(QIcon(I('tweak.png')))

View File

@ -186,11 +186,11 @@ class IntegrationSettings(BasicSettings):
l.addRow(um) l.addRow(um)
ask = self('choose_tweak_fmt') ask = self('choose_tweak_fmt')
ask.setText(_('Ask which format to tweak if more than one format is available for the book')) ask.setText(_('Ask which format to edit if more than one format is available for the book'))
l.addRow(ask) l.addRow(ask)
order = self.order_widget('tweak_fmt_order') order = self.order_widget('tweak_fmt_order')
order.setToolTip(_('When auto-selecting the format to tweak for a book with' order.setToolTip(_('When auto-selecting the format to edit for a book with'
' multiple formats, this is the preference order.')) ' multiple formats, this is the preference order.'))
l.addRow(_('Preferred format order (drag and drop to change)'), order) l.addRow(_('Preferred format order (drag and drop to change)'), order)
@ -201,7 +201,7 @@ class Preferences(QDialog):
QDialog.__init__(self, gui) QDialog.__init__(self, gui)
self.l = l = QGridLayout(self) self.l = l = QGridLayout(self)
self.setLayout(l) self.setLayout(l)
self.setWindowTitle(_('Preferences for Tweak Book')) self.setWindowTitle(_('Preferences for Edit Book'))
self.setWindowIcon(QIcon(I('config.png'))) self.setWindowIcon(QIcon(I('config.png')))
self.stacks = QStackedWidget(self) self.stacks = QStackedWidget(self)

View File

@ -179,7 +179,7 @@ class CursorPositionWidget(QWidget):
class Main(MainWindow): class Main(MainWindow):
APP_NAME = _('Tweak Book') APP_NAME = _('Edit Book')
STATE_VERSION = 0 STATE_VERSION = 0
def __init__(self, opts): def __init__(self, opts):

View File

@ -37,7 +37,7 @@ entry_points = {
__appname__+' = calibre.gui2.main:main', __appname__+' = calibre.gui2.main:main',
'lrfviewer = calibre.gui2.lrf_renderer.main:main', 'lrfviewer = calibre.gui2.lrf_renderer.main:main',
'ebook-viewer = calibre.gui2.viewer.main:main', 'ebook-viewer = calibre.gui2.viewer.main:main',
'ebook-tweak = calibre.gui2.tweak_book.main:main', 'ebook-edit = calibre.gui2.tweak_book.main:main',
], ],
} }
@ -544,7 +544,7 @@ class PostInstall:
opf_opts=['--opf', '-o']) opf_opts=['--opf', '-o'])
o_and_e('lrfviewer', lrfviewerop, ['lrf']) o_and_e('lrfviewer', lrfviewerop, ['lrf'])
o_and_e('ebook-viewer', viewer_op, input_formats) o_and_e('ebook-viewer', viewer_op, input_formats)
o_and_e('ebook-tweak', tweak_op, tweak_formats) o_and_e('ebook-edit', tweak_op, tweak_formats)
o_and_w('fetch-ebook-metadata', fem_op, []) o_and_w('fetch-ebook-metadata', fem_op, [])
o_and_w('calibre-smtp', smtp_op, []) o_and_w('calibre-smtp', smtp_op, [])
o_and_w('calibre-server', serv_op, []) o_and_w('calibre-server', serv_op, [])
@ -681,9 +681,9 @@ class PostInstall:
render_img('viewer.png', 'calibre-viewer.png') render_img('viewer.png', 'calibre-viewer.png')
cc('xdg-icon-resource install --size 128 calibre-viewer.png calibre-viewer', shell=True) cc('xdg-icon-resource install --size 128 calibre-viewer.png calibre-viewer', shell=True)
self.icon_resources.append(('apps', 'calibre-viewer', '128')) self.icon_resources.append(('apps', 'calibre-viewer', '128'))
render_img('tweak.png', 'calibre-ebook-tweak.png') render_img('tweak.png', 'calibre-ebook-edit.png')
cc('xdg-icon-resource install --size 128 calibre-ebook-tweak.png calibre-ebook-tweak', shell=True) cc('xdg-icon-resource install --size 128 calibre-ebook-edit.png calibre-ebook-edit', shell=True)
self.icon_resources.append(('apps', 'calibre-ebook-tweak', '128')) self.icon_resources.append(('apps', 'calibre-ebook-edit', '128'))
mimetypes = set([]) mimetypes = set([])
for x in all_input_formats(): for x in all_input_formats():
@ -701,7 +701,7 @@ class PostInstall:
f = open('calibre-ebook-viewer.desktop', 'wb') f = open('calibre-ebook-viewer.desktop', 'wb')
f.write(EVIEWER) f.write(EVIEWER)
write_mimetypes(f) write_mimetypes(f)
f = open('calibre-ebook-tweak.desktop', 'wb') f = open('calibre-ebook-edit.desktop', 'wb')
f.write(ETWEAK) f.write(ETWEAK)
mt = [guess_type('a.' + x.lower())[0] for x in SUPPORTED] mt = [guess_type('a.' + x.lower())[0] for x in SUPPORTED]
f.write('MimeType=%s;\n'%';'.join(mt)) f.write('MimeType=%s;\n'%';'.join(mt))
@ -711,7 +711,7 @@ class PostInstall:
write_mimetypes(f) write_mimetypes(f)
f.close() f.close()
des = ('calibre-gui.desktop', 'calibre-lrfviewer.desktop', des = ('calibre-gui.desktop', 'calibre-lrfviewer.desktop',
'calibre-ebook-viewer.desktop', 'calibre-ebook-tweak.desktop') 'calibre-ebook-viewer.desktop', 'calibre-ebook-edit.desktop')
for x in des: for x in des:
cmd = ['xdg-desktop-menu', 'install', '--noupdate', './'+x] cmd = ['xdg-desktop-menu', 'install', '--noupdate', './'+x]
cc(' '.join(cmd), shell=True) cc(' '.join(cmd), shell=True)
@ -868,12 +868,12 @@ ETWEAK = '''\
[Desktop Entry] [Desktop Entry]
Version=1.0 Version=1.0
Type=Application Type=Application
Name=E-book Tweak Name=Edit E-book
GenericName=Edit E-books GenericName=Edit E-books
Comment=Edit e-books in various formats Comment=Edit e-books in various formats
TryExec=ebook-tweak TryExec=ebook-edit
Exec=ebook-tweak %f Exec=ebook-edit %f
Icon=calibre-ebook-tweak Icon=calibre-ebook-edit
Categories=Office; Categories=Office;
''' '''

View File

@ -25,7 +25,7 @@ PARALLEL_FUNCS = {
'ebook-viewer' : 'ebook-viewer' :
('calibre.gui2.viewer.main', 'main', None), ('calibre.gui2.viewer.main', 'main', None),
'ebook-tweak' : 'ebook-edit' :
('calibre.gui2.tweak_book.main', 'main', None), ('calibre.gui2.tweak_book.main', 'main', None),
'render_pages' : 'render_pages' :