From 5b0eff9519be98c4645e6e5fa7a5c1adfe1d02d4 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Mon, 10 Feb 2025 20:44:38 +0100 Subject: [PATCH 1/2] route: Add turnpoint type for stairs --- src/route.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/route.js b/src/route.js index 6de38df5..5d4b94e1 100644 --- a/src/route.js +++ b/src/route.js @@ -104,7 +104,8 @@ export class TurnPoint { UTURN: 14, UTURN_LEFT: 15, UTURN_RIGHT: 16, - ELEVATOR: 17 + ELEVATOR: 17, + STAIRS: 18, } constructor({ coordinate, type, distance, instruction, turnAngle }) { @@ -146,7 +147,8 @@ export class TurnPoint { 'maps-direction-u-turn-left-symbolic'; case TurnPoint.Type.UTURN_LEFT: return 'maps-direction-u-turn-left-symbolic'; case TurnPoint.Type.UTURN_RIGHT: return 'maps-direction-u-turn-right-symbolic'; - default: return ''; + case TurnPoint.Type.STAIRS: return 'steps-symbolic'; + default: return ''; } } -- GitLab From 97566f9b07f5c95b04199f99b49020fc3a1fd230 Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Mon, 10 Feb 2025 20:45:01 +0100 Subject: [PATCH 2/2] motis2: Handle stairs step Add support for distinguishing "taking stairs" steps. It was previously omitted to allow MOTIS 2 support in 47.x without introducing new strings. --- src/transitplugins/motis2.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/transitplugins/motis2.js b/src/transitplugins/motis2.js index ea172eda..ec0f5054 100644 --- a/src/transitplugins/motis2.js +++ b/src/transitplugins/motis2.js @@ -19,6 +19,8 @@ * Author: Marcus Lundblad */ +import gettext from 'gettext'; + import GWeather from 'gi://GWeather'; import GLib from 'gi://GLib'; import Shumate from 'gi://Shumate'; @@ -33,6 +35,8 @@ import * as Time from '../time.js'; import {Itinerary, Leg, RouteType, Stop} from '../transitPlan.js'; import * as Utils from '../utils.js'; +const _ = gettext.gettext; + export class Motis2 { constructor(params) { this._baseUrl = GLib.getenv('MOTIS_BASE_URL') ?? params?.baseUrl; @@ -326,6 +330,10 @@ export class Motis2 { switch (step.relativeDirection) { case 'DEPART': case 'STAIRS': + return [TurnPoint.Type.STAIRS, + step.hasOwnProperty('toLevel') ? + _("Take the stairs to level %s").format(step.toLevel) : + _("Take the stairs")]; case 'CONTINUE': return [TurnPoint.Type.CONTINUE, step.streetName ? -- GitLab