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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
  6. __docformat__ = 'restructuredtext en'
  7. from calibre.gui2.preferences import ConfigWidgetBase, test_widget, AbortCommit
  8. from calibre.gui2.preferences.sending_ui import Ui_Form
  9. from calibre.utils.config import ConfigProxy
  10. from calibre.library.save_to_disk import config
  11. from calibre.utils.config import prefs
  12.  
  13. class ConfigWidget(ConfigWidgetBase, Ui_Form):
  14.     
  15.     def genesis(self, gui):
  16.         self.gui = gui
  17.         self.proxy = ConfigProxy(config())
  18.         r = self.register
  19.         for x in ('send_timefmt',):
  20.             r(x, self.proxy)
  21.         
  22.         choices = [
  23.             (_('Manual management'), 'manual'),
  24.             (_('Only on send'), 'on_send'),
  25.             (_('Automatic management'), 'on_connect')]
  26.         r('manage_device_metadata', prefs, choices = choices)
  27.         self.send_template.changed_signal.connect(self.changed_signal.emit)
  28.  
  29.     
  30.     def initialize(self):
  31.         ConfigWidgetBase.initialize(self)
  32.         self.send_template.blockSignals(True)
  33.         self.send_template.initialize('send_to_device', self.proxy['send_template'], self.proxy.help('send_template'))
  34.         self.send_template.blockSignals(False)
  35.  
  36.     
  37.     def restore_defaults(self):
  38.         ConfigWidgetBase.restore_defaults(self)
  39.         self.send_template.set_value(self.proxy.defaults['send_template'])
  40.  
  41.     
  42.     def commit(self):
  43.         if not self.send_template.validate():
  44.             raise AbortCommit('abort')
  45.         self.send_template.validate()
  46.         self.send_template.save_settings(self.proxy, 'send_template')
  47.         return ConfigWidgetBase.commit(self)
  48.  
  49.  
  50. if __name__ == '__main__':
  51.     from PyQt4.Qt import QApplication
  52.     app = QApplication([])
  53.     test_widget('Import/Export', 'Sending')
  54.  
  55.