[Sugar-devel] Use ObjectChooser filtering by activity

Gonzalo Odiard gonzalo at laptop.org
Thu Jun 13 08:48:15 EDT 2013


I am trying to solve AU ticket #2439 in a way than can be upstreamed.

The problem is with the limitations about how we define our generic mime
types.
In this case, "Text files" are defined as all the files than can be edited
by Write,
but that is not useful for Read, because can't open open office or abiword
files
and crashes.

A similar problem happen in the Jukebox activity, because we have defined
"Audio files"
and "Video Files", but not "Multimedia" or "Audio and Video".

Looking at the code, I found is possible do:

chooser = ObjectChooser(None, what_filter=self.get_bundle_id())

instead of:

chooser = ObjectChooser(None, what_filter=mime.GENERIC_TYPE_TEXT)

and that work in the Journal, filtering all the files availables for the
activity.

I think this is good to know for activity developers.

This does not work in Documents or external devices, the "activity"
parameter
is ignored. I filled the ticket [2] and will provide a patch

Gonzalo

[1] https://sugardextrose.org/issues/2439

[2] http://bugs.sugarlabs.org/ticket/4523
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130613/63838f7f/attachment-0001.html>


More information about the Sugar-devel mailing list