def gui_thread_schedule_async(callable, args=None): if is_gui_thread(): if args is None: callable() else: callable(*args) return event = ExecuteCodeEvent(callable, args) QCoreApplication.postEvent(GlobalInfo.main_window, event)
def gui_thread_schedule(callable, args=None): if is_gui_thread(): if args is None: return callable() else: callable(*args) event = ExecuteCodeEvent(callable, args) QCoreApplication.postEvent(GlobalInfo.main_window, event) event.event.wait() if event.exception is not None: raise event.exception[0], event.exception[1], event.exception[2] return event.result
def run(self): for i in range(3): e = MyEvent(i) QCoreApplication.postEvent(self.owner, e)
def invoke_in_main_thread(fn, *args, **kwargs): QCoreApplication.postEvent(_invoker, InvokeEvent(fn, *args, **kwargs))
def run(self): for i in range(3): e=MyEvent(i); QCoreApplication.postEvent(self.owner,e)
def releaseKey(self,key_code,text='',shift=0): ev = QKeyEvent(QEvent.KeyRelease, key_code, shift, text) QCoreApplication.postEvent(Jaime.instance.view,ev)
def pressKey(self,key_code,text='',shift=0): ev = QKeyEvent(QEvent.KeyPress, key_code, shift, text) QCoreApplication.postEvent(Jaime.instance.view,ev)