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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
  6. from PyQt4.Qt import QDialog, QListWidgetItem, SIGNAL
  7. from calibre.gui2 import file_icon_provider
  8. from calibre.gui2.dialogs.choose_format_ui import Ui_ChooseFormatDialog
  9.  
  10. class ChooseFormatDialog(QDialog, Ui_ChooseFormatDialog):
  11.     
  12.     def __init__(self, window, msg, formats):
  13.         QDialog.__init__(self, window)
  14.         Ui_ChooseFormatDialog.__init__(self)
  15.         self.setupUi(self)
  16.         self.connect(self.formats, SIGNAL('activated(QModelIndex)'), self.activated_slot)
  17.         self.msg.setText(msg)
  18.         for format in formats:
  19.             self.formats.addItem(QListWidgetItem(file_icon_provider().icon_from_ext(format.lower()), format.upper()))
  20.         
  21.         self._formats = formats
  22.         self.formats.setCurrentRow(0)
  23.         self._format = None
  24.  
  25.     
  26.     def activated_slot(self, *args):
  27.         self.accept()
  28.  
  29.     
  30.     def format(self):
  31.         return self._format
  32.  
  33.     
  34.     def accept(self):
  35.         self._format = self._formats[self.formats.currentRow()]
  36.         return QDialog.accept(self)
  37.  
  38.  
  39.