diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2022-05-18 12:56:52 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2022-05-18 12:56:52 +0200 |
commit | 9bccb42bba3e59edc3c66dfcd2ce80557e977ba1 (patch) | |
tree | 3e2c1b8a9e6bce1e2cc03e4d7a3936850abc1b38 /mensa/frontends | |
parent | 971f633eaadec381bda398f024bab42fa1311bd0 (diff) | |
download | mensa-9bccb42bba3e59edc3c66dfcd2ce80557e977ba1.tar.gz mensa-9bccb42bba3e59edc3c66dfcd2ce80557e977ba1.tar.bz2 mensa-9bccb42bba3e59edc3c66dfcd2ce80557e977ba1.zip |
Fix stw nonsense, add option to ignore boring stuff
bump version to 0.6
Diffstat (limited to 'mensa/frontends')
-rw-r--r-- | mensa/frontends/plain-text.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mensa/frontends/plain-text.py b/mensa/frontends/plain-text.py index cbd71e7..57e1648 100644 --- a/mensa/frontends/plain-text.py +++ b/mensa/frontends/plain-text.py @@ -1,5 +1,6 @@ from mensa import base from yapsy.IPlugin import IPlugin +import textwrap class TextRenderer(IPlugin) : def render_line(self, item) : vegkeys = [ "", "Vegetarian", "Vegan" ] @@ -7,8 +8,11 @@ class TextRenderer(IPlugin) : return "" desc = "" if item.desc : - desc = "\t "+item.desc+"\n" - return "\t" + item.name.ljust(80) + "\t"+ item.price.ljust(20) + vegkeys[item.veggie]+"\n"+desc + desc = " "+item.desc+"\n" + nameparts = textwrap.wrap(item.name, 60) + l = [ " " + nameparts[0].ljust(60) + " " + item.price.ljust(19) + vegkeys[item.veggie] ] + [ " "+ i.ljust(50) for i in nameparts[1:]] + # "\t" + item.name.ljust(80) + "\t"+ item.price.ljust(20) + vegkeys[item.veggie]+"\n"+desc + return "\n".join(l) + "\n" def render (self, foods, **options) : self.options = options |