Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2013-11-25 18:57:12 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2013-11-25 18:57:12 (GMT)
commitc1a313335bd25ae30155d69081bfea3686c28776 (patch)
tree35b104017e7a722353a8c5f68b2b8782bd8d352f
parent780f7a1cb3ed4b3e3adc23e44cf9764c135b1d9a (diff)
Adding the stopbutton automatically
Signed-off-by: Agustin Zubiaga <aguz@sugarlabs.org>
-rw-r--r--simpleactivity.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/simpleactivity.py b/simpleactivity.py
index 4573704..11a4bf1 100644
--- a/simpleactivity.py
+++ b/simpleactivity.py
@@ -82,6 +82,14 @@ class SimpleActivity(activity.Activity):
self.activity_toolbar = None
self.toolbarbox = ToolbarBox()
+ self._stopbutton_sep = Gtk.SeparatorToolItem()
+ self._stopbutton_sep.set_draw(False)
+ self._stopbutton_sep.set_expand(True)
+ self.toolbarbox.toolbar.insert(self._stopbutton_sep, -1)
+
+ self._stopbutton = StopButton(self)
+ self.toolbarbox.toolbar.insert(self._stopbutton, -1)
+
if activitytoolbarbutton:
from sugar3.activity.widgets import ActivityToolbarButton
@@ -180,6 +188,13 @@ class SimpleActivity(activity.Activity):
toolbar.insert(item, index)
item.show()
+ if toolbar == self.toolbarbox.toolbar:
+ # Move the StopButton to the end of the toolbar
+ toolbar.remove(self._stopbutton)
+ toolbar.remove(self._stopbutton_sep)
+ toolbar.insert(self._stopbutton_sep, -1)
+ toolbar.insert(self._stopbutton, -1)
+
def add_to_activitytoolbar(self, item, index=-1):
"""Add an item to activity_toolbar"""
if self.activity_toolbar:
@@ -201,13 +216,6 @@ class SimpleActivity(activity.Activity):
self.add_to_toolbar(separator, index=index, toolbar=toolbar)
- def add_stopbutton(self):
- """Appends the stop button to the end of the toolbarbox"""
- self.add_separator(False, True)
-
- stopbutton = StopButton(self)
- self.add_to_toolbar(stopbutton)
-
def get_data_file(self, filename=None):
"""Returns a file in the data/ dir of the activity, where you can
save whatever"""