Also ignore alerts modules
This commit is contained in:
parent
c67e1bfb8b
commit
a5a07d447d
3
main.py
3
main.py
@ -80,6 +80,7 @@ def main(only_on_coming_evt=False, ignore_module=[], **config_args):
|
|||||||
shape.append(WidgetPlacement(IcalModule, config, size=(480-int(480/1.6), 255), position=(0, 250)))
|
shape.append(WidgetPlacement(IcalModule, config, size=(480-int(480/1.6), 255), position=(0, 250)))
|
||||||
|
|
||||||
occuped_space = 0
|
occuped_space = 0
|
||||||
|
if "IcalModule" not in ignore_module:
|
||||||
ical = IcalModule(config)
|
ical = IcalModule(config)
|
||||||
evt_coming = ical.non_local_event_coming(config) or ical.local_event_ending(config)
|
evt_coming = ical.non_local_event_coming(config) or ical.local_event_ending(config)
|
||||||
if evt_coming:
|
if evt_coming:
|
||||||
@ -145,7 +146,7 @@ def main(only_on_coming_evt=False, ignore_module=[], **config_args):
|
|||||||
|
|
||||||
|
|
||||||
from modules import AlertsModule
|
from modules import AlertsModule
|
||||||
mod = AlertsModule(alerts).draw_module(config, 480, 330)
|
mod = AlertsModule(alerts, ignore_module).draw_module(config, 480, 330)
|
||||||
if mod.height > 260:
|
if mod.height > 260:
|
||||||
image.paste(mod, (0, 580-mod.height+67), mod)
|
image.paste(mod, (0, 580-mod.height+67), mod)
|
||||||
elif mod.height < 100:
|
elif mod.height < 100:
|
||||||
|
@ -90,9 +90,10 @@ class RuleModule:
|
|||||||
|
|
||||||
class AlertsModule:
|
class AlertsModule:
|
||||||
|
|
||||||
def __init__(self, alerts=[]):
|
def __init__(self, alerts=[], ignore_module=[]):
|
||||||
self.icon_size = 50
|
self.icon_size = 50
|
||||||
self.alerts = alerts
|
self.alerts = alerts
|
||||||
|
self.ignore_module = ignore_module
|
||||||
|
|
||||||
def draw_alert(self, alert, width, image, draw, fnt_R, fnt_B, align, font_size):
|
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:
|
if "icon" in alert and alert["icon"] is not None:
|
||||||
@ -151,6 +152,10 @@ class AlertsModule:
|
|||||||
alert = alert["module"]
|
alert = alert["module"]
|
||||||
|
|
||||||
if isinstance(alert, type):
|
if isinstance(alert, type):
|
||||||
|
if alert.__name__ in self.ignore_module:
|
||||||
|
logging.info("Skip module " + alert.__name__ + ", as requested by arguments")
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for alert in alert(*args_module).gen_alerts(*args_func):
|
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)
|
align = self.draw_alert(alert, width, image, draw, fnt_R, fnt_B, align, font_size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user