mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add prs500-unsafe profile.
This commit is contained in:
parent
78d9a58f5c
commit
a050a683c1
@ -49,13 +49,24 @@ class PRS500_PROFILE(object):
|
|||||||
default_fonts = { 'sans': "Swis721 BT Roman", 'mono': "Courier10 BT Roman",
|
default_fonts = { 'sans': "Swis721 BT Roman", 'mono': "Courier10 BT Roman",
|
||||||
'serif': "Dutch801 Rm BT Roman"}
|
'serif': "Dutch801 Rm BT Roman"}
|
||||||
|
|
||||||
|
name = 'prs500'
|
||||||
|
|
||||||
|
class PRS500_PROFILE_UNSAFE(PRS500_PROFILE):
|
||||||
|
fudge = 0
|
||||||
|
name = 'prs500-unsafe'
|
||||||
|
|
||||||
|
|
||||||
|
profile_map = {
|
||||||
|
PRS500_PROFILE.name : PRS500_PROFILE,
|
||||||
|
PRS500_PROFILE_UNSAFE.name : PRS500_PROFILE_UNSAFE,
|
||||||
|
}
|
||||||
|
|
||||||
def profile_from_string(option, opt_str, value, parser):
|
def profile_from_string(option, opt_str, value, parser):
|
||||||
if value == 'prs500':
|
try:
|
||||||
setattr(parser.values, option.dest, PRS500_PROFILE)
|
profile = profile_map[value]
|
||||||
else:
|
setattr(parser.values, option.dest, profile)
|
||||||
raise OptionValueError('Profile: '+value+' is not implemented')
|
except KeyError:
|
||||||
|
raise OptionValueError('Profile: '+value+' is not implemented. Implemented profiles: %s'%(profile_map.keys()))
|
||||||
|
|
||||||
def font_family(option, opt_str, value, parser):
|
def font_family(option, opt_str, value, parser):
|
||||||
if value:
|
if value:
|
||||||
@ -91,7 +102,7 @@ def option_parser(usage):
|
|||||||
help='Publisher')
|
help='Publisher')
|
||||||
metadata.add_option('--cover', action='store', dest='cover', default=None, \
|
metadata.add_option('--cover', action='store', dest='cover', default=None, \
|
||||||
help='Path to file containing image to be used as cover')
|
help='Path to file containing image to be used as cover')
|
||||||
profiles=['prs500']
|
|
||||||
parser.add_option('-o', '--output', action='store', default=None, \
|
parser.add_option('-o', '--output', action='store', default=None, \
|
||||||
help='Output file name. Default is derived from input filename')
|
help='Output file name. Default is derived from input filename')
|
||||||
parser.add_option('--ignore-tables', action='store_true', default=False, dest='ignore_tables',
|
parser.add_option('--ignore-tables', action='store_true', default=False, dest='ignore_tables',
|
||||||
@ -114,12 +125,13 @@ def option_parser(usage):
|
|||||||
help='Set the format of the header. %a is replaced by the author and %t by the title. Default is %default')
|
help='Set the format of the header. %a is replaced by the author and %t by the title. Default is %default')
|
||||||
|
|
||||||
page = parser.add_option_group('PAGE OPTIONS')
|
page = parser.add_option_group('PAGE OPTIONS')
|
||||||
|
profiles = profile_map.keys()
|
||||||
page.add_option('-p', '--profile', default=PRS500_PROFILE, dest='profile', type='choice',
|
page.add_option('-p', '--profile', default=PRS500_PROFILE, dest='profile', type='choice',
|
||||||
choices=profiles, action='callback', callback=profile_from_string,
|
choices=profiles, action='callback', callback=profile_from_string,
|
||||||
help='''Profile of the target device for which this LRF is '''
|
help='''Profile of the target device for which this LRF is '''
|
||||||
'''being generated. The profile determines things like the '''
|
'''being generated. The profile determines things like the '''
|
||||||
'''resolution and screen size of the target device. '''
|
'''resolution and screen size of the target device. '''
|
||||||
'''Default: ''' + profiles[0] + ''' Supported profiles: '''+\
|
'''Default: %s Supported profiles: '''%(PRS500_PROFILE.name,)+\
|
||||||
', '.join(profiles))
|
', '.join(profiles))
|
||||||
page.add_option('--left-margin', default=20, dest='left_margin', type='int',
|
page.add_option('--left-margin', default=20, dest='left_margin', type='int',
|
||||||
help='''Left margin of page. Default is %default px.''')
|
help='''Left margin of page. Default is %default px.''')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user