コード例 #1
0
ファイル: apiproxy.py プロジェクト: aeriksson/geogebra
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)
コード例 #2
0
ファイル: apiproxy.py プロジェクト: aeriksson/geogebra
 def __getattr__(self, attr):
     if isEventDispatchThread() or thread_is_async():
         return getattr(self._api, attr)
     else:
         return partial(invoke, getattr(self._api, attr))