示例#1
0
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)
示例#2
0
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
示例#3
0
 def run(self):
     for i in range(3):
         e = MyEvent(i)
         QCoreApplication.postEvent(self.owner, e)
示例#4
0
def invoke_in_main_thread(fn, *args, **kwargs):
    QCoreApplication.postEvent(_invoker,
                               InvokeEvent(fn, *args, **kwargs))
示例#5
0
文件: bug_462.py 项目: Hasimir/PySide
 def run(self):
     for i in range(3):
         e=MyEvent(i);
         QCoreApplication.postEvent(self.owner,e)
示例#6
0
def invoke_in_main_thread(fn, *args, **kwargs):
    QCoreApplication.postEvent(_invoker, InvokeEvent(fn, *args, **kwargs))
示例#7
0
 def releaseKey(self,key_code,text='',shift=0):
     ev = QKeyEvent(QEvent.KeyRelease,
                    key_code,
                    shift,
                    text)
     QCoreApplication.postEvent(Jaime.instance.view,ev)
示例#8
0
 def pressKey(self,key_code,text='',shift=0):
     ev = QKeyEvent(QEvent.KeyPress,
                    key_code,
                    shift,
                    text)
     QCoreApplication.postEvent(Jaime.instance.view,ev)