[Sugar-devel] [PATCH] fix two trivial shell.log warnings

James Cameron quozl at laptop.org
Thu May 13 19:52:42 EDT 2010


On Thu, May 13, 2010 at 09:07:53PM +0200, Sascha Silbe wrote:
> I meant to dig into this myself, but don't have time to do it anymore,
> so I'll just ask you: AFAICT these are all supposed to be on-screen
> coordinates, which are by definition integers. So how come they are
> actually floats (sometimes)? What fills them in (the class itself
> doesn't)?

The float is provided by the favourites ring layout.  Here's the stack
trace of my detection of the origin of type float in the width or height
properties of the _IconBuffer instance:

  File "/usr/bin/sugar-session", line 185, in <module>
    main()
  File "/usr/bin/sugar-session", line 181, in main
    gtk.main()
  File "jarabe/desktop/favoritesview.py", line 196, in do_size_allocate
    hippo.Canvas.do_size_allocate(self, allocation)
  File "jarabe/desktop/favoriteslayout.py", line 275, in do_allocate
    child.item.props.size = icon_size
  File "gtk-2.0/gobject/__init__.py", line 108, in obj_set_property
    prop.setter(self, value)
  File "sugar/graphics/icon.py", line 734, in set_size

> Doing the conversion here feels like patching over the symptom
> instead of fixing the root cause.

Yes, the root cause is code in favoriteslayout.py, but since we
encourage children to work there, and they might give us a float, I
think it is entirely reasonable to code defensively and convert that
float to an int before handing it to GTK+.

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list