Okay - sounds good. Is there an api listing of the calls available (or soon to be available)? Or are they listed somewhere in the sugar source code?<br><br><br><div><span class="gmail_quote">On 9/6/06, <b class="gmail_sendername">
Dan Williams</b> <<a href="mailto:dcbw@redhat.com">dcbw@redhat.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Wed, 2006-09-06 at 09:34 -0400, Dan Williams wrote:
<br>> On Wed, 2006-09-06 at 00:41 +0200, Marco Pesenti Gritti wrote:<br>> > Erik Blankinship wrote:<br>> > > Below is a simple sugar app and the log it creates when run on today's<br>> > > build.
<br>> > ><br>> > > There appears to be a problem with:<br>> > > [1] AttributeError: 'crop' object has no attribute '_activity_type'<br>> > > and<br>> > > [2] AttributeError: 'NoneType' object has no attribute 'get_name'
<br>> > ><br>> > > If I remove the Presence calls (just the gtk button), I don't get<br>> > > these errors. Any ideas? Thanks.<br>> > ><br>> > ><br>> > > import gtk<br>
> > ><br>> > > from sugar.activity.Activity import Activity<br>> > > from sugar.presence import PresenceService<br>> > > import logging<br>> > ><br>> > > class crop(Activity):
<br>> > > def __init__(self):<br>> > > Activity.__init__(self)<br>> > ><br>> > > button = gtk.Button('Why am I busted?')<br>> > > self.add(button)<br>
> > > button.show()<br>> > ><br>> > > self._ps = PresenceService.get_instance()<br>> > > me = self._ps.get_owner()<br>> > > name = me.get_name()
<br>> > > logging.info("I am %s" % name)<br>> > > activities = self._ps.get_activities()<br>> > > for act in activities:<br>> > > logging.info
("Activity: %s" % act.get_id())<br>> ><br>> > The presence service owner is initialized asynchronously, so it's<br>> > usually None when then presence service has just been instantiated. Dan<br>
> > should know the details...<br>><br>> Yeah, there should probably be a way to create at least a skeleton Owner<br>> object, if nothing else, before the real one is found on the network.<br>> It seems to be a problem for short-term testing while in the real
<br>> situation the PS would be initialized far before any particular activity<br>> asks for the owner.<br><br>This should be fixed now; but all you really have access to immediately<br>is the owner's name until the first services provided by the owner (ie,
<br>the chat and presence ones) are resolved. Eventually you'll likely have<br>access to the owner's color and such before service resolution too. So<br>you shouldn't need to import and/or init sugar.env.<br><br>Dan<br>
<br>> Dan<br>><br>> > An alternative way to get the nick name is to use sugar.env.get_nick_name()<br>> ><br>> > Marco<br>><br>> _______________________________________________<br>> Sugar mailing list
<br>> <a href="mailto:Sugar@laptop.org">Sugar@laptop.org</a><br>> <a href="http://mailman.laptop.org/mailman/listinfo/sugar">http://mailman.laptop.org/mailman/listinfo/sugar</a><br><br>_______________________________________________
<br>Sugar mailing list<br><a href="mailto:Sugar@laptop.org">Sugar@laptop.org</a><br><a href="http://mailman.laptop.org/mailman/listinfo/sugar">http://mailman.laptop.org/mailman/listinfo/sugar</a><br></blockquote></div><br>