ratp: Make traffic aware lines configurable

This commit is contained in:
nemunaire 2023-01-19 10:51:59 +01:00
parent 804eb38f18
commit 4bf17e2e39
2 changed files with 9 additions and 3 deletions

View File

@ -101,9 +101,15 @@ def main(only_on_coming_evt=False, ignore_module=[], force_coming_event=True, **
shape.append(WidgetPlacement(WeeklyWeatherModule, size=(int(480/1.6), 275), position=(480-int(480/1.6), NEXT_STOP_Y + occuped_space + (5 if occuped_space else 0))))
# RATP weather
major_lines = ["M7", "M14", "RB", "T3A"]
weekday = datetime.now().weekday()
if weekday == 0 or weekday == 1 or weekday == 3:
major_lines.append("M1")
elif weekday == 4:
major_lines.append("M6")
from modules.ratp import RATPWeatherModule
shape.append(WidgetPlacement(RATPWeatherModule, size=(int(480/1.6), 94), position=(480-int(480/1.6), 155)))
alerts.append({"module": RATPWeatherModule, "args_func": [config]})
alerts.append({"module": RATPWeatherModule, "args_module": [major_lines], "args_func": [config]})
# Toolbar
from modules.weather import WeatherToolbarModule

View File

@ -197,8 +197,8 @@ class IDFMAPI:
class RATPWeatherModule:
def __init__(self):
self.major_lines = ["M7", "M5", "M14", "RB", "T3A"]
def __init__(self, major_lines=["M7", "M5", "M14", "RB", "T3A"]):
self.major_lines = major_lines
def gen_alerts(self, config):
alerts = []