[Sugar-devel] Advice request: XO sound recording

Sascha Silbe sascha-ml-reply-to-2010-3 at silbe.org
Sun Oct 3 17:19:57 EDT 2010


Excerpts from Art Hunkins's message of Sun Oct 03 21:00:19 +0200 2010:

> Please indicate where, in your wonderful manual (or elsewhere), I can find a 
> simple example of retreiving Journal entries. (I cannot readily locate one.) 
> I need to retrieve an Ogg Vorbis (.ogg) or other audio file, and insert it 
> as a filename string in my script. Presumably this process would be 
> instigated by a button press.

What you're looking for is the Object Chooser [1,2]. It doesn't seem to
be mentioned in MYOSA, but there are several activities that use it. One
of them is Turtle Blocks (nee Turtle Art). See
TurtleArtActivity.import_py() [3]. You can tell the Object Chooser what
kind of Journal entries you are interested in by passing it the name of
a "generic MIME type" collection or the bundle ID of an activity in the
what_filter parameter (yes, this API is awkward and could do with some
improvement). E.g.:

    chooser = ObjectChooser(parent=self, what_filter=mime.GENERIC_TYPE_AUDIO)

The MIME type collections are defined in sugar.mime [4]. Currently
supported types include text, images, audio, video and links. There is
no way to filter for a single MIME type (e.g. only Ogg Vorbis audio
files) or anything else than the predefined collections.

Sascha

PS: Please remember to trim your quotes.
[1] https://api.sugarlabs.org/epydocs/sugar.graphics.objectchooser.ObjectChooser-class.html
[2] https://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API#Choosing_Objects
[3] http://git.sugarlabs.org/projects/turtleart/repos/mainline/blobs/master/TurtleArtActivity.py#line256
[4] https://api.sugarlabs.org/epydocs/sugar.mime-module.html#GENERIC_TYPE_TEXT
--
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101003/554bf2a8/attachment-0001.pgp 


More information about the Sugar-devel mailing list