def __init__(self, *args, **kwargs): super(AppModule, self).__init__(*args, **kwargs) if user32.FindWindowW(u"SPLStudio", None): spldebugging.debugOutput("Studio Recorder is online, attempting to disable background event tracking for Studio") # Python 3: using dict.items directly for maximum Python compatibility. # #90 (19.01/18.09.6-LTS): use Six renames if needed. for pid, appMod in appModuleHandler.runningTable.items(): if appMod.appName == "splstudio": # The below function removes background event tracker for apps through accept events set manipulation. # Call the function instead of duplicating the function body. eventHandler.handleAppTerminate(appMod) break else: spldebugging.debugOutput("Studio is not running")
def cleanup(): """Removes any appModules from the cache whose process has died. """ for deadMod in [mod for mod in runningTable.itervalues() if not mod.isAlive]: log.debug("application %s closed"%deadMod.appName) del runningTable[deadMod.processID] if deadMod in set(o.appModule for o in api.getFocusAncestors()+[api.getFocusObject()] if o and o.appModule): if hasattr(deadMod,'event_appLoseFocus'): deadMod.event_appLoseFocus() import eventHandler eventHandler.handleAppTerminate(deadMod) try: deadMod.terminate() except: log.exception("Error terminating app module %r" % deadMod)