Also ignore alerts modules

This commit is contained in:
nemunaire 2023-01-16 01:03:07 +01:00
commit a5a07d447d
2 changed files with 18 additions and 12 deletions

View file

@ -90,9 +90,10 @@ class RuleModule:
class AlertsModule:
def __init__(self, alerts=[]):
def __init__(self, alerts=[], ignore_module=[]):
self.icon_size = 50
self.alerts = alerts
self.ignore_module = ignore_module
def draw_alert(self, alert, width, image, draw, fnt_R, fnt_B, align, font_size):
if "icon" in alert and alert["icon"] is not None:
@ -151,6 +152,10 @@ class AlertsModule:
alert = alert["module"]
if isinstance(alert, type):
if alert.__name__ in self.ignore_module:
logging.info("Skip module " + alert.__name__ + ", as requested by arguments")
continue
try:
for alert in alert(*args_module).gen_alerts(*args_func):
align = self.draw_alert(alert, width, image, draw, fnt_R, fnt_B, align, font_size)