[Sugar-devel] [PATCH] Add description item to the toolbar if available - SL# 3525

Gonzalo Odiard gonzalo at laptop.org
Thu Apr 26 09:56:27 EDT 2012


Ok

Gonzalo

On Thu, Apr 26, 2012 at 10:37 AM, Simon Schampijer <simon at schampijer.de>wrote:

> On 04/26/2012 02:24 PM, godiard at sugarlabs.org wrote:
>
>> From: Gonzalo Odiard<godiard at gmail.com>
>>
>> The activity have a custom toolbar, then need add the DescriptionItem
>> to implement the feature "Write to Journal Anytime"
>>
>> http://wiki.sugarlabs.org/go/**Features/Write_to_journal_**anytime<http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime>
>>
>> Signed-off-by: Gonzalo Odiard<gonzalo at laptop.org>
>> ---
>>  activity.py |    8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/activity.py b/activity.py
>> index b885842..34a0e68 100644
>> --- a/activity.py
>> +++ b/activity.py
>> @@ -67,6 +67,14 @@ class Chat(activity.Activity):
>>          toolbar_box.toolbar.insert(**ActivityButton(self), -1)
>>          toolbar_box.toolbar.insert(**TitleEntry(self), -1)
>>
>> +        try:
>> +            from sugar.activity.widgets import DescriptionItem
>> +            description_item = DescriptionItem(self)
>> +            toolbar_box.toolbar.insert(**description_item, -1)
>> +            description_item.show()
>> +        except:
>> +            pass
>> +
>>          share_button = ShareButton(self)
>>          toolbar_box.toolbar.insert(**share_button, -1)
>>
>>
> I would do:
>
> try:
>    from sugar.activity.widgets import DescriptionItem
> except ImportError:
>    logging.debug('DescriptionItem button is not available, toolkit version
> < 0.96')
> else:
>    description_item = DescriptionItem(self)
>    ...
>
> Regards,
>   Simon
>
> ______________________________**_________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.**org <Sugar-devel at lists.sugarlabs.org>
> http://lists.sugarlabs.org/**listinfo/sugar-devel<http://lists.sugarlabs.org/listinfo/sugar-devel>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120426/cc5446c3/attachment.html>


More information about the Sugar-devel mailing list