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

Bert Freudenberg bert at freudenbergs.de
Mon Mar 29 18:37:22 EDT 2010


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