def polling():
for m in sys.modules['thunderbolt100k.widgets'].modules:
if m.endswith('__init__.py'):
continue
widget_name = os.path.basename(m).replace('.py', '')
widget = getattr(sys.modules['thunderbolt100k.widgets'], widget_name)
if constants.CONFIG.get('{0}_INTERVAL'.format(widget.__name__.upper())):
interval = int(constants.CONFIG.get('{0}_INTERVAL'.format(widget_name.upper())))
else:
interval = 5 # Default is 5 min if not specified
schedule.every(interval).minutes.do(widget_main, widget)
widget_main(widget) # Run the function instantly and then schedule
while True:
schedule.run_pending()
time.sleep(60)
评论列表
文章目录