Beispiel #1
0
def run_in_main_thread(f, *args, **kwargs):
    """
    Run f(*args) in the main thread and wait for it to return.

    This is useful when main API calls are needed as they will all be
    executed together, thus speeding things up.
    """
    if isEventDispatchThread():
        return f(*args, **kwargs)
    else:
        return invoke(f, *args, **kwargs)
Beispiel #2
0
 def __getattr__(self, attr):
     if isEventDispatchThread() or thread_is_async():
         return getattr(self._api, attr)
     else:
         return partial(invoke, getattr(self._api, attr))