home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1248 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  3.0 KB  |  64 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, QDialogButtonBox, Qt, QLabel, QVBoxLayout, SIGNAL, QThread
  9. from calibre.ebooks.metadata import MetaInformation
  10.  
  11. class Worker(QThread):
  12.     
  13.     def __init__(self, mi, parent):
  14.         QThread.__init__(self, parent)
  15.         self.mi = MetaInformation(mi)
  16.         self.exceptions = []
  17.  
  18.     
  19.     def run(self):
  20.         get_social_metadata = get_social_metadata
  21.         import calibre.ebooks.metadata.fetch
  22.         self.exceptions = get_social_metadata(self.mi)
  23.  
  24.  
  25.  
  26. class SocialMetadata(QDialog):
  27.     
  28.     def __init__(self, mi, parent):
  29.         QDialog.__init__(self, parent)
  30.         self.bbox = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self)
  31.         self.mi = mi
  32.         self.layout = QVBoxLayout(self)
  33.         self.label = QLabel(_('Downloading social metadata, please wait...'), self)
  34.         self.label.setWordWrap(True)
  35.         self.layout.addWidget(self.label)
  36.         self.layout.addWidget(self.bbox)
  37.         self.worker = Worker(mi, self)
  38.         self.connect(self.worker, SIGNAL('finished()'), self.accept)
  39.         self.connect(self.bbox, SIGNAL('rejected()'), self.reject)
  40.         self.worker.start()
  41.  
  42.     
  43.     def reject(self):
  44.         self.disconnect(self.worker, SIGNAL('finished()'), self.accept)
  45.         QDialog.reject(self)
  46.  
  47.     
  48.     def accept(self):
  49.         self.mi.tags = self.worker.mi.tags
  50.         self.mi.rating = self.worker.mi.rating
  51.         self.mi.comments = self.worker.mi.comments
  52.         if self.worker.mi.series:
  53.             self.mi.series = self.worker.mi.series
  54.             self.mi.series_index = self.worker.mi.series_index
  55.         
  56.         QDialog.accept(self)
  57.  
  58.     
  59.     def exceptions(self):
  60.         return self.worker.exceptions
  61.  
  62.     exceptions = property(exceptions)
  63.  
  64.