home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1244 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.5 KB  |  57 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 QDialog, QVBoxLayout, QPlainTextEdit, QTimer, QDialogButtonBox, QPushButton, QApplication, QIcon
  9.  
  10. class DebugDevice(QDialog):
  11.     
  12.     def __init__(self, parent = None):
  13.         QDialog.__init__(self, parent)
  14.         self._layout = QVBoxLayout(self)
  15.         self.setLayout(self._layout)
  16.         self.log = QPlainTextEdit(self)
  17.         self._layout.addWidget(self.log)
  18.         self.log.setPlainText(_('Getting debug information') + '...')
  19.         self.copy = QPushButton(_('Copy to &clipboard'))
  20.         self.copy.setDefault(True)
  21.         self.setWindowTitle(_('Debug device detection'))
  22.         self.setWindowIcon(QIcon(I('debug.svg')))
  23.         self.copy.clicked.connect(self.copy_to_clipboard)
  24.         self.ok = QPushButton('&OK')
  25.         self.ok.setAutoDefault(False)
  26.         self.ok.clicked.connect(self.accept)
  27.         self.bbox = QDialogButtonBox(self)
  28.         self.bbox.addButton(self.copy, QDialogButtonBox.ActionRole)
  29.         self.bbox.addButton(self.ok, QDialogButtonBox.AcceptRole)
  30.         self._layout.addWidget(self.bbox)
  31.         self.resize(750, 500)
  32.         self.bbox.setEnabled(False)
  33.         QTimer.singleShot(1000, self.debug)
  34.  
  35.     
  36.     def debug(self):
  37.         
  38.         try:
  39.             debug = debug
  40.             import calibre.devices
  41.             raw = debug()
  42.             self.log.setPlainText(raw)
  43.         finally:
  44.             self.bbox.setEnabled(True)
  45.  
  46.  
  47.     
  48.     def copy_to_clipboard(self):
  49.         QApplication.clipboard().setText(self.log.toPlainText())
  50.  
  51.  
  52. if __name__ == '__main__':
  53.     app = QApplication([])
  54.     d = DebugDevice()
  55.     d.exec_()
  56.  
  57.