Add option to don't update if no event coming
This commit is contained in:
parent
0768b1f078
commit
d3331efc4b
16
main.py
16
main.py
@ -34,7 +34,7 @@ locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
|
|||||||
|
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
|
||||||
def main():
|
def main(only_on_coming_evt=False):
|
||||||
image = Image.new('1', (480, 800), 255)
|
image = Image.new('1', (480, 800), 255)
|
||||||
#image = Image.new('L', (480, 800), 'white')
|
#image = Image.new('L', (480, 800), 'white')
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
@ -73,6 +73,9 @@ def main():
|
|||||||
nstops = RATPNextStopModule().draw_module(config, ["RB/cite+universitaire", "M7/porte+d'italie"], int(480/1.6), 275)
|
nstops = RATPNextStopModule().draw_module(config, ["RB/cite+universitaire", "M7/porte+d'italie"], int(480/1.6), 275)
|
||||||
image.paste(nstops, (480-int(480/1.6), 255))
|
image.paste(nstops, (480-int(480/1.6), 255))
|
||||||
occuped_space = nstops.height
|
occuped_space = nstops.height
|
||||||
|
elif only_on_coming_evt:
|
||||||
|
# stop here in this case
|
||||||
|
return
|
||||||
|
|
||||||
if occuped_space < 250:
|
if occuped_space < 250:
|
||||||
# weekly weather
|
# weekly weather
|
||||||
@ -141,4 +144,13 @@ def main():
|
|||||||
image.save("screen.png")
|
image.save("screen.png")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
import argparse
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='E-ink status generator.')
|
||||||
|
|
||||||
|
parser.add_argument('--only-on-coming-evt', '-O', action='store_const', const=True,
|
||||||
|
help='Refresh screen only if there is upcoming event')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
main(args.only_on_coming_evt)
|
||||||
|
Loading…
Reference in New Issue
Block a user