def plugin_unloaded(): global observer if 'observer' in globals(): print('\nShutting down observer:', observer) else: return if observer is not None: observer.observer.stop() package_events.unlisten(u'FileBrowser', observer.dired_event_handler) package_events.unlisten(u'FileBrowserWFS', observer.event_handler.update_paths) observer.observer.join() del observer print('BOOM!!1 done...\n')
def wait_build(result_queue, timeout=5): """ Uses the result queue to wait for a result from the open_file() callback :param result_queue: The Queue() to get the result from :param timeout: How long to wait before considering the test a failure :return: The value from the queue """ def _send_result(package_name, event_name, payload): result_queue.put(payload.result) try: package_events.listen('Golang Build', _send_result) return result_queue.get(timeout=timeout) finally: package_events.unlisten('Golang Build', _send_result)