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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
  6. from itertools import izip
  7. FONT_SIZES = [
  8.     ('xx-small', 1),
  9.     ('x-small', None),
  10.     ('small', 2),
  11.     ('medium', 3),
  12.     ('large', 4),
  13.     ('x-large', 5),
  14.     ('xx-large', 6),
  15.     (None, 7)]
  16.  
  17. class Profile(object):
  18.     
  19.     def __init__(self, width, height, dpi, fbase, fsizes):
  20.         self.width = (float(width) / dpi) * 72
  21.         self.height = (float(height) / dpi) * 72
  22.         self.dpi = float(dpi)
  23.         self.fbase = float(fbase)
  24.         self.fsizes = []
  25.         for name, num in izip(FONT_SIZES, fsizes):
  26.             size = None
  27.             self.fsizes.append((name, num, float(size)))
  28.         
  29.         self.fnames = dict((lambda .0: for name, _, sz in .0:
  30. if name:
  31. (name, sz)continue)(self.fsizes))
  32.         self.fnums = dict((lambda .0: for _, num, sz in .0:
  33. if num:
  34. (num, sz)continue)(self.fsizes))
  35.  
  36.  
  37. PROFILES = {
  38.     'PRS505': Profile(width = 584, height = 754, dpi = 168.451, fbase = 12, fsizes = [
  39.         7.5,
  40.         9,
  41.         10,
  42.         12,
  43.         15.5,
  44.         20,
  45.         22,
  46.         24]),
  47.     'MSReader': Profile(width = 480, height = 652, dpi = 96, fbase = 13, fsizes = [
  48.         10,
  49.         11,
  50.         13,
  51.         16,
  52.         18,
  53.         20,
  54.         22,
  55.         26]),
  56.     'Mobipocket': Profile(width = 600, height = 800, dpi = 96, fbase = 18, fsizes = [
  57.         14,
  58.         14,
  59.         16,
  60.         18,
  61.         20,
  62.         22,
  63.         24,
  64.         26]),
  65.     'HanlinV3': Profile(width = 584, height = 754, dpi = 168.451, fbase = 16, fsizes = [
  66.         12,
  67.         12,
  68.         14,
  69.         16,
  70.         18,
  71.         20,
  72.         22,
  73.         24]),
  74.     'CybookG3': Profile(width = 600, height = 800, dpi = 168.451, fbase = 16, fsizes = [
  75.         12,
  76.         12,
  77.         14,
  78.         16,
  79.         18,
  80.         20,
  81.         22,
  82.         24]),
  83.     'Kindle': Profile(width = 525, height = 640, dpi = 168.451, fbase = 16, fsizes = [
  84.         12,
  85.         12,
  86.         14,
  87.         16,
  88.         18,
  89.         20,
  90.         22,
  91.         24]),
  92.     'Browser': Profile(width = 800, height = 600, dpi = 100, fbase = 12, fsizes = [
  93.         5,
  94.         7,
  95.         9,
  96.         12,
  97.         13.5,
  98.         17,
  99.         20,
  100.         22,
  101.         24]) }
  102.  
  103. class Context(object):
  104.     PROFILES = PROFILES
  105.     
  106.     def __init__(self, source, dest):
  107.         if source in PROFILES:
  108.             source = PROFILES[source]
  109.         
  110.         if dest in PROFILES:
  111.             dest = PROFILES[dest]
  112.         
  113.         self.source = source
  114.         self.dest = dest
  115.  
  116.  
  117.