home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1181 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  3.3 KB  |  73 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.svg')
  15.     HELP = _('Control the look and feel of the output')
  16.     
  17.     def __init__(self, parent, get_option, get_help, db = None, book_id = None):
  18.         Widget.__init__(self, parent, 'look_and_feel', [
  19.             'change_justification',
  20.             'extra_css',
  21.             'base_font_size',
  22.             'font_size_mapping',
  23.             'line_height',
  24.             'linearize_tables',
  25.             'disable_font_rescaling',
  26.             'insert_blank_line',
  27.             'remove_paragraph_spacing',
  28.             'remove_paragraph_spacing_indent_size',
  29.             'input_encoding',
  30.             'asciiize',
  31.             'keep_ligatures'])
  32.         for val, text in [
  33.             ('original', _('Original')),
  34.             ('left', _('Left align')),
  35.             ('justify', _('Justify text'))]:
  36.             self.opt_change_justification.addItem(text, QVariant(val))
  37.         
  38.         self.db = db
  39.         self.book_id = book_id
  40.         self.initialize_options(get_option, get_help, db, book_id)
  41.         self.opt_disable_font_rescaling.toggle()
  42.         self.opt_disable_font_rescaling.toggle()
  43.         self.connect(self.button_font_key, SIGNAL('clicked()'), self.font_key_wizard)
  44.         self.opt_remove_paragraph_spacing.toggle()
  45.         self.opt_remove_paragraph_spacing.toggle()
  46.  
  47.     
  48.     def get_value_handler(self, g):
  49.         if g is self.opt_change_justification:
  50.             ans = unicode(g.itemData(g.currentIndex()).toString())
  51.             return ans
  52.         return Widget.get_value_handler(self, g)
  53.  
  54.     
  55.     def set_value_handler(self, g, val):
  56.         if g is self.opt_change_justification:
  57.             for i in range(g.count()):
  58.                 c = unicode(g.itemData(i).toString())
  59.                 if val == c:
  60.                     g.setCurrentIndex(i)
  61.                     break
  62.                     continue
  63.             
  64.             return True
  65.  
  66.     
  67.     def font_key_wizard(self):
  68.         FontKeyChooser = FontKeyChooser
  69.         import calibre.gui2.convert.font_key
  70.         d = FontKeyChooser(self, self.opt_base_font_size.value(), unicode(self.opt_font_size_mapping.text()).strip())
  71.  
  72.  
  73.