[Sugar-devel] [PATCH sugar] Example objects support

Bert Freudenberg bert at freudenbergs.de
Tue Aug 21 14:36:50 EDT 2012


On 2012-08-21, at 15:38, Sascha Silbe wrote:

> Martin Abente Lahaye <martin.abente.lahaye at gmail.com> writes:
> 
>> +    def _add_activity_example(self, home_activity):
>> +        examples_path = os.path.join(home_activity.get_bundle_path(),
>> +                                    'examples')
>> +
>> +        if not os.path.exists(examples_path):
>> +            return
> 
> If you add a guard against home_activity.get_bundle_path() returning
> None, you can drop the special-casing for the Journal activity.


I like the general idea very much. However, instead of a magic directory name, couldn't the activity.info file have a new entry giving the examples path?

This could be encapsulated in a function home_activity.get_examples_path().

The advantage of this would be that activities could specify a directory (relative to the bundle directory) that fits their structure better than having to put the examples into a fixed location in the bundle. In very special cases they could even give an absolute path, e.g. Etoys examples are in /usr/share/etoys/ExampleEtoys ...

- Bert -



More information about the Sugar-devel mailing list