home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1250 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.0 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@kovidgoyal.net'
  6. __docformat__ = 'restructuredtext en'
  7. from calibre.gui2 import dynamic
  8. from calibre.gui2.dialogs.confirm_delete_ui import Ui_Dialog
  9. from PyQt4.Qt import QDialog, Qt, QPixmap, QIcon
  10.  
  11. def _config_name(name):
  12.     return name + '_again'
  13.  
  14.  
  15. class Dialog(QDialog, Ui_Dialog):
  16.     
  17.     def __init__(self, msg, name, parent):
  18.         QDialog.__init__(self, parent)
  19.         self.setupUi(self)
  20.         self.msg.setText(msg)
  21.         self.name = name
  22.         self.again.stateChanged.connect(self.toggle)
  23.         self.buttonBox.setFocus(Qt.OtherFocusReason)
  24.  
  25.     
  26.     def toggle(self, *args):
  27.         dynamic[_config_name(self.name)] = self.again.isChecked()
  28.  
  29.  
  30.  
  31. def confirm(msg, name, parent = None, pixmap = 'dialog_warning.svg'):
  32.     if not dynamic.get(_config_name(name), True):
  33.         return True
  34.     d = Dialog(msg, name, parent)
  35.     d.label.setPixmap(QPixmap(I(pixmap)))
  36.     d.setWindowIcon(QIcon(I(pixmap)))
  37.     return d.exec_() == d.Accepted
  38.  
  39.