Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

This commit is contained in:
Dan Williams 2007-02-21 07:07:02 -05:00
commit 0cd1352111
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 import units
from sugar.graphics.iconcolor import IconColor 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.presence import PresenceService
from sugar import profile from sugar import profile
class ActivityButton(Button): class ActivityButton(IconButton):
def __init__(self, activity): def __init__(self, activity):
Button.__init__(self, icon_name=activity.get_icon()) IconButton.__init__(self, icon_name=activity.get_icon())
self._activity = activity self._activity = activity
@ -38,9 +38,9 @@ class ActivityButton(Button):
def get_bundle_id(self): def get_bundle_id(self):
return self._activity.get_service_name() return self._activity.get_service_name()
class InviteButton(Button): class InviteButton(IconButton):
def __init__(self, activity, invite): 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.props.color = activity.get_color()
self._invite = invite self._invite = invite

View File

@ -23,7 +23,7 @@ from sugar.graphics.popup import Popup
from sugar.graphics.menuicon import MenuIcon from sugar.graphics.menuicon import MenuIcon
from sugar.graphics.menu import Menu from sugar.graphics.menu import Menu
from sugar.graphics.iconcolor import IconColor from sugar.graphics.iconcolor import IconColor
from sugar.graphics.button import Button from sugar.graphics.iconbutton import IconButton
import sugar import sugar
class ActivityPopup(Popup): class ActivityPopup(Popup):
@ -40,7 +40,7 @@ class ActivityPopup(Popup):
self.add_item(ActivityPopup.ACTION_CLOSE, _('Close'), self.add_item(ActivityPopup.ACTION_CLOSE, _('Close'),
'theme:stock-close') 'theme:stock-close')
class ActivityButton(Button): class ActivityButton(IconButton):
def __init__(self, shell, activity_model): def __init__(self, shell, activity_model):
self._shell = shell self._shell = shell
self._activity_model = activity_model self._activity_model = activity_model
@ -48,7 +48,7 @@ class ActivityButton(Button):
icon_name = self._activity_model.get_icon_name() icon_name = self._activity_model.get_icon_name()
icon_color = self._activity_model.get_icon_color() 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): def get_popup(self):
popup = ActivityPopup(self._activity_model) popup = ActivityPopup(self._activity_model)
@ -81,19 +81,19 @@ class ZoomBox(hippo.CanvasBox):
self._menu_shell = menu_shell self._menu_shell = menu_shell
self._activity_icon = None 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) icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_MESH)
self.append(icon) 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) icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_FRIENDS)
self.append(icon) 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) icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_HOME)
self.append(icon) 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) icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_ACTIVITY)
self.append(icon) self.append(icon)

View File

@ -1,6 +1,6 @@
import hippo import hippo
from sugar.graphics.button import Button from sugar.graphics.iconbutton import IconButton
class OverlayBox(hippo.CanvasBox): class OverlayBox(hippo.CanvasBox):
def __init__(self, shell): def __init__(self, shell):
@ -8,7 +8,7 @@ class OverlayBox(hippo.CanvasBox):
self._shell = shell self._shell = shell
icon = Button(icon_name='theme:stock-chat') icon = IconButton(icon_name='theme:stock-chat')
icon.connect('activated', self._overlay_clicked_cb) icon.connect('activated', self._overlay_clicked_cb)
self.append(icon) self.append(icon)

View File

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

View File

@ -24,7 +24,7 @@ import hippo
from sugar.graphics import units from sugar.graphics import units
from sugar.graphics import color from sugar.graphics import color
from sugar.graphics import font from sugar.graphics import font
from sugar.graphics.button import Button from sugar.graphics.iconbutton import IconButton
from sugar.graphics.roundbox import RoundBox from sugar.graphics.roundbox import RoundBox
class Entry(hippo.CanvasBox, hippo.CanvasItem): class Entry(hippo.CanvasBox, hippo.CanvasItem):
@ -71,7 +71,7 @@ class Entry(hippo.CanvasBox, hippo.CanvasItem):
return gtk.Entry() return gtk.Entry()
def add_button(self, icon_name, action_id): 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 button.props.scale = units.SMALL_ICON_SCALE

View File

