[Sugar-devel] New Chapter in Make Your Own Sugar Activities needs review

James Simmons nicestep at gmail.com
Tue Mar 30 10:46:51 EDT 2010


Bert and Sascha,

In the book I'm trying to encourage practices that work in multiple
versions of Sugar.  I tried what Bert proposed last night and it
worked fine, so that's what I'm going to write up in the book.  The
book is for beginners (mostly) so I'm trying to avoid burdening the
reader with information he has no use for.

The latest changes to Sugar Commander are in Git:

http://git.sugarlabs.org/projects/sugar-commander

I'm going to test this on my XO at lunch.  It's already worked fine in
testing on F10 and F11.  If I don't see any issues I'll update ASLO
and the book.  In the meantime, if you want to check my code and make
suggestions I'd be grateful.

Thanks,

James Simmons


> Date: Tue, 30 Mar 2010 00:37:22 +0200
> From: Bert Freudenberg <bert at freudenbergs.de>
> Subject: Re: [Sugar-devel] New Chapter in Make Your Own Sugar
>        Activities      needs review
> To: Sugar Devel <sugar-devel at lists.sugarlabs.org>
> Message-ID: <CCCB0FD7-5345-4D6D-820E-4C98CB13CC2F at freudenbergs.de>
> Content-Type: text/plain; charset=us-ascii
>
> On 30.03.2010, at 00:23, Sascha Silbe wrote:
>>
>> On Mon, Mar 29, 2010 at 01:21:01PM +0200, Bert Freudenberg wrote:
>>
>>> Since the signals necessary for [listening to data store updates] are not exposed in the higher-level datastore abstractions, you need to go down to the D-Bus level (lifted from jarabe/journal/model.py):
>> Actually as of 0.88 they are - check out sugar.datastore.datastore.{created,updated,deleted}.
>
> Great! Still, any activity that's supposed to work on older versions can't rely on this.
>
>>> And if you wanted to get really fancy you could mention how to add a progress bar while creating a datastore entry. You might have noticed the Browse activity doing that - if you start downloading a file and switch to the Journal, the entry shows a progress bar.
>>> If Sugar Commander copies a large file into the Journal, it could do the same.
>> Please don't. The progress bar works by updating the 'progress' property of the entry. Since the current data store does not support metadata-only updates, this means submitting the entire file over and over again.
>
> Err, I did not imply that. Who would ever do this ;)
>
>> You could copy the file to some temporary location first and use the progress bar for that part of the operation (as the data store entry doesn't contain any data yet at that point this is cheap enough), but doing two copies is usually a bad idea.
>
> No, you would copy the file from the USB drive to the activity's instance directory, while showing progress in an empty DS entry. Only when done, you submit the file to the DS using transfer_ownership=True. There are no two copies, just the one that's necessary anyway. Here is pseudo code for that:
>
> http://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API#Progress_Display
>
> - Bert -


More information about the Sugar-devel mailing list