home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_1207 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  3.4 KB  |  75 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from __future__ import with_statement
  5. __license__ = 'GPL v3'
  6. __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
  7. __docformat__ = 'restructuredtext en'
  8. from PyQt4.Qt import SIGNAL, QVariant
  9. from calibre.gui2.convert.look_and_feel_ui import Ui_Form
  10. from calibre.gui2.convert import Widget
  11.  
  12. class LookAndFeelWidget(Widget, Ui_Form):
  13.     TITLE = _('Look & Feel')
  14.     ICON = I('lookfeel.png')
  15.     HELP = _('Control the look and feel of the output')
  16.     COMMIT_NAME = 'look_and_feel'
  17.     
  18.     def __init__(self, parent, get_option, get_help, db = None, book_id = None):
  19.         Widget.__init__(self, parent, [
  20.             'change_justification',
  21.             'extra_css',
  22.             'base_font_size',
  23.             'font_size_mapping',
  24.             'line_height',
  25.             'linearize_tables',
  26.             'smarten_punctuation',
  27.             'disable_font_rescaling',
  28.             'insert_blank_line',
  29.             'remove_paragraph_spacing',
  30.             'remove_paragraph_spacing_indent_size',
  31.             'input_encoding',
  32.             'asciiize',
  33.             'keep_ligatures'])
  34.         for val, text in [
  35.             ('original', _('Original')),
  36.             ('left', _('Left align')),
  37.             ('justify', _('Justify text'))]:
  38.             self.opt_change_justification.addItem(text, QVariant(val))
  39.         
  40.         self.db = db
  41.         self.book_id = book_id
  42.         self.initialize_options(get_option, get_help, db, book_id)
  43.         self.opt_disable_font_rescaling.toggle()
  44.         self.opt_disable_font_rescaling.toggle()
  45.         self.connect(self.button_font_key, SIGNAL('clicked()'), self.font_key_wizard)
  46.         self.opt_remove_paragraph_spacing.toggle()
  47.         self.opt_remove_paragraph_spacing.toggle()
  48.  
  49.     
  50.     def get_value_handler(self, g):
  51.         if g is self.opt_change_justification:
  52.             ans = unicode(g.itemData(g.currentIndex()).toString())
  53.             return ans
  54.         return Widget.get_value_handler(self, g)
  55.  
  56.     
  57.     def set_value_handler(self, g, val):
  58.         if g is self.opt_change_justification:
  59.             for i in range(g.count()):
  60.                 c = unicode(g.itemData(i).toString())
  61.                 if val == c:
  62.                     g.setCurrentIndex(i)
  63.                     break
  64.                     continue
  65.             
  66.             return True
  67.  
  68.     
  69.     def font_key_wizard(self):
  70.         FontKeyChooser = FontKeyChooser
  71.         import calibre.gui2.convert.font_key
  72.         d = FontKeyChooser(self, self.opt_base_font_size.value(), unicode(self.opt_font_size_mapping.text()).strip())
  73.  
  74.  
  75.