Ok<div><br></div><div>Gonzalo<br><br><div class="gmail_quote">On Thu, Apr 26, 2012 at 10:37 AM, Simon Schampijer <span dir="ltr"><<a href="mailto:simon@schampijer.de" target="_blank">simon@schampijer.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 04/26/2012 02:24 PM, <a href="mailto:godiard@sugarlabs.org" target="_blank">godiard@sugarlabs.org</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Gonzalo Odiard<<a href="mailto:godiard@gmail.com" target="_blank">godiard@gmail.com</a>><br>
<br>
The activity have a custom toolbar, then need add the DescriptionItem<br>
to implement the feature "Write to Journal Anytime"<br>
<br>
<a href="http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime" target="_blank">http://wiki.sugarlabs.org/go/<u></u>Features/Write_to_journal_<u></u>anytime</a><br>
<br>
Signed-off-by: Gonzalo Odiard<<a href="mailto:gonzalo@laptop.org" target="_blank">gonzalo@laptop.org</a>><br>
---<br>
activity.py | 8 ++++++++<br>
1 file changed, 8 insertions(+)<br>
<br>
diff --git a/activity.py b/activity.py<br>
index b885842..34a0e68 100644<br>
--- a/activity.py<br>
+++ b/activity.py<br>
@@ -67,6 +67,14 @@ class Chat(activity.Activity):<br>
toolbar_box.toolbar.insert(<u></u>ActivityButton(self), -1)<br>
toolbar_box.toolbar.insert(<u></u>TitleEntry(self), -1)<br>
<br>
+ try:<br>
+ from sugar.activity.widgets import DescriptionItem<br>
+ description_item = DescriptionItem(self)<br>
+ toolbar_box.toolbar.insert(<u></u>description_item, -1)<br>
+ description_item.show()<br>
+ except:<br>
+ pass<br>
+<br>
share_button = ShareButton(self)<br>
toolbar_box.toolbar.insert(<u></u>share_button, -1)<br>
<br>
</blockquote>
<br></div></div>
I would do:<br>
<br>
try:<br>
from sugar.activity.widgets import DescriptionItem<br>
except ImportError:<br>
logging.debug('DescriptionItem button is not available, toolkit version < 0.96')<br>
else:<br>
description_item = DescriptionItem(self)<br>
...<br>
<br>
Regards,<br>
Simon<br>
<br>
______________________________<u></u>_________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.<u></u>org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/<u></u>listinfo/sugar-devel</a><br>
</blockquote></div><br></div>