Remove support for the old deprecated toolbar
- 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@laptop.org> Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org> Acked-by: Daniel Drake <dsd@laptop.org>
This commit is contained in:
parent
ec7b363a70
commit
b5de7ef332
@ -86,10 +86,6 @@ from sugar3.datastore import datastore
|
|||||||
from sugar3.session import XSMPClient
|
from sugar3.session import XSMPClient
|
||||||
from sugar3 import wm
|
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)
|
_ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
|
||||||
|
|
||||||
|
@ -68,7 +68,6 @@ class ActivityToolbarButton(ToolbarButton):
|
|||||||
|
|
||||||
def __init__(self, activity, **kwargs):
|
def __init__(self, activity, **kwargs):
|
||||||
toolbar = ActivityToolbar(activity, orientation_left=True)
|
toolbar = ActivityToolbar(activity, orientation_left=True)
|
||||||
toolbar.stop.hide()
|
|
||||||
|
|
||||||
ToolbarButton.__init__(self, page=toolbar, **kwargs)
|
ToolbarButton.__init__(self, page=toolbar, **kwargs)
|
||||||
|
|
||||||
@ -215,12 +214,7 @@ class TitleEntry(Gtk.ToolItem):
|
|||||||
|
|
||||||
|
|
||||||
class ActivityToolbar(Gtk.Toolbar):
|
class ActivityToolbar(Gtk.Toolbar):
|
||||||
"""The Activity toolbar with the Journal entry title, sharing
|
"""The Activity toolbar with the Journal entry title and sharing button"""
|
||||||
and Stop buttons
|
|
||||||
|
|
||||||
All activities should have this toolbar. It is easiest to add it to your
|
|
||||||
Activity by using the ActivityToolbox.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, activity, orientation_left=False):
|
def __init__(self, activity, orientation_left=False):
|
||||||
Gtk.Toolbar.__init__(self)
|
Gtk.Toolbar.__init__(self)
|
||||||
@ -244,10 +238,6 @@ class ActivityToolbar(Gtk.Toolbar):
|
|||||||
self.share.show()
|
self.share.show()
|
||||||
self.insert(self.share, -1)
|
self.insert(self.share, -1)
|
||||||
|
|
||||||
self.stop = StopButton(activity)
|
|
||||||
self.insert(self.stop, -1)
|
|
||||||
self.stop.show()
|
|
||||||
|
|
||||||
|
|
||||||
class EditToolbar(Gtk.Toolbar):
|
class EditToolbar(Gtk.Toolbar):
|
||||||
"""Provides the standard edit toolbar for Activities.
|
"""Provides the standard edit toolbar for Activities.
|
||||||
@ -306,33 +296,3 @@ class EditToolbar(Gtk.Toolbar):
|
|||||||
self.paste = PasteButton()
|
self.paste = PasteButton()
|
||||||
self.insert(self.paste, -1)
|
self.insert(self.paste, -1)
|
||||||
self.paste.show()
|
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
|
|
||||||
|
@ -285,15 +285,3 @@ class Window(Gtk.Window):
|
|||||||
|
|
||||||
enable_fullscreen_mode = GObject.property(type=object,
|
enable_fullscreen_mode = GObject.property(type=object,
|
||||||
setter=set_enable_fullscreen_mode, getter=get_enable_fullscreen_mode)
|
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)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user