Defining any values for a scene sprite throws a KeyError
Closed this issue · 2 comments
jeremyfry commented
Partial config:
sprites:
scroll:
type: FancyText
text: Test
dx: -1
ticks_per_movement: 1
icon:
type: Image
path: /home/pi/icons/message.ppm
scenes:
notification:
sprites:
- icon:
- scroll:
x: 0
y: 0
Any values assigned to a sprite in a scene causes a KeyError to be generated.
INFO:infopanel.driver:Starting InfoPanel.
DEBUG:infopanel.sprites:Build <FancyText at 0, 0. dx/dy: (-1, 0), size: (32, 32)>
DEBUG:PIL.Image:Error closing: 'NoneType' object has no attribute 'close'
DEBUG:infopanel.sprites:Build <Image at 0, 0. dx/dy: (0, 0), size: (32, 32)>
DEBUG:infopanel.scenes:Initializing <class 'infopanel.scenes.Scene'>
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/infopanel-0.1-py2.7.egg/infopanel/__main__.py", line 4, in <module>
driver.run()
File "/usr/local/lib/python2.7/dist-packages/infopanel-0.1-py2.7.egg/infopanel/driver.py", line 206, in run
infopanel = driver_factory(disp, datasrc, conf)
File "/usr/local/lib/python2.7/dist-packages/infopanel-0.1-py2.7.egg/infopanel/driver.py", line 184, in driver_factory
conf['scenes'], driver.sprites)
File "/usr/local/lib/python2.7/dist-packages/infopanel-0.1-py2.7.egg/infopanel/scenes.py", line 100, in scene_factory
sprite = copy.copy(existing_sprites[spritename][0])
KeyError: 'y'
jeremyfry commented
A little more debugging this morning. It seems that the yaml parser is getting the wrong values for the sprites list. sprite_data.items() in scenes.py is showing the following for a sprite:
[('y',0), ('x',0), ('scroll', None)]
jeremyfry commented
And I don't know how YAML works. If someone else comes across this
- scroll:
x: 0
y: 0
Is equivalent to
{
scroll: null,
x: 0,
y: 0,
}
You want
- scroll:
x: 0
y: 0
The extra two spaces before the x and y create this:
{
scroll: {
x: 0,
y: 0
}
}