Renamed Button to IconButton.

This commit is contained in:
Tomeu Vizoso 2007-02-21 13:01:20 +01:00
parent 6946369ba5
commit 500f979302
11 changed files with 28 additions and 29 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -2,7 +2,7 @@ sugardir = $(pythondir)/sugar/graphics
sugar_PYTHON = \
__init__.py \
bubble.py \
button.py \
iconbutton.py \
canvasicon.py \
color.py \
ClipboardBubble.py \

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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')

View File

@ -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