<div dir="ltr">Aneesh,<div>Can you make a new release including this patch?</div><div><br></div><div>Gonzalo</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 15, 2013 at 11:23 AM, Daniel Francis <span dir="ltr"><<a href="mailto:francis@sugarlabs.org" target="_blank">francis@sugarlabs.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Most of the new code is copied from chat activity.<br>
<br>
Signed-off-by: Daniel Francis <<a href="mailto:francis@sugarlabs.org">francis@sugarlabs.org</a>><br>
Signed-off-by: Franco Correa <<a href="mailto:franco@francocorrea.com.uy">franco@francocorrea.com.uy</a>><br>
Signed-off-by: Ezequiel Pereira <<a href="mailto:eze2307@gmail.com">eze2307@gmail.com</a>><br>
---<br>
LevelActivity.py | 40 +++++++++++++++++++++++++++++++---------<br>
1 file changed, 31 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/LevelActivity.py b/LevelActivity.py<br>
index ca5a19d..e8733cc 100644<br>
--- a/LevelActivity.py<br>
+++ b/LevelActivity.py<br>
@@ -17,13 +17,20 @@<br>
<br>
from gi.repository import Gtk<br>
from gi.repository import GObject<br>
-from sugar3.activity import widgets<br>
from sugar3.activity.widgets import StopButton<br>
from sugar3.activity import activity<br>
from math import pi, sqrt<br>
from gettext import gettext as _<br>
from collections import deque<br>
<br>
+import logging<br>
+logger = logging.getLogger('level-tool')<br>
+<br>
+from sugar3.graphics.toolbarbox import ToolbarBox<br>
+from sugar3.activity.widgets import ActivityButton<br>
+from sugar3.activity.widgets import TitleEntry<br>
+from sugar3.activity.widgets import StopButton<br>
+<br>
ACCELEROMETER_DEVICE = '/sys/devices/platform/lis3lv02d/position'<br>
#ACCELEROMETER_DEVICE = 'a.txt'<br>
<br>
@@ -165,20 +172,35 @@ class MyCanvas(Gtk.DrawingArea):<br>
<br>
self.queue_draw()<br>
<br>
+<br>
+<br>
class LevelActivity(activity.Activity):<br>
def __init__(self, handle):<br>
"The entry point to the Activity"<br>
activity.Activity.__init__(self, handle)<br>
<br>
- toolbox = widgets.ActivityToolbar(self)<br>
- toolbox.share.props.visible = False<br>
-<br>
- stop_button = StopButton(self)<br>
- stop_button.show()<br>
- toolbox.insert(stop_button, -1)<br>
+ toolbar_box = ToolbarBox()<br>
<br>
- self.set_toolbar_box(toolbox)<br>
- toolbox.show()<br>
+ toolbar_box.toolbar.insert(ActivityButton(self), -1)<br>
+ toolbar_box.toolbar.insert(TitleEntry(self), -1)<br>
+ try:<br>
+ from sugar3.activity.widgets import DescriptionItem<br>
+ except ImportError:<br>
+ logger.debug('DescriptionItem button is not available, ' \<br>
+ 'toolkit version < 0.96')<br>
+ else:<br>
+ description_item = DescriptionItem(self)<br>
+ toolbar_box.toolbar.insert(description_item, -1)<br>
+ description_item.show()<br>
+ separator = Gtk.SeparatorToolItem()<br>
+ separator.props.draw = False<br>
+ separator.set_expand(True)<br>
+ toolbar_box.toolbar.insert(separator, -1)<br>
+<br>
+ toolbar_box.toolbar.insert(StopButton(self), -1)<br>
+ toolbar_box.show_all()<br>
+ self.set_toolbar_box(toolbar_box)<br>
+ toolbar_box.show()<br>
<br>
# Draw the canvas<br>
self._canvas = MyCanvas()<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.4<br>
<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</font></span></blockquote></div><br></div>