[Sugar-devel] setting svg icon as datastore metadata?
James Simmons
nicestep at gmail.com
Fri Dec 3 17:53:07 EST 2010
Erik,
Every Journal entry has an 'activity' field which stores the bundle id
of the Activity that created it. That is what gives you the icon. If
your Journal entry has a MIME type but no activity then the icon is
for the MIME type.
I wanted Read Etexts to give its Activity icon to the Journal entries
it read, so that by default these entries would open in Read Etexts
and not in one of the other Activities that support that MIME type. I
describe how to do this in the "Add Refinements" chapter of the book:
"In a normal Activity that writes out a file in write_file() this next
line would be unnecessary:
self.metadata['activity'] = self.get_bundle_id()
"Any Journal entry created by an Activity will automatically have this
property set. In the case of Pride and Prejudice, our Activity did not
create it. We are able to read it because our Activity supports its
MIME type. Unfortunately, that MIME type, application/zip, is used by
other Activities. I found it very frustrating to want to open a book
in Read Etexts and accidentally have it opened in EToys instead. This
line of code solves that problem. You only need to use Start Using...
the first time you read a book. After that the book will use the Read
Etexts icon and can be resumed with a single click.
"This does not at all affect the MIME type of the Journal entry, so if
you wanted to deliberately open Pride and Prejudice with Etoys it is
still possible. "
Giving a Journal entry some arbitrary icon is not possible. It needs
to be associated with either an Activity or a MIME type.
James Simmons
On Fri, Dec 3, 2010 at 3:51 PM, Erik Blankinship <erikb at mediamods.com> wrote:
> Can I set my own svg icon as metadata for a datastore entry? How would I do
> that?
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
More information about the Sugar-devel
mailing list