From 0e757e1d3822a0adeeb086fbf3e56c20cb1bdb40 Mon Sep 17 00:00:00 2001 From: Gabriel Pérez-Cerezo Date: Tue, 28 Aug 2018 17:27:55 +0200 Subject: Added option for position, radius and distances, more plugins --- mensa/frontends/html.py | 6 +++++- mensa/frontends/plain-text.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'mensa/frontends') diff --git a/mensa/frontends/html.py b/mensa/frontends/html.py index 8a5618f..c23d27c 100644 --- a/mensa/frontends/html.py +++ b/mensa/frontends/html.py @@ -12,6 +12,10 @@ class HTMLRenderer(IPlugin) : if not food : continue r = r+"

"+esc(restaurant.human_name)+"

"+"\n"#+base.formt(food) + if "pos" in options and restaurant.pos and "dist" in options : + ## display distance to restaurant + r=r+"
Distance: %.2f km
\n" % base.dist(options["pos"], restaurant.pos) + food.sort(key=lambda foo: foo.category) for i in food: if options["only_student_prices"] : @@ -29,7 +33,7 @@ class HTMLRenderer(IPlugin) : r=r+"
  • " + esc(i.name) + ""+ esc(price) + ""+ esc(vegkeys[i.veggie])+"\n" if i.desc : r = r+"
    "+esc(i.desc)+"
    \n" - r = r+"
  • " + r = r+"" r = r print(r) diff --git a/mensa/frontends/plain-text.py b/mensa/frontends/plain-text.py index 9147133..36b2a34 100644 --- a/mensa/frontends/plain-text.py +++ b/mensa/frontends/plain-text.py @@ -10,6 +10,9 @@ class TextRenderer(IPlugin) : if not food : continue r = r+"*"*20+restaurant.human_name+"*"*20+"\n"#+base.formt(food) + if "pos" in options and restaurant.pos and "dist" in options : + ## display distance to restaurant + r=r+"Distance: %.2f km\n" % base.dist(options["pos"], restaurant.pos) food.sort(key=lambda foo: foo.category) for i in food: if options["only_student_prices"] : -- cgit v1.2.3