Пример #1
0
class CompressThread(QThread):
    def __init__(self, parent, params, handler):
        QThread.__init__(self, parent)
        self.img = params["img"]
        self.m = params["m"]
        self.n = params["n"]
        self.p = params["p"]
        self.params = params

    def handler(self, teach_info):
        self.emit(SIGNAL("handle"), teach_info)

    def debug(self, msg):
        self.emit(SIGNAL("debug"), msg)

    def run(self):
        img = Image.open(self.img)
        self.compr = ImageCompressor(img, self.n, self.m, self.p)
        self.compr.handlers = [self.handler]
        compr = self.compr.compress(self.params)
        self.emit(SIGNAL("compressed"), compr["img"])
Пример #2
0
 def run(self):
     img = Image.open(self.img)
     self.compr = ImageCompressor(img, self.n, self.m, self.p)
     self.compr.handlers = [self.handler]
     compr = self.compr.compress(self.params)
     self.emit(SIGNAL("compressed"), compr["img"])