home *** CD-ROM | disk | FTP | other *** search
Wrap
# Source Generated with Decompyle++ # File: in.pyc (Python 2.6) from __future__ import with_statement __license__ = 'GPL 3' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' from itertools import izip from xml.sax.saxutils import escape from calibre.customize import Plugin as _Plugin FONT_SIZES = [ ('xx-small', 1), ('x-small', None), ('small', 2), ('medium', 3), ('large', 4), ('x-large', 5), ('xx-large', 6), (None, 7)] class Plugin(_Plugin): fbase = 12 fsizes = [ 5, 7, 9, 12, 13.5, 17, 20, 22, 24] screen_size = (1600, 1200) dpi = 100 def __init__(self, *args, **kwargs): _Plugin.__init__(self, *args, **kwargs) (self.width, self.height) = self.screen_size fsizes = list(self.fsizes) self.fkey = list(self.fsizes) self.fsizes = [] for name, num in izip(FONT_SIZES, fsizes): size = None self.fsizes.append((name, num, float(size))) self.fnames = dict((lambda .0: for name, _, sz in .0: if name: (name, sz)continue)(self.fsizes)) self.fnums = dict((lambda .0: for _, num, sz in .0: if num: (num, sz)continue)(self.fsizes)) class InputProfile(Plugin): author = 'Kovid Goyal' supported_platforms = set([ 'windows', 'osx', 'linux']) can_be_disabled = False type = _('Input profile') name = 'Default Input Profile' short_name = 'default' description = _('This profile tries to provide sane defaults and is useful if you know nothing about the input document.') class SonyReaderInput(InputProfile): name = 'Sony Reader' short_name = 'sony' description = _('This profile is intended for the SONY PRS line. The 500/505/600/700 etc.') screen_size = (584, 754) dpi = 168.451 fbase = 12 fsizes = [ 7.5, 9, 10, 12, 15.5, 20, 22, 24] class SonyReader300Input(SonyReaderInput): name = 'Sony Reader 300' short_name = 'sony300' description = _('This profile is intended for the SONY PRS 300.') dpi = 200 class SonyReader900Input(SonyReaderInput): author = 'John Schember' name = 'Sony Reader 900' short_name = 'sony900' description = _('This profile is intended for the SONY PRS-900.') screen_size = (584, 978) class MSReaderInput(InputProfile): name = 'Microsoft Reader' short_name = 'msreader' description = _('This profile is intended for the Microsoft Reader.') screen_size = (480, 652) dpi = 96 fbase = 13 fsizes = [ 10, 11, 13, 16, 18, 20, 22, 26] class MobipocketInput(InputProfile): name = 'Mobipocket Books' short_name = 'mobipocket' description = _('This profile is intended for the Mobipocket books.') screen_size = (600, 800) dpi = 96 fbase = 18 fsizes = [ 14, 14, 16, 18, 20, 22, 24, 26] class HanlinV3Input(InputProfile): name = 'Hanlin V3' short_name = 'hanlinv3' description = _('This profile is intended for the Hanlin V3 and its clones.') screen_size = (584, 754) dpi = 168.451 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] class HanlinV5Input(HanlinV3Input): name = 'Hanlin V5' short_name = 'hanlinv5' description = _('This profile is intended for the Hanlin V5 and its clones.') screen_size = (584, 754) dpi = 200 class CybookG3Input(InputProfile): name = 'Cybook G3' short_name = 'cybookg3' description = _('This profile is intended for the Cybook G3.') screen_size = (600, 800) dpi = 168.451 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] class CybookOpusInput(InputProfile): author = 'John Schember' name = 'Cybook Opus' short_name = 'cybook_opus' description = _('This profile is intended for the Cybook Opus.') screen_size = (600, 800) dpi = 200 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] class KindleInput(InputProfile): name = 'Kindle' short_name = 'kindle' description = _('This profile is intended for the Amazon Kindle.') screen_size = (525, 640) dpi = 168.451 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] class IlliadInput(InputProfile): name = 'Illiad' short_name = 'illiad' description = _('This profile is intended for the Irex Illiad.') screen_size = (760, 925) dpi = 160 fbase = 12 fsizes = [ 7.5, 9, 10, 12, 15.5, 20, 22, 24] class IRexDR1000Input(InputProfile): author = 'John Schember' name = 'IRex Digital Reader 1000' short_name = 'irexdr1000' description = _('This profile is intended for the IRex Digital Reader 1000.') screen_size = (1024, 1280) dpi = 160 fbase = 16 fsizes = [ 12, 14, 16, 18, 20, 22, 24] class IRexDR800Input(InputProfile): author = 'Eric Cronin' name = 'IRex Digital Reader 800' short_name = 'irexdr800' description = _('This profile is intended for the IRex Digital Reader 800.') screen_size = (768, 1024) dpi = 160 fbase = 16 fsizes = [ 12, 14, 16, 18, 20, 22, 24] class NookInput(InputProfile): author = 'John Schember' name = 'Nook' short_name = 'nook' description = _('This profile is intended for the B&N Nook.') screen_size = (600, 800) dpi = 167 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] input_profiles = [ InputProfile, SonyReaderInput, SonyReader300Input, SonyReader900Input, MSReaderInput, MobipocketInput, HanlinV3Input, HanlinV5Input, CybookG3Input, CybookOpusInput, KindleInput, IlliadInput, IRexDR1000Input, IRexDR800Input, NookInput] input_profiles.sort(cmp = (lambda x, y: cmp(x.name.lower(), y.name.lower()))) class OutputProfile(Plugin): author = 'Kovid Goyal' supported_platforms = set([ 'windows', 'osx', 'linux']) can_be_disabled = False type = _('Output profile') name = 'Default Output Profile' short_name = 'default' description = _('This profile tries to provide sane defaults and is useful if you want to produce a document intended to be read at a computer or on a range of devices.') comic_screen_size = (584, 754) supports_mobi_indexing = False touchscreen = False touchscreen_news_css = '' extra_css_modules = [] periodical_date_in_title = True def tags_to_string(cls, tags): return escape(', '.join(tags)) tags_to_string = classmethod(tags_to_string) class iPadOutput(OutputProfile): name = 'iPad' short_name = 'ipad' description = _('Intended for the iPad and similar devices with a resolution of 768x1024') screen_size = (768, 1024) comic_screen_size = (768, 1024) dpi = 132 extra_css_modules = [ { 'name': 'webkit', 'props': { '-webkit-border-bottom-left-radius': '{length}', '-webkit-border-bottom-right-radius': '{length}', '-webkit-border-top-left-radius': '{length}', '-webkit-border-top-right-radius': '{length}', '-webkit-border-radius': '{border-width}(\\s+{border-width}){0,3}|inherit' }, 'macros': { 'border-width': '{length}|medium|thick|thin' } }] touchscreen = True touchscreen_news_css = u'\n\t\t\t/* hr used in articles */\n\t\t\t.article_articles_list {\n width:18%;\n\t\t\t\t}\n .article_link {\n \tcolor: #593f29;\n font-style: italic;\n }\n .article_next {\n\t\t\t\t-webkit-border-top-right-radius:4px;\n\t\t\t\t-webkit-border-bottom-right-radius:4px;\n font-style: italic;\n width:32%;\n }\n\n .article_prev {\n\t\t\t\t-webkit-border-top-left-radius:4px;\n\t\t\t\t-webkit-border-bottom-left-radius:4px;\n font-style: italic;\n width:32%;\n }\n\t\t\t.article_sections_list {\n width:18%;\n\t\t\t\t}\n .articles_link {\n font-weight: bold;\n }\n .sections_link {\n font-weight: bold;\n }\n\n\n .caption_divider {\n \tborder:#ccc 1px solid;\n\t\t\t\t}\n\n .touchscreen_navbar {\n background:#c3bab2;\n border:#ccc 0px solid;\n border-collapse:separate;\n border-spacing:1px;\n margin-left: 5%;\n margin-right: 5%;\n width: 90%;\n -webkit-border-radius:4px;\n }\n .touchscreen_navbar td {\n background:#fff;\n font-family:Helvetica;\n font-size:80%;\n /* UI touchboxes use 8px padding */\n padding: 6px;\n text-align:center;\n }\n\n\t\t\t.touchscreen_navbar td a:link {\n\t\t\t\tcolor: #593f29;\n\t\t\t\ttext-decoration: none;\n\t\t\t\t}\n\n\t\t\t/* Index formatting */\n\t\t\t.publish_date {\n\t\t\t\ttext-align:center;\n\t\t\t\t}\n\t\t\t.divider {\n\t\t\t\tborder-bottom:1em solid white;\n\t\t\t\tborder-top:1px solid gray;\n\t\t\t\t}\n\n\t\t\thr.caption_divider {\n\t\t\t\tborder-color:black;\n\t\t\t\tborder-style:solid;\n\t\t\t\tborder-width:1px;\n\t\t\t\t}\n\n /* Feed summary formatting */\n .article_summary {\n \tdisplay:inline-block;\n \t}\n .feed {\n font-family:sans-serif;\n font-weight:bold;\n font-size:larger;\n\t\t\t\t}\n\n .feed_link {\n font-style: italic;\n }\n\n .feed_next {\n\t\t\t\t-webkit-border-top-right-radius:4px;\n\t\t\t\t-webkit-border-bottom-right-radius:4px;\n font-style: italic;\n width:40%;\n }\n\n .feed_prev {\n\t\t\t\t-webkit-border-top-left-radius:4px;\n\t\t\t\t-webkit-border-bottom-left-radius:4px;\n font-style: italic;\n width:40%;\n }\n\n .feed_title {\n text-align: center;\n font-size: 160%;\n }\n\n\t\t\t.feed_up {\n font-weight: bold;\n width:20%;\n\t\t\t\t}\n\n .summary_headline {\n font-weight:bold;\n text-align:left;\n\t\t\t\t}\n\n .summary_byline {\n text-align:left;\n font-family:monospace;\n\t\t\t\t}\n\n .summary_text {\n text-align:left;\n\t\t\t\t}\n\n ' class SonyReaderOutput(OutputProfile): name = 'Sony Reader' short_name = 'sony' description = _('This profile is intended for the SONY PRS line. The 500/505/600/700 etc.') screen_size = (590, 775) dpi = 168.451 fbase = 12 fsizes = [ 7.5, 9, 10, 12, 15.5, 20, 22, 24] class KoboReaderOutput(OutputProfile): name = 'Kobo Reader' short_name = 'kobo' description = _('This profile is intended for the Kobo Reader.') screen_size = (590, 775) comic_screen_size = (540, 718) dpi = 168.451 fbase = 12 fsizes = [ 7.5, 9, 10, 12, 15.5, 20, 22, 24] class SonyReader300Output(SonyReaderOutput): author = 'John Schember' name = 'Sony Reader 300' short_name = 'sony300' description = _('This profile is intended for the SONY PRS-300.') dpi = 200 class SonyReader900Output(SonyReaderOutput): author = 'John Schember' name = 'Sony Reader 900' short_name = 'sony900' description = _('This profile is intended for the SONY PRS-900.') screen_size = (600, 999) comic_screen_size = screen_size class JetBook5Output(OutputProfile): name = 'JetBook 5-inch' short_name = 'jetbook5' description = _('This profile is intended for the 5-inch JetBook.') screen_size = (480, 640) dpi = 168.451 class SonyReaderLandscapeOutput(SonyReaderOutput): name = 'Sony Reader Landscape' short_name = 'sony-landscape' description = _('This profile is intended for the SONY PRS line. The 500/505/700 etc, in landscape mode. Mainly useful for comics.') screen_size = (784, 1012) comic_screen_size = (784, 1012) class MSReaderOutput(OutputProfile): name = 'Microsoft Reader' short_name = 'msreader' description = _('This profile is intended for the Microsoft Reader.') screen_size = (480, 652) dpi = 96 fbase = 13 fsizes = [ 10, 11, 13, 16, 18, 20, 22, 26] class MobipocketOutput(OutputProfile): name = 'Mobipocket Books' short_name = 'mobipocket' description = _('This profile is intended for the Mobipocket books.') screen_size = (600, 800) dpi = 96 fbase = 18 fsizes = [ 14, 14, 16, 18, 20, 22, 24, 26] class HanlinV3Output(OutputProfile): name = 'Hanlin V3' short_name = 'hanlinv3' description = _('This profile is intended for the Hanlin V3 and its clones.') screen_size = (584, 754) dpi = 168.451 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] class HanlinV5Output(HanlinV3Output): name = 'Hanlin V5' short_name = 'hanlinv5' description = _('This profile is intended for the Hanlin V5 and its clones.') dpi = 200 class CybookG3Output(OutputProfile): name = 'Cybook G3' short_name = 'cybookg3' description = _('This profile is intended for the Cybook G3.') screen_size = (600, 800) dpi = 168.451 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] class CybookOpusOutput(SonyReaderOutput): author = 'John Schember' name = 'Cybook Opus' short_name = 'cybook_opus' description = _('This profile is intended for the Cybook Opus.') dpi = 200 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] class KindleOutput(OutputProfile): name = 'Kindle' short_name = 'kindle' description = _('This profile is intended for the Amazon Kindle.') screen_size = (525, 640) dpi = 168.451 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] supports_mobi_indexing = True periodical_date_in_title = False def tags_to_string(cls, tags): return u'%s <br/><span style="color: white">%s</span>' % (', '.join(tags), 'ttt '.join(tags) + 'ttt ') tags_to_string = classmethod(tags_to_string) class KindleDXOutput(OutputProfile): name = 'Kindle DX' short_name = 'kindle_dx' description = _('This profile is intended for the Amazon Kindle DX.') screen_size = (744, 1022) dpi = 150 comic_screen_size = (741, 1022) supports_mobi_indexing = True periodical_date_in_title = False def tags_to_string(cls, tags): return u'%s <br/><span style="color: white">%s</span>' % (', '.join(tags), 'ttt '.join(tags) + 'ttt ') tags_to_string = classmethod(tags_to_string) class IlliadOutput(OutputProfile): name = 'Illiad' short_name = 'illiad' description = _('This profile is intended for the Irex Illiad.') screen_size = (760, 925) comic_screen_size = (760, 925) dpi = 160 fbase = 12 fsizes = [ 7.5, 9, 10, 12, 15.5, 20, 22, 24] class IRexDR1000Output(OutputProfile): author = 'John Schember' name = 'IRex Digital Reader 1000' short_name = 'irexdr1000' description = _('This profile is intended for the IRex Digital Reader 1000.') screen_size = (1024, 1280) comic_screen_size = (996, 1241) dpi = 160 fbase = 16 fsizes = [ 12, 14, 16, 18, 20, 22, 24] class IRexDR800Output(OutputProfile): author = 'Eric Cronin' name = 'IRex Digital Reader 800' short_name = 'irexdr800' description = _('This profile is intended for the IRex Digital Reader 800.') screen_size = (768, 1024) comic_screen_size = (768, 1024) dpi = 160 fbase = 16 fsizes = [ 12, 14, 16, 18, 20, 22, 24] class NookOutput(OutputProfile): author = 'John Schember' name = 'Nook' short_name = 'nook' description = _('This profile is intended for the B&N Nook.') screen_size = (600, 730) comic_screen_size = (584, 730) dpi = 167 fbase = 16 fsizes = [ 12, 12, 14, 16, 18, 20, 22, 24] output_profiles = [ OutputProfile, SonyReaderOutput, SonyReader300Output, SonyReader900Output, MSReaderOutput, MobipocketOutput, HanlinV3Output, HanlinV5Output, CybookG3Output, CybookOpusOutput, KindleOutput, iPadOutput, KoboReaderOutput, SonyReaderLandscapeOutput, KindleDXOutput, IlliadOutput, IRexDR1000Output, IRexDR800Output, JetBook5Output, NookOutput] output_profiles.sort(cmp = (lambda x, y: cmp(x.name.lower(), y.name.lower())))