@ -29,8 +29,8 @@ from sugar import profile
STANDARD_SIZE = 0 STANDARD_SIZE = 0
SMALL_SIZE = 1 SMALL_SIZE = 1
class Button(hippo.CanvasBox): class IconButton(hippo.CanvasBox):
__gtype_name__ = 'Button' __gtype_name__ = 'SugarIconButton'
__gproperties__ = { __gproperties__ = {
'icon-name' : (str, None, None, None, 'icon-name' : (str, None, None, None,

View File

@ -22,7 +22,6 @@ import gtk
import hippo import hippo
from sugar.graphics.roundbox import RoundBox from sugar.graphics.roundbox import RoundBox
from sugar.graphics.button import Button
from sugar.graphics import color from sugar.graphics import color
from sugar.graphics import font from sugar.graphics import font

View File

@ -24,7 +24,7 @@ import hippo
from sugar.graphics import units from sugar.graphics import units
from sugar.graphics.roundbox import RoundBox 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 color
from sugar.graphics import font from sugar.graphics import font
from sugar.graphics.canvasicon import CanvasIcon 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) self._round_box.append(self._canvas_text, hippo.PACK_EXPAND)
# TODO: Substitute for the right icon. # TODO: Substitute for the right icon.
arrow = button.Button(icon_name='theme:stock-close') arrow = iconbutton.IconButton(icon_name='theme:stock-close')
arrow.props.size = button.SMALL_SIZE arrow.props.size = iconbutton.SMALL_SIZE
arrow.props.yalign = hippo.ALIGNMENT_CENTER arrow.props.yalign = hippo.ALIGNMENT_CENTER
arrow.props.xalign = hippo.ALIGNMENT_START arrow.props.xalign = hippo.ALIGNMENT_START
self._round_box.append(arrow) self._round_box.append(arrow)

View File

@ -20,7 +20,7 @@ import hippo
from sugar.graphics.toolbar import Toolbar from sugar.graphics.toolbar import Toolbar
from sugar.graphics.frame import Frame from sugar.graphics.frame import Frame
from sugar.graphics.button import Button from sugar.graphics.iconbutton import IconButton
from sugar.graphics.entry import Entry from sugar.graphics.entry import Entry
def _entry_activated_cb(entry): def _entry_activated_cb(entry):
@ -49,7 +49,7 @@ for i in [1, 2]:
toolbar = Toolbar() toolbar = Toolbar()
vbox.append(toolbar) vbox.append(toolbar)
button = Button('theme:stock-close') button = IconButton('theme:stock-close')
toolbar.append(button) toolbar.append(button)
BUTTON_DELETE = 1 BUTTON_DELETE = 1

View File

@ -20,7 +20,7 @@ import hippo
from sugar.graphics.toolbar import Toolbar from sugar.graphics.toolbar import Toolbar
from sugar.graphics.label import Label from sugar.graphics.label import Label
from sugar.graphics.button import Button from sugar.graphics.iconbutton import IconButton
import os import os
theme = gtk.icon_theme_get_default() theme = gtk.icon_theme_get_default()
@ -42,7 +42,7 @@ canvas.set_root(vbox)
toolbar = Toolbar() toolbar = Toolbar()
vbox.append(toolbar) vbox.append(toolbar)
button = Button('theme:stock-close') button = IconButton('theme:stock-close')
toolbar.append(button) toolbar.append(button)
label = Label('mec moc') label = Label('mec moc')

View File

@ -24,7 +24,7 @@ import hippo
from sugar.graphics.toolbar import Toolbar from sugar.graphics.toolbar import Toolbar
from sugar.graphics.optionmenu import OptionMenu 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): def _option_menu_changed_cb(option_menu):
print '_option_menu_activated_cb: %i' % option_menu.props.value print '_option_menu_activated_cb: %i' % option_menu.props.value
@ -47,7 +47,7 @@ canvas.set_root(vbox)
toolbar = Toolbar() toolbar = Toolbar()
vbox.append(toolbar) vbox.append(toolbar)
button = Button('theme:stock-close') button = IconButton('theme:stock-close')
toolbar.append(button) toolbar.append(button)
OPTION_ANYTHING = 1 OPTION_ANYTHING = 1