autocolor.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:cavalcade 作者: worron 项目源码 文件源码
def color_update(self, bytedata):
        """Launch new calculation process with given image bytedata"""
        if bytedata is None:
            if self.default is None:
                if not self.config["image"]["default"].endswith(".svg"):  # fix this
                    file_ = self.config["image"]["default"]
                    self.handler_unblock(self.catcher)
                else:
                    return
            else:
                self.emit("ac-update", self.default)
                return
        else:
            file_ = io.BytesIO(bytedata)

        if self.process is None or not self.process.is_alive():
            if self.watcher is None:
                self.watcher = GLib.io_add_watch(self.pc, GLib.IO_IN | GLib.IO_HUP, self.color_setup)
            self.process = multiprocessing.Process(
                target=self.calculate, args=(file_, self.config["autocolor"], self.cc)
            )
            self.process.start()
        else:
            logger.error("Autocolor threading error: previus process still running, refusing to start new one")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号