Donkyhotay / pgu

Automatically exported from code.google.com/p/pgu
GNU Lesser General Public License v2.1
0 stars 0 forks source link

gui.Form.items() raises AttributeError #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make a gui.App() and a gui.Form().
2. Add some widgets with names: t = Table(name='mypanel').
3. print gui_form.items()

What is the expected output? What do you see instead?
Expected:
    Print the items.
Instead:
  File ".../gummworld2/world_editor.py", line 490, in __init__
    self.make_gui()
  File ".../gummworld2/world_editor.py", line 615, in make_gui
    print self.gui_form.items()
  File ".../gummworld2\gamelib\pgu\gui\form.py", line 71, in items
    return self.results().items()
  File ".../gummworld2\gamelib\pgu\gui\form.py", line 66, in results
    r[e.name] = e.value
AttributeError: Table instance has no attribute 'value'

What version of the product are you using? On what operating system?
pgu 0.14, pygame 1.9.1, Python 2.6.6, Windows 7.

Please provide any additional information below.
As a workaround I am doing:

    # Force the form to process _dirty state.
    gui_form['whatever']

    # Directly access.
    gui_form._emap.items()

I have no fix for this. It would take a significant class update. I can try it, 
but you might not like my choices. Looks like the way add() parses the 
arguments, and items() returns the info, the class may be incomplete or 
Container's use of add() is incomplete?

Original issue reported on code.google.com by stabbing...@gmail.com on 28 Jan 2011 at 3:54

GoogleCodeExporter commented 9 years ago
This is now fixed in the repository code. The problem was in handling widgets 
that don't have a defined 'value' field (eg Table). items() should work as 
expected now.

Original comment by peter.ro...@gmail.com on 6 Mar 2011 at 9:18