Hmm, I have solved the same error in Read yesterday. I should tell you. Or may be we should add code in icon to convert to str if the parameter is unicode?
Gonzalo On Thu, Mar 29, 2012 at 11:50 AM, Manuel Quiñones <[email protected]> wrote: > Color parameter in get_image() method of class LinkButton is being > passed with type str when inside a session, but is type unicode when > read from a previous session, because json stores unicode. And > Rsvg.Handle.new_from_data() needs a single byte string. > > This fixes #3402 . > > Also removed unused parameters in LinkButton constructor. > > Signed-off-by: Manuel Quiñones <[email protected]> > --- > linkbutton.py | 7 ++++++- > webactivity.py | 2 +- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/linkbutton.py b/linkbutton.py > index 2804397..d1b4ea9 100644 > --- a/linkbutton.py > +++ b/linkbutton.py > @@ -40,8 +40,13 @@ class LinkButton(TrayButton, GObject.GObject): > None, ([str])), > } > > - def __init__(self, url, buf, color, title, owner, index, hash): > + def __init__(self, buf, color, title, owner, hash): > TrayButton.__init__(self) > + > + # Color read from the Journal may be Unicode, but Rsvg needs > + # it as single byte string: > + if isinstance(color, unicode): > + color = str(color) > self.set_image(buf, color.split(',')[1], color.split(',')[0]) > > self.hash = hash > diff --git a/webactivity.py b/webactivity.py > index e156173..aadc29a 100644 > --- a/webactivity.py > +++ b/webactivity.py > @@ -518,7 +518,7 @@ class WebActivity(activity.Activity): > > def _add_link_totray(self, url, buf, color, title, owner, index, hash): > ''' add a link to the tray ''' > - item = LinkButton(url, buf, color, title, owner, index, hash) > + item = LinkButton(buf, color, title, owner, hash) > item.connect('clicked', self._link_clicked_cb, url) > item.connect('remove_link', self._link_removed_cb) > # use index to add to the tray > -- > 1.7.7.6 > > _______________________________________________ > Sugar-devel mailing list > [email protected] > http://lists.sugarlabs.org/listinfo/sugar-devel >
_______________________________________________ Sugar-devel mailing list [email protected] http://lists.sugarlabs.org/listinfo/sugar-devel

