class ThumbnailCache(PhotoCacheBase): start_loading = QtCore.pyqtSignal(int, str) def __init__(self, *args, **kwargs): self.scale_size = kwargs.pop('scale_size', QtCore.QSize()) PhotoCacheBase.__init__(self, *args, **kwargs) self.worker = WorkerThread() self.loader = ThumbnailLoader() self.loader.moveToThread(self.worker) self.loader.ready.connect(self.photo_ready) self.loader.fail.connect(self.fail) self.start_loading.connect(self.loader.load_image) self.worker.please_exit.connect(self.worker.exit) self.worker.start() def load(self, id): self.start_loading.emit(id, self.loading[id]) def photo_ready(self, id, image): pixmap = QtGui.QPixmap.fromImage(image) self.ready(id, pixmap)
def __init__(self, *args, **kwargs): PhotoCacheBase.__init__(self, *args, **kwargs) self.worker = WorkerThread() self.loader = ImageLoader() self.loader.moveToThread(self.worker) self.loader.ready.connect(self.photo_ready) self.loader.fail.connect(self.fail) self.start_loading.connect(self.loader.load_image) self.worker.please_exit.connect(self.worker.exit) self.worker.start()
class PhotoImageCache(PhotoCacheBase): start_loading = QtCore.pyqtSignal(int, str) def __init__(self, *args, **kwargs): PhotoCacheBase.__init__(self, *args, **kwargs) self.worker = WorkerThread() self.loader = ImageLoader() self.loader.moveToThread(self.worker) self.loader.ready.connect(self.photo_ready) self.loader.fail.connect(self.fail) self.start_loading.connect(self.loader.load_image) self.worker.please_exit.connect(self.worker.exit) self.worker.start() def load(self, id): self.start_loading.emit(id, self.loading[id]) def photo_ready(self, id, image_list): self.ready(id, PhotoImage(image_list[0]))
def __init__(self, *args, **kwargs): self.scale_size = kwargs.pop('scale_size', QtCore.QSize()) PhotoCacheBase.__init__(self, *args, **kwargs) self.worker = WorkerThread() self.loader = ThumbnailLoader() self.loader.moveToThread(self.worker) self.loader.ready.connect(self.photo_ready) self.loader.fail.connect(self.fail) self.start_loading.connect(self.loader.load_image) self.worker.please_exit.connect(self.worker.exit) self.worker.start()