home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_720 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  22.4 KB  |  660 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from __future__ import with_statement
  5. __license__ = 'GPL 3'
  6. __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
  7. __docformat__ = 'restructuredtext en'
  8. from itertools import izip
  9. from xml.sax.saxutils import escape
  10. from calibre.customize import Plugin as _Plugin
  11. FONT_SIZES = [
  12.     ('xx-small', 1),
  13.     ('x-small', None),
  14.     ('small', 2),
  15.     ('medium', 3),
  16.     ('large', 4),
  17.     ('x-large', 5),
  18.     ('xx-large', 6),
  19.     (None, 7)]
  20.  
  21. class Plugin(_Plugin):
  22.     fbase = 12
  23.     fsizes = [
  24.         5,
  25.         7,
  26.         9,
  27.         12,
  28.         13.5,
  29.         17,
  30.         20,
  31.         22,
  32.         24]
  33.     screen_size = (1600, 1200)
  34.     dpi = 100
  35.     
  36.     def __init__(self, *args, **kwargs):
  37.         _Plugin.__init__(self, *args, **kwargs)
  38.         (self.width, self.height) = self.screen_size
  39.         fsizes = list(self.fsizes)
  40.         self.fkey = list(self.fsizes)
  41.         self.fsizes = []
  42.         for name, num in izip(FONT_SIZES, fsizes):
  43.             size = None
  44.             self.fsizes.append((name, num, float(size)))
  45.         
  46.         self.fnames = dict((lambda .0: for name, _, sz in .0:
  47. if name:
  48. (name, sz)continue)(self.fsizes))
  49.         self.fnums = dict((lambda .0: for _, num, sz in .0:
  50. if num:
  51. (num, sz)continue)(self.fsizes))
  52.  
  53.  
  54.  
  55. class InputProfile(Plugin):
  56.     author = 'Kovid Goyal'
  57.     supported_platforms = set([
  58.         'windows',
  59.         'osx',
  60.         'linux'])
  61.     can_be_disabled = False
  62.     type = _('Input profile')
  63.     name = 'Default Input Profile'
  64.     short_name = 'default'
  65.     description = _('This profile tries to provide sane defaults and is useful if you know nothing about the input document.')
  66.  
  67.  
  68. class SonyReaderInput(InputProfile):
  69.     name = 'Sony Reader'
  70.     short_name = 'sony'
  71.     description = _('This profile is intended for the SONY PRS line. The 500/505/600/700 etc.')
  72.     screen_size = (584, 754)
  73.     dpi = 168.451
  74.     fbase = 12
  75.     fsizes = [
  76.         7.5,
  77.         9,
  78.         10,
  79.         12,
  80.         15.5,
  81.         20,
  82.         22,
  83.         24]
  84.  
  85.  
  86. class SonyReader300Input(SonyReaderInput):
  87.     name = 'Sony Reader 300'
  88.     short_name = 'sony300'
  89.     description = _('This profile is intended for the SONY PRS 300.')
  90.     dpi = 200
  91.  
  92.  
  93. class SonyReader900Input(SonyReaderInput):
  94.     author = 'John Schember'
  95.     name = 'Sony Reader 900'
  96.     short_name = 'sony900'
  97.     description = _('This profile is intended for the SONY PRS-900.')
  98.     screen_size = (584, 978)
  99.  
  100.  
  101. class MSReaderInput(InputProfile):
  102.     name = 'Microsoft Reader'
  103.     short_name = 'msreader'
  104.     description = _('This profile is intended for the Microsoft Reader.')
  105.     screen_size = (480, 652)
  106.     dpi = 96
  107.     fbase = 13
  108.     fsizes = [
  109.         10,
  110.         11,
  111.         13,
  112.         16,
  113.         18,
  114.         20,
  115.         22,
  116.         26]
  117.  
  118.  
  119. class MobipocketInput(InputProfile):
  120.     name = 'Mobipocket Books'
  121.     short_name = 'mobipocket'
  122.     description = _('This profile is intended for the Mobipocket books.')
  123.     screen_size = (600, 800)
  124.     dpi = 96
  125.     fbase = 18
  126.     fsizes = [
  127.         14,
  128.         14,
  129.         16,
  130.         18,
  131.         20,
  132.         22,
  133.         24,
  134.         26]
  135.  
  136.  
  137. class HanlinV3Input(InputProfile):
  138.     name = 'Hanlin V3'
  139.     short_name = 'hanlinv3'
  140.     description = _('This profile is intended for the Hanlin V3 and its clones.')
  141.     screen_size = (584, 754)
  142.     dpi = 168.451
  143.     fbase = 16
  144.     fsizes = [
  145.         12,
  146.         12,
  147.         14,
  148.         16,
  149.         18,
  150.         20,
  151.         22,
  152.         24]
  153.  
  154.  
  155. class HanlinV5Input(HanlinV3Input):
  156.     name = 'Hanlin V5'
  157.     short_name = 'hanlinv5'
  158.     description = _('This profile is intended for the Hanlin V5 and its clones.')
  159.     screen_size = (584, 754)
  160.     dpi = 200
  161.  
  162.  
  163. class CybookG3Input(InputProfile):
  164.     name = 'Cybook G3'
  165.     short_name = 'cybookg3'
  166.     description = _('This profile is intended for the Cybook G3.')
  167.     screen_size = (600, 800)
  168.     dpi = 168.451
  169.     fbase = 16
  170.     fsizes = [
  171.         12,
  172.         12,
  173.         14,
  174.         16,
  175.         18,
  176.         20,
  177.         22,
  178.         24]
  179.  
  180.  
  181. class CybookOpusInput(InputProfile):
  182.     author = 'John Schember'
  183.     name = 'Cybook Opus'
  184.     short_name = 'cybook_opus'
  185.     description = _('This profile is intended for the Cybook Opus.')
  186.     screen_size = (600, 800)
  187.     dpi = 200
  188.     fbase = 16
  189.     fsizes = [
  190.         12,
  191.         12,
  192.         14,
  193.         16,
  194.         18,
  195.         20,
  196.         22,
  197.         24]
  198.  
  199.  
  200. class KindleInput(InputProfile):
  201.     name = 'Kindle'
  202.     short_name = 'kindle'
  203.     description = _('This profile is intended for the Amazon Kindle.')
  204.     screen_size = (525, 640)
  205.     dpi = 168.451
  206.     fbase = 16
  207.     fsizes = [
  208.         12,
  209.         12,
  210.         14,
  211.         16,
  212.         18,
  213.         20,
  214.         22,
  215.         24]
  216.  
  217.  
  218. class IlliadInput(InputProfile):
  219.     name = 'Illiad'
  220.     short_name = 'illiad'
  221.     description = _('This profile is intended for the Irex Illiad.')
  222.     screen_size = (760, 925)
  223.     dpi = 160
  224.     fbase = 12
  225.     fsizes = [
  226.         7.5,
  227.         9,
  228.         10,
  229.         12,
  230.         15.5,
  231.         20,
  232.         22,
  233.         24]
  234.  
  235.  
  236. class IRexDR1000Input(InputProfile):
  237.     author = 'John Schember'
  238.     name = 'IRex Digital Reader 1000'
  239.     short_name = 'irexdr1000'
  240.     description = _('This profile is intended for the IRex Digital Reader 1000.')
  241.     screen_size = (1024, 1280)
  242.     dpi = 160
  243.     fbase = 16
  244.     fsizes = [
  245.         12,
  246.         14,
  247.         16,
  248.         18,
  249.         20,
  250.         22,
  251.         24]
  252.  
  253.  
  254. class IRexDR800Input(InputProfile):
  255.     author = 'Eric Cronin'
  256.     name = 'IRex Digital Reader 800'
  257.     short_name = 'irexdr800'
  258.     description = _('This profile is intended for the IRex Digital Reader 800.')
  259.     screen_size = (768, 1024)
  260.     dpi = 160
  261.     fbase = 16
  262.     fsizes = [
  263.         12,
  264.         14,
  265.         16,
  266.         18,
  267.         20,
  268.         22,
  269.         24]
  270.  
  271.  
  272. class NookInput(InputProfile):
  273.     author = 'John Schember'
  274.     name = 'Nook'
  275.     short_name = 'nook'
  276.     description = _('This profile is intended for the B&N Nook.')
  277.     screen_size = (600, 800)
  278.     dpi = 167
  279.     fbase = 16
  280.     fsizes = [
  281.         12,
  282.         12,
  283.         14,
  284.         16,
  285.         18,
  286.         20,
  287.         22,
  288.         24]
  289.  
  290. input_profiles = [
  291.     InputProfile,
  292.     SonyReaderInput,
  293.     SonyReader300Input,
  294.     SonyReader900Input,
  295.     MSReaderInput,
  296.     MobipocketInput,
  297.     HanlinV3Input,
  298.     HanlinV5Input,
  299.     CybookG3Input,
  300.     CybookOpusInput,
  301.     KindleInput,
  302.     IlliadInput,
  303.     IRexDR1000Input,
  304.     IRexDR800Input,
  305.     NookInput]
  306. input_profiles.sort(cmp = (lambda x, y: cmp(x.name.lower(), y.name.lower())))
  307.  
  308. class OutputProfile(Plugin):
  309.     author = 'Kovid Goyal'
  310.     supported_platforms = set([
  311.         'windows',
  312.         'osx',
  313.         'linux'])
  314.     can_be_disabled = False
  315.     type = _('Output profile')
  316.     name = 'Default Output Profile'
  317.     short_name = 'default'
  318.     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.')
  319.     comic_screen_size = (584, 754)
  320.     supports_mobi_indexing = False
  321.     touchscreen = False
  322.     touchscreen_news_css = ''
  323.     extra_css_modules = []
  324.     periodical_date_in_title = True
  325.     
  326.     def tags_to_string(cls, tags):
  327.         return escape(', '.join(tags))
  328.  
  329.     tags_to_string = classmethod(tags_to_string)
  330.  
  331.  
  332. class iPadOutput(OutputProfile):
  333.     name = 'iPad'
  334.     short_name = 'ipad'
  335.     description = _('Intended for the iPad and similar devices with a resolution of 768x1024')
  336.     screen_size = (768, 1024)
  337.     comic_screen_size = (768, 1024)
  338.     dpi = 132
  339.     extra_css_modules = [
  340.         {
  341.             'name': 'webkit',
  342.             'props': {
  343.                 '-webkit-border-bottom-left-radius': '{length}',
  344.                 '-webkit-border-bottom-right-radius': '{length}',
  345.                 '-webkit-border-top-left-radius': '{length}',
  346.                 '-webkit-border-top-right-radius': '{length}',
  347.                 '-webkit-border-radius': '{border-width}(\\s+{border-width}){0,3}|inherit' },
  348.             'macros': {
  349.                 'border-width': '{length}|medium|thick|thin' } }]
  350.     touchscreen = True
  351.     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        '
  352.  
  353.  
  354. class SonyReaderOutput(OutputProfile):
  355.     name = 'Sony Reader'
  356.     short_name = 'sony'
  357.     description = _('This profile is intended for the SONY PRS line. The 500/505/600/700 etc.')
  358.     screen_size = (590, 775)
  359.     dpi = 168.451
  360.     fbase = 12
  361.     fsizes = [
  362.         7.5,
  363.         9,
  364.         10,
  365.         12,
  366.         15.5,
  367.         20,
  368.         22,
  369.         24]
  370.  
  371.  
  372. class KoboReaderOutput(OutputProfile):
  373.     name = 'Kobo Reader'
  374.     short_name = 'kobo'
  375.     description = _('This profile is intended for the Kobo Reader.')
  376.     screen_size = (590, 775)
  377.     comic_screen_size = (540, 718)
  378.     dpi = 168.451
  379.     fbase = 12
  380.     fsizes = [
  381.         7.5,
  382.         9,
  383.         10,
  384.         12,
  385.         15.5,
  386.         20,
  387.         22,
  388.         24]
  389.  
  390.  
  391. class SonyReader300Output(SonyReaderOutput):
  392.     author = 'John Schember'
  393.     name = 'Sony Reader 300'
  394.     short_name = 'sony300'
  395.     description = _('This profile is intended for the SONY PRS-300.')
  396.     dpi = 200
  397.  
  398.  
  399. class SonyReader900Output(SonyReaderOutput):
  400.     author = 'John Schember'
  401.     name = 'Sony Reader 900'
  402.     short_name = 'sony900'
  403.     description = _('This profile is intended for the SONY PRS-900.')
  404.     screen_size = (600, 999)
  405.     comic_screen_size = screen_size
  406.  
  407.  
  408. class JetBook5Output(OutputProfile):
  409.     name = 'JetBook 5-inch'
  410.     short_name = 'jetbook5'
  411.     description = _('This profile is intended for the 5-inch JetBook.')
  412.     screen_size = (480, 640)
  413.     dpi = 168.451
  414.  
  415.  
  416. class SonyReaderLandscapeOutput(SonyReaderOutput):
  417.     name = 'Sony Reader Landscape'
  418.     short_name = 'sony-landscape'
  419.     description = _('This profile is intended for the SONY PRS line. The 500/505/700 etc, in landscape mode. Mainly useful for comics.')
  420.     screen_size = (784, 1012)
  421.     comic_screen_size = (784, 1012)
  422.  
  423.  
  424. class MSReaderOutput(OutputProfile):
  425.     name = 'Microsoft Reader'
  426.     short_name = 'msreader'
  427.     description = _('This profile is intended for the Microsoft Reader.')
  428.     screen_size = (480, 652)
  429.     dpi = 96
  430.     fbase = 13
  431.     fsizes = [
  432.         10,
  433.         11,
  434.         13,
  435.         16,
  436.         18,
  437.         20,
  438.         22,
  439.         26]
  440.  
  441.  
  442. class MobipocketOutput(OutputProfile):
  443.     name = 'Mobipocket Books'
  444.     short_name = 'mobipocket'
  445.     description = _('This profile is intended for the Mobipocket books.')
  446.     screen_size = (600, 800)
  447.     dpi = 96
  448.     fbase = 18
  449.     fsizes = [
  450.         14,
  451.         14,
  452.         16,
  453.         18,
  454.         20,
  455.         22,
  456.         24,
  457.         26]
  458.  
  459.  
  460. class HanlinV3Output(OutputProfile):
  461.     name = 'Hanlin V3'
  462.     short_name = 'hanlinv3'
  463.     description = _('This profile is intended for the Hanlin V3 and its clones.')
  464.     screen_size = (584, 754)
  465.     dpi = 168.451
  466.     fbase = 16
  467.     fsizes = [
  468.         12,
  469.         12,
  470.         14,
  471.         16,
  472.         18,
  473.         20,
  474.         22,
  475.         24]
  476.  
  477.  
  478. class HanlinV5Output(HanlinV3Output):
  479.     name = 'Hanlin V5'
  480.     short_name = 'hanlinv5'
  481.     description = _('This profile is intended for the Hanlin V5 and its clones.')
  482.     dpi = 200
  483.  
  484.  
  485. class CybookG3Output(OutputProfile):
  486.     name = 'Cybook G3'
  487.     short_name = 'cybookg3'
  488.     description = _('This profile is intended for the Cybook G3.')
  489.     screen_size = (600, 800)
  490.     dpi = 168.451
  491.     fbase = 16
  492.     fsizes = [
  493.         12,
  494.         12,
  495.         14,
  496.         16,
  497.         18,
  498.         20,
  499.         22,
  500.         24]
  501.  
  502.  
  503. class CybookOpusOutput(SonyReaderOutput):
  504.     author = 'John Schember'
  505.     name = 'Cybook Opus'
  506.     short_name = 'cybook_opus'
  507.     description = _('This profile is intended for the Cybook Opus.')
  508.     dpi = 200
  509.     fbase = 16
  510.     fsizes = [
  511.         12,
  512.         12,
  513.         14,
  514.         16,
  515.         18,
  516.         20,
  517.         22,
  518.         24]
  519.  
  520.  
  521. class KindleOutput(OutputProfile):
  522.     name = 'Kindle'
  523.     short_name = 'kindle'
  524.     description = _('This profile is intended for the Amazon Kindle.')
  525.     screen_size = (525, 640)
  526.     dpi = 168.451
  527.     fbase = 16
  528.     fsizes = [
  529.         12,
  530.         12,
  531.         14,
  532.         16,
  533.         18,
  534.         20,
  535.         22,
  536.         24]
  537.     supports_mobi_indexing = True
  538.     periodical_date_in_title = False
  539.     
  540.     def tags_to_string(cls, tags):
  541.         return u'%s <br/><span style="color: white">%s</span>' % (', '.join(tags), 'ttt '.join(tags) + 'ttt ')
  542.  
  543.     tags_to_string = classmethod(tags_to_string)
  544.  
  545.  
  546. class KindleDXOutput(OutputProfile):
  547.     name = 'Kindle DX'
  548.     short_name = 'kindle_dx'
  549.     description = _('This profile is intended for the Amazon Kindle DX.')
  550.     screen_size = (744, 1022)
  551.     dpi = 150
  552.     comic_screen_size = (741, 1022)
  553.     supports_mobi_indexing = True
  554.     periodical_date_in_title = False
  555.     
  556.     def tags_to_string(cls, tags):
  557.         return u'%s <br/><span style="color: white">%s</span>' % (', '.join(tags), 'ttt '.join(tags) + 'ttt ')
  558.  
  559.     tags_to_string = classmethod(tags_to_string)
  560.  
  561.  
  562. class IlliadOutput(OutputProfile):
  563.     name = 'Illiad'
  564.     short_name = 'illiad'
  565.     description = _('This profile is intended for the Irex Illiad.')
  566.     screen_size = (760, 925)
  567.     comic_screen_size = (760, 925)
  568.     dpi = 160
  569.     fbase = 12
  570.     fsizes = [
  571.         7.5,
  572.         9,
  573.         10,
  574.         12,
  575.         15.5,
  576.         20,
  577.         22,
  578.         24]
  579.  
  580.  
  581. class IRexDR1000Output(OutputProfile):
  582.     author = 'John Schember'
  583.     name = 'IRex Digital Reader 1000'
  584.     short_name = 'irexdr1000'
  585.     description = _('This profile is intended for the IRex Digital Reader 1000.')
  586.     screen_size = (1024, 1280)
  587.     comic_screen_size = (996, 1241)
  588.     dpi = 160
  589.     fbase = 16
  590.     fsizes = [
  591.         12,
  592.         14,
  593.         16,
  594.         18,
  595.         20,
  596.         22,
  597.         24]
  598.  
  599.  
  600. class IRexDR800Output(OutputProfile):
  601.     author = 'Eric Cronin'
  602.     name = 'IRex Digital Reader 800'
  603.     short_name = 'irexdr800'
  604.     description = _('This profile is intended for the IRex Digital Reader 800.')
  605.     screen_size = (768, 1024)
  606.     comic_screen_size = (768, 1024)
  607.     dpi = 160
  608.     fbase = 16
  609.     fsizes = [
  610.         12,
  611.         14,
  612.         16,
  613.         18,
  614.         20,
  615.         22,
  616.         24]
  617.  
  618.  
  619. class NookOutput(OutputProfile):
  620.     author = 'John Schember'
  621.     name = 'Nook'
  622.     short_name = 'nook'
  623.     description = _('This profile is intended for the B&N Nook.')
  624.     screen_size = (600, 730)
  625.     comic_screen_size = (584, 730)
  626.     dpi = 167
  627.     fbase = 16
  628.     fsizes = [
  629.         12,
  630.         12,
  631.         14,
  632.         16,
  633.         18,
  634.         20,
  635.         22,
  636.         24]
  637.  
  638. output_profiles = [
  639.     OutputProfile,
  640.     SonyReaderOutput,
  641.     SonyReader300Output,
  642.     SonyReader900Output,
  643.     MSReaderOutput,
  644.     MobipocketOutput,
  645.     HanlinV3Output,
  646.     HanlinV5Output,
  647.     CybookG3Output,
  648.     CybookOpusOutput,
  649.     KindleOutput,
  650.     iPadOutput,
  651.     KoboReaderOutput,
  652.     SonyReaderLandscapeOutput,
  653.     KindleDXOutput,
  654.     IlliadOutput,
  655.     IRexDR1000Output,
  656.     IRexDR800Output,
  657.     JetBook5Output,
  658.     NookOutput]
  659. output_profiles.sort(cmp = (lambda x, y: cmp(x.name.lower(), y.name.lower())))
  660.