New argument to not generate certain modules
This commit is contained in:
parent
0644bdc68f
commit
70f0c81fcc
11
main.py
11
main.py
@ -45,7 +45,7 @@ class WidgetPlacement:
|
|||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
|
|
||||||
|
|
||||||
def main(only_on_coming_evt=False):
|
def main(only_on_coming_evt=False, ignore_module=[]):
|
||||||
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)
|
||||||
@ -118,6 +118,10 @@ def main(only_on_coming_evt=False):
|
|||||||
last_height = 0
|
last_height = 0
|
||||||
last_y = 0
|
last_y = 0
|
||||||
for s in shape:
|
for s in shape:
|
||||||
|
if s.module.__name__ in ignore_module:
|
||||||
|
logging.info("Skip module " + s.module.__name__ + ", as requested by arguments")
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
x,y = s.position
|
x,y = s.position
|
||||||
if y < 0:
|
if y < 0:
|
||||||
@ -150,6 +154,7 @@ def main(only_on_coming_evt=False):
|
|||||||
image.paste(mod, (0, 580-mod.height-5), mod)
|
image.paste(mod, (0, 580-mod.height-5), mod)
|
||||||
|
|
||||||
# températures
|
# températures
|
||||||
|
if "WeatherTemperatureModule" not in ignore_module:
|
||||||
from modules.weather import WeatherTemperatureModule
|
from modules.weather import WeatherTemperatureModule
|
||||||
if mod.height > 260:
|
if mod.height > 260:
|
||||||
image.paste(WeatherTemperatureModule().draw_module(config, 480, 200 - mod.height+260), (0, 580 + mod.height-260))
|
image.paste(WeatherTemperatureModule().draw_module(config, 480, 200 - mod.height+260), (0, 580 + mod.height-260))
|
||||||
@ -184,9 +189,11 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(description='E-ink status generator.')
|
parser = argparse.ArgumentParser(description='E-ink status generator.')
|
||||||
|
|
||||||
|
parser.add_argument('--ignore-module', '-I', nargs="*", default=[],
|
||||||
|
help='Ignore the given modules')
|
||||||
parser.add_argument('--only-on-coming-evt', '-O', action='store_const', const=True,
|
parser.add_argument('--only-on-coming-evt', '-O', action='store_const', const=True,
|
||||||
help='Refresh screen only if there is upcoming event')
|
help='Refresh screen only if there is upcoming event')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
main(args.only_on_coming_evt)
|
main(args.only_on_coming_evt, args.ignore_module)
|
||||||
|
Loading…
Reference in New Issue
Block a user