def queueMplayer(path): ensureMplayerThreads() while mplayerEvt.isSet(): time.sleep(0.1) if tmpdir and os.path.exists(path): # mplayer on windows doesn't like the encoding, so we create a # temporary file instead. oddly, foreign characters in the dirname # don't seem to matter. (fd, name) = tempfile.mkstemp(suffix=os.path.splitext(path)[1], dir=tmpdir) f = os.fdopen(fd, "wb") f.write(open(path, "rb").read()) f.close() # it wants unix paths, too! path = name.replace("\\", "/") path = path.encode(sys.getfilesystemencoding()) else: path = path.encode("utf-8") mplayerQueue.append(path) mplayerEvt.set() runHook("soundQueued")
def execute(self, *a, **ka): x = self._session.execute(*a, **ka) runHook("dbFinished") return x
def focusLost(self, field): runHook('fact.focusLost', self, field)