[Sugar-devel] [PATCH sugar-toolkit-gtk3] Remove support for the old deprecated toolbar

Simon Schampijer simon at schampijer.de
Wed Jan 11 13:55:45 EST 2012


- removed deprecated imports from the activity module, use the
  widgets module instead
- removed the ActivityToolbox class
- removed the Stop button from the ActivityToolbar
- removed set_toolbar/get_toolbar API from the window module

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/sugar3/activity/activity.py |    4 ---
 src/sugar3/activity/widgets.py  |   42 +--------------------------------------
 src/sugar3/graphics/window.py   |   12 -----------
 3 files changed, 1 insertions(+), 57 deletions(-)

diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py
index 3c1a2f3..f772679 100644
--- a/src/sugar3/activity/activity.py
+++ b/src/sugar3/activity/activity.py
@@ -86,10 +86,6 @@ from sugar3.datastore import datastore
 from sugar3.session import XSMPClient
 from sugar3 import wm
 
-# support deprecated imports
-from sugar3.activity.widgets import ActivityToolbar, EditToolbar
-from sugar3.activity.widgets import ActivityToolbox
-
 
 _ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
 
diff --git a/src/sugar3/activity/widgets.py b/src/sugar3/activity/widgets.py
index 999a080..3f67300 100644
--- a/src/sugar3/activity/widgets.py
+++ b/src/sugar3/activity/widgets.py
@@ -68,7 +68,6 @@ class ActivityToolbarButton(ToolbarButton):
 
     def __init__(self, activity, **kwargs):
         toolbar = ActivityToolbar(activity, orientation_left=True)
-        toolbar.stop.hide()
 
         ToolbarButton.__init__(self, page=toolbar, **kwargs)
 
@@ -215,12 +214,7 @@ class TitleEntry(Gtk.ToolItem):
 
 
 class ActivityToolbar(Gtk.Toolbar):
-    """The Activity toolbar with the Journal entry title, sharing
-       and Stop buttons
-
-    All activities should have this toolbar. It is easiest to add it to your
-    Activity by using the ActivityToolbox.
-    """
+    """The Activity toolbar with the Journal entry title and sharing button"""
 
     def __init__(self, activity, orientation_left=False):
         Gtk.Toolbar.__init__(self)
@@ -244,10 +238,6 @@ class ActivityToolbar(Gtk.Toolbar):
         self.share.show()
         self.insert(self.share, -1)
 
-        self.stop = StopButton(activity)
-        self.insert(self.stop, -1)
-        self.stop.show()
-
 
 class EditToolbar(Gtk.Toolbar):
     """Provides the standard edit toolbar for Activities.
@@ -306,33 +296,3 @@ class EditToolbar(Gtk.Toolbar):
         self.paste = PasteButton()
         self.insert(self.paste, -1)
         self.paste.show()
-
-
-class ActivityToolbox(Toolbox):
-    """Creates the Toolbox for the Activity
-
-    By default, the toolbox contains only the ActivityToolbar. After creating
-    the toolbox, you can add your activity specific toolbars, for example the
-    EditToolbar.
-
-    To add the ActivityToolbox to your Activity in MyActivity.__init__() do:
-
-        # Create the Toolbar with the ActivityToolbar:
-        toolbox = activity.ActivityToolbox(self)
-        ... your code, inserting all other toolbars you need, like EditToolbar
-
-        # Add the toolbox to the activity frame:
-        self.set_toolbar_box(toolbox)
-        # And make it visible:
-        toolbox.show()
-    """
-
-    def __init__(self, activity):
-        Toolbox.__init__(self)
-
-        self._activity_toolbar = ActivityToolbar(activity)
-        self.add_toolbar(_('Activity'), self._activity_toolbar)
-        self._activity_toolbar.show()
-
-    def get_activity_toolbar(self):
-        return self._activity_toolbar
diff --git a/src/sugar3/graphics/window.py b/src/sugar3/graphics/window.py
index 965aecd..d7753e0 100644
--- a/src/sugar3/graphics/window.py
+++ b/src/sugar3/graphics/window.py
@@ -285,15 +285,3 @@ class Window(Gtk.Window):
 
     enable_fullscreen_mode = GObject.property(type=object,
         setter=set_enable_fullscreen_mode, getter=get_enable_fullscreen_mode)
-
-    # DEPRECATED
-
-    def set_toolbox(self, toolbar_box):
-        warnings.warn('use toolbar_box instead of toolbox', DeprecationWarning)
-        self.set_toolbar_box(toolbar_box)
-
-    def get_toolbox(self):
-        warnings.warn('use toolbar_box instead of toolbox', DeprecationWarning)
-        return self._toolbar_box
-
-    toolbox = property(get_toolbox, set_toolbox)
-- 
1.7.7.5



More information about the Sugar-devel mailing list