From 500f979302807c10f8d67635c34e07c91d3150b0 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 21 Feb 2007 13:01:20 +0100 Subject: [PATCH] Renamed Button to IconButton. --- shell/view/frame/ActivitiesBox.py | 10 +++++----- shell/view/frame/ZoomBox.py | 14 +++++++------- shell/view/frame/overlaybox.py | 4 ++-- sugar/graphics/Makefile.am | 2 +- sugar/graphics/entry.py | 4 ++-- sugar/graphics/{button.py => iconbutton.py} | 4 ++-- sugar/graphics/label.py | 1 - sugar/graphics/optionmenu.py | 6 +++--- tests/test-entry.py | 4 ++-- tests/test-label.py | 4 ++-- tests/test-option-menu.py | 4 ++-- 11 files changed, 28 insertions(+), 29 deletions(-) rename sugar/graphics/{button.py => iconbutton.py} (98%) diff --git a/shell/view/frame/ActivitiesBox.py b/shell/view/frame/ActivitiesBox.py index 29ca0c72..196309d1 100644 --- a/shell/view/frame/ActivitiesBox.py +++ b/shell/view/frame/ActivitiesBox.py @@ -19,13 +19,13 @@ import logging from sugar.graphics import units from sugar.graphics.iconcolor import IconColor -from sugar.graphics.button import Button +from sugar.graphics.iconbutton import IconButton from sugar.presence import PresenceService from sugar import profile -class ActivityButton(Button): +class ActivityButton(IconButton): def __init__(self, activity): - Button.__init__(self, icon_name=activity.get_icon()) + IconButton.__init__(self, icon_name=activity.get_icon()) self._activity = activity @@ -38,9 +38,9 @@ class ActivityButton(Button): def get_bundle_id(self): return self._activity.get_service_name() -class InviteButton(Button): +class InviteButton(IconButton): def __init__(self, activity, invite): - Button.__init__(self, icon_name=activity.get_icon()) + IconButton.__init__(self, icon_name=activity.get_icon()) self.props.color = activity.get_color() self._invite = invite diff --git a/shell/view/frame/ZoomBox.py b/shell/view/frame/ZoomBox.py index e71fe029..80463f6a 100644 --- a/shell/view/frame/ZoomBox.py +++ b/shell/view/frame/ZoomBox.py @@ -23,7 +23,7 @@ from sugar.graphics.popup import Popup from sugar.graphics.menuicon import MenuIcon from sugar.graphics.menu import Menu from sugar.graphics.iconcolor import IconColor -from sugar.graphics.button import Button +from sugar.graphics.iconbutton import IconButton import sugar class ActivityPopup(Popup): @@ -40,7 +40,7 @@ class ActivityPopup(Popup): self.add_item(ActivityPopup.ACTION_CLOSE, _('Close'), 'theme:stock-close') -class ActivityButton(Button): +class ActivityButton(IconButton): def __init__(self, shell, activity_model): self._shell = shell self._activity_model = activity_model @@ -48,7 +48,7 @@ class ActivityButton(Button): icon_name = self._activity_model.get_icon_name() icon_color = self._activity_model.get_icon_color() - Button.__init__(self, icon_name=icon_name, color=icon_color) + IconButton.__init__(self, icon_name=icon_name, color=icon_color) def get_popup(self): popup = ActivityPopup(self._activity_model) @@ -81,19 +81,19 @@ class ZoomBox(hippo.CanvasBox): self._menu_shell = menu_shell self._activity_icon = None - icon = Button(icon_name='theme:stock-zoom-mesh') + icon = IconButton(icon_name='theme:stock-zoom-mesh') icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_MESH) self.append(icon) - icon = Button(icon_name='theme:stock-zoom-friends') + icon = IconButton(icon_name='theme:stock-zoom-friends') icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_FRIENDS) self.append(icon) - icon = Button(icon_name='theme:stock-zoom-home') + icon = IconButton(icon_name='theme:stock-zoom-home') icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_HOME) self.append(icon) - icon = Button(icon_name='theme:stock-zoom-activity') + icon = IconButton(icon_name='theme:stock-zoom-activity') icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_ACTIVITY) self.append(icon) diff --git a/shell/view/frame/overlaybox.py b/shell/view/frame/overlaybox.py index 2fbbf806..9b0c5ae4 100644 --- a/shell/view/frame/overlaybox.py +++ b/shell/view/frame/overlaybox.py @@ -1,6 +1,6 @@ import hippo -from sugar.graphics.button import Button +from sugar.graphics.iconbutton import IconButton class OverlayBox(hippo.CanvasBox): def __init__(self, shell): @@ -8,7 +8,7 @@ class OverlayBox(hippo.CanvasBox): self._shell = shell - icon = Button(icon_name='theme:stock-chat') + icon = IconButton(icon_name='theme:stock-chat') icon.connect('activated', self._overlay_clicked_cb) self.append(icon) diff --git a/sugar/graphics/Makefile.am b/sugar/graphics/Makefile.am index f0ef20d2..7032066d 100644 --- a/sugar/graphics/Makefile.am +++ b/sugar/graphics/Makefile.am @@ -2,7 +2,7 @@ sugardir = $(pythondir)/sugar/graphics sugar_PYTHON = \ __init__.py \ bubble.py \ - button.py \ + iconbutton.py \ canvasicon.py \ color.py \ ClipboardBubble.py \ diff --git a/sugar/graphics/entry.py b/sugar/graphics/entry.py index 490edb20..02e601e1 100644 --- a/sugar/graphics/entry.py +++ b/sugar/graphics/entry.py @@ -24,7 +24,7 @@ import hippo from sugar.graphics import units from sugar.graphics import color from sugar.graphics import font -from sugar.graphics.button import Button +from sugar.graphics.iconbutton import IconButton from sugar.graphics.roundbox import RoundBox class Entry(hippo.CanvasBox, hippo.CanvasItem): @@ -71,7 +71,7 @@ class Entry(hippo.CanvasBox, hippo.CanvasItem): return gtk.Entry() def add_button(self, icon_name, action_id): - button = Button(icon_name=icon_name) + button = IconButton(icon_name=icon_name) button.props.scale = units.SMALL_ICON_SCALE diff --git a/sugar/graphics/button.py b/sugar/graphics/iconbutton.py similarity index 98% rename from sugar/graphics/button.py rename to sugar/graphics/iconbutton.py index 28c9f59c..80bd52f4 100644 --- a/sugar/graphics/button.py +++ b/sugar/graphics/iconbutton.py @@ -29,8 +29,8 @@ from sugar import profile STANDARD_SIZE = 0 SMALL_SIZE = 1 -class Button(hippo.CanvasBox): - __gtype_name__ = 'Button' +class IconButton(hippo.CanvasBox): + __gtype_name__ = 'SugarIconButton' __gproperties__ = { 'icon-name' : (str, None, None, None, diff --git a/sugar/graphics/label.py b/sugar/graphics/label.py index 61b961e5..044c2360 100644 --- a/sugar/graphics/label.py +++ b/sugar/graphics/label.py @@ -22,7 +22,6 @@ import gtk import hippo from sugar.graphics.roundbox import RoundBox -from sugar.graphics.button import Button from sugar.graphics import color from sugar.graphics import font diff --git a/sugar/graphics/optionmenu.py b/sugar/graphics/optionmenu.py index 3ee8ac25..2e6e4561 100644 --- a/sugar/graphics/optionmenu.py +++ b/sugar/graphics/optionmenu.py @@ -24,7 +24,7 @@ import hippo from sugar.graphics import units from sugar.graphics.roundbox import RoundBox -from sugar.graphics import button +from sugar.graphics import iconbutton from sugar.graphics import color from sugar.graphics import font from sugar.graphics.canvasicon import CanvasIcon @@ -116,8 +116,8 @@ class OptionMenu(hippo.CanvasBox, hippo.CanvasItem): self._round_box.append(self._canvas_text, hippo.PACK_EXPAND) # TODO: Substitute for the right icon. - arrow = button.Button(icon_name='theme:stock-close') - arrow.props.size = button.SMALL_SIZE + arrow = iconbutton.IconButton(icon_name='theme:stock-close') + arrow.props.size = iconbutton.SMALL_SIZE arrow.props.yalign = hippo.ALIGNMENT_CENTER arrow.props.xalign = hippo.ALIGNMENT_START self._round_box.append(arrow) diff --git a/tests/test-entry.py b/tests/test-entry.py index 10beaa20..d83c07d0 100755 --- a/tests/test-entry.py +++ b/tests/test-entry.py @@ -20,7 +20,7 @@ import hippo from sugar.graphics.toolbar import Toolbar from sugar.graphics.frame import Frame -from sugar.graphics.button import Button +from sugar.graphics.iconbutton import IconButton from sugar.graphics.entry import Entry def _entry_activated_cb(entry): @@ -49,7 +49,7 @@ for i in [1, 2]: toolbar = Toolbar() vbox.append(toolbar) - button = Button('theme:stock-close') + button = IconButton('theme:stock-close') toolbar.append(button) BUTTON_DELETE = 1 diff --git a/tests/test-label.py b/tests/test-label.py index eaefa4e2..2a238a26 100755 --- a/tests/test-label.py +++ b/tests/test-label.py @@ -20,7 +20,7 @@ import hippo from sugar.graphics.toolbar import Toolbar from sugar.graphics.label import Label -from sugar.graphics.button import Button +from sugar.graphics.iconbutton import IconButton import os theme = gtk.icon_theme_get_default() @@ -42,7 +42,7 @@ canvas.set_root(vbox) toolbar = Toolbar() vbox.append(toolbar) -button = Button('theme:stock-close') +button = IconButton('theme:stock-close') toolbar.append(button) label = Label('mec moc') diff --git a/tests/test-option-menu.py b/tests/test-option-menu.py index ea627ed8..a3c6e6dc 100755 --- a/tests/test-option-menu.py +++ b/tests/test-option-menu.py @@ -24,7 +24,7 @@ import hippo from sugar.graphics.toolbar import Toolbar from sugar.graphics.optionmenu import OptionMenu -from sugar.graphics.button import Button +from sugar.graphics.iconbutton import IconButton def _option_menu_changed_cb(option_menu): print '_option_menu_activated_cb: %i' % option_menu.props.value @@ -47,7 +47,7 @@ canvas.set_root(vbox) toolbar = Toolbar() vbox.append(toolbar) -button = Button('theme:stock-close') +button = IconButton('theme:stock-close') toolbar.append(button) OPTION_ANYTHING = 1