def set_global_font_path(path): try: global GLOBAL_FONT_PATH assert os.path.isfile(path) GLOBAL_FONT_PATH = convert.get_str(path) except: log.err(traceback.format_exc())
def play(self, path, loop=False): self.stop() self.loop_count = 0 if loop else 1 if convert.get_unicode(path).find(">") != -1: if share.KEY: self.spawn( "http://127.0.0.1:%d/req=%s"%(share.PORT, encrypt_path(path)) ) else: self.spawn( convert.get_str(convert.get_unicode(path).replace(">", "/")) ) elif os.path.isfile(path): self.spawn(path) else: raise IOError("%s not exist"%path)
def set_text(self, text): self.buf.set_text(convert.get_str(text))
def log(pipe, type, *messages): pipe.write("%s %s\n" % ( str(type), " ".join(map(lambda s: convert.get_str(s), messages)), ))
def set_text(self, text): self.buf.set_text(convert.get_str(text))
def log(pipe, type, *messages): pipe.write("%s %s\n"%( str(type), " ".join(map(lambda s: convert.get_str(s), messages)), ))
def encrypt_path(path): ext = os.path.splitext(convert.get_unicode(path))[1] or ".none" return path.encode("hex")+convert.get_str(ext)
def play(self, path, *args, **argv): self.args = self.args[:-1]+(convert.get_str(self.get_id()),) StandardPlayer.play(self, path, *args, **argv)
def posix_path(path): return convert.get_str(convert.get_unicode(path).replace("\\", "/"))