1# http://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
6DOWNLOAD_CALLBACK = None
9def set_download_callback(callback):
10 global DOWNLOAD_CALLBACK
12 if not callable(callback):
13 raise AttributeError('Callback has to be a function')
14 DOWNLOAD_CALLBACK = callback
17def get_download_callback(context_str):
18 if not DOWNLOAD_CALLBACK:
19 return None
21 def callback(args):
22 return DOWNLOAD_CALLBACK(context_str, args)
24 return callback