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

This commit is contained in:
Simon McVittie 2007-05-28 17:10:54 +01:00
commit 5dacfdd365
22 changed files with 191 additions and 92 deletions

View File

@ -20,6 +20,7 @@ import sys
import os import os
from ConfigParser import ConfigParser from ConfigParser import ConfigParser
from sugar.activity import ActivityRegistry
from sugar import env from sugar import env
# Setup the environment so that we run inside the Sugar shell # Setup the environment so that we run inside the Sugar shell
@ -33,7 +34,6 @@ import gtk
import dbus import dbus
import dbus.glib import dbus.glib
from sugar.activity import bundleregistry
from sugar.activity import activityfactory from sugar.activity import activityfactory
from sugar.activity import activityfactoryservice from sugar.activity import activityfactoryservice
@ -48,13 +48,15 @@ def _error_cb(handler, err):
def print_help(self): def print_help(self):
sys.exit(0) sys.exit(0)
bundle = None activity_info = None
if len(sys.argv) > 1: if len(sys.argv) > 1:
registry = bundleregistry.get_registry() registry = ActivityRegistry()
bundle = registry.find_bundle(sys.argv[1]) activities = registry.get_activities_for_name(sys.argv[1])
if len(activities) > 0:
activity_info = activities[0]
if bundle == None: if activity_info == None:
print 'Usage:\n\n' \ print 'Usage:\n\n' \
'sugar-activity [bundle]\n\n' \ 'sugar-activity [bundle]\n\n' \
'Bundle can be a part of the service name or of bundle name.' 'Bundle can be a part of the service name or of bundle name.'
@ -64,16 +66,16 @@ bus = dbus.SessionBus()
bus_object = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus') bus_object = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
try: try:
name = bus_object.GetNameOwner( name = bus_object.GetNameOwner(
bundle.get_service_name(), dbus_interface='org.freedesktop.DBus') activity_info.service_name, dbus_interface='org.freedesktop.DBus')
except dbus.DBusException: except dbus.DBusException:
name = None name = None
if name: if name:
print '%s is already running, creating a new instance.' % bundle.get_service_name() print '%s is already running, creating a new instance.' % bundle.get_service_name()
else: else:
activityfactoryservice.run(bundle.get_path()) activityfactoryservice.run(activity_info.path)
handler = activityfactory.create(bundle.get_service_name()) handler = activityfactory.create(activity_info.service_name)
handler.connect('success', _success_cb, name != None) handler.connect('success', _success_cb, name != None)
handler.connect('error', _error_cb) handler.connect('error', _error_cb)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python a#!/usr/bin/env python
import sys import sys
import os import os
import zipfile import zipfile
@ -44,7 +44,7 @@ if os.spawnlp(os.P_WAIT, 'unzip', 'unzip', sys.argv[1], '-d', bundle_dir):
raise RuntimeError, 'An error occurred while extracting the .xo contents.' raise RuntimeError, 'An error occurred while extracting the .xo contents.'
# notify shell of new bundle # notify shell of new bundle
if not dbus_service.add_bundle(bundle_path): if not dbus_service.AddBundle(bundle_path):
# error, let's delete the just expanded bundle. # error, let's delete the just expanded bundle.
for root, dirs, files in os.walk(bundle_path, topdown=False): for root, dirs, files in os.walk(bundle_path, topdown=False):
for name in files: for name in files:

View File

@ -173,7 +173,7 @@ class TestPresenceService(PresenceService):
self.__test_num, self.__randomize) self.__test_num, self.__randomize)
def internal_get_activity(self, actid): def internal_get_activity(self, actid):
return self._activities.get(actid, None): return self._activities.get(actid, None)
def _extract_public_key(keyfile): def _extract_public_key(keyfile):

View File

@ -117,6 +117,9 @@ class IP4AddressMonitor(gobject.GObject):
sys_bus = dbus.SystemBus() sys_bus = dbus.SystemBus()
self._watch = sys_bus.watch_name_owner(NM_SERVICE, self._nm_owner_cb) self._watch = sys_bus.watch_name_owner(NM_SERVICE, self._nm_owner_cb)
if not sys_bus.name_has_owner(NM_SERVICE):
addr = self._get_address_fallback()
self._update_address(addr)
def do_get_property(self, pspec): def do_get_property(self, pspec):
if pspec.name == "address": if pspec.name == "address":

View File

@ -4,6 +4,7 @@ sugardir = $(pkgdatadir)/shell/model
sugar_PYTHON = \ sugar_PYTHON = \
__init__.py \ __init__.py \
accesspointmodel.py \ accesspointmodel.py \
bundleregistry.py \
BuddyModel.py \ BuddyModel.py \
Friends.py \ Friends.py \
Invites.py \ Invites.py \

View File

@ -18,7 +18,8 @@ import gobject
from sugar.graphics.xocolor import XoColor from sugar.graphics.xocolor import XoColor
from sugar.presence import presenceservice from sugar.presence import presenceservice
from sugar.activity import bundleregistry
from model import bundleregistry
from model.BuddyModel import BuddyModel from model.BuddyModel import BuddyModel
from model.accesspointmodel import AccessPointModel from model.accesspointmodel import AccessPointModel
from hardware import hardwaremanager from hardware import hardwaremanager

View File

@ -1,19 +1,18 @@
# Copyright (C) 2007, Red Hat, Inc. # Copyright (C) 2006, Red Hat, Inc.
# #
# This library is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or modify
# modify it under the terms of the GNU Lesser General Public # it under the terms of the GNU General Public License as published by
# License as published by the Free Software Foundation; either # the Free Software Foundation; either version 2 of the License, or
# version 2 of the License, or (at your option) any later version. # (at your option) any later version.
# #
# This library is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Lesser General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU General Public License
# License along with this library; if not, write to the # along with this program; if not, write to the Free Software
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Boston, MA 02111-1307, USA.
import os import os
@ -74,18 +73,6 @@ class BundleRegistry(gobject.GObject):
self._search_path = [] self._search_path = []
self._service_manager = _ServiceManager() self._service_manager = _ServiceManager()
def find_bundle(self, key):
"""Find a bundle in the registry"""
key = key.lower()
for bundle in self._bundles.values():
name = bundle.get_name().lower()
service_name = bundle.get_service_name().lower()
if name.find(key) != -1 or service_name.find(key) != -1:
return bundle
return None
def get_bundle(self, service_name): def get_bundle(self, service_name):
"""Returns an bundle given his service name""" """Returns an bundle given his service name"""
if self._bundles.has_key(service_name): if self._bundles.has_key(service_name):

View File

@ -22,7 +22,7 @@ import dbus
from model.homeactivity import HomeActivity from model.homeactivity import HomeActivity
from model.homerawwindow import HomeRawWindow from model.homerawwindow import HomeRawWindow
from sugar.activity import bundleregistry from model import bundleregistry
_SERVICE_NAME = "org.laptop.Activity" _SERVICE_NAME = "org.laptop.Activity"
_SERVICE_PATH = "/org/laptop/Activity" _SERVICE_PATH = "/org/laptop/Activity"

View File

@ -1,11 +1,30 @@
# Copyright (C) 2006, Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""D-bus service providing access to the shell's functionality""" """D-bus service providing access to the shell's functionality"""
import dbus import dbus
from sugar.activity import bundleregistry from sugar.activity import ActivityRegistry
from sugar.activity import ActivityInfo
from model import bundleregistry
_DBUS_SERVICE = "org.laptop.Shell" _DBUS_SERVICE = "org.laptop.Shell"
_DBUS_INTERFACE = "org.laptop.Shell" _DBUS_ACTIVITY_REGISTRY_IFACE = "org.laptop.Shell.ActivityRegistry"
_DBUS_OWNER_INTERFACE = "org.laptop.Shell.Owner" _DBUS_OWNER_IFACE = "org.laptop.Shell.Owner"
_DBUS_PATH = "/org/laptop/Shell" _DBUS_PATH = "/org/laptop/Shell"
class ShellService(dbus.service.Object): class ShellService(dbus.service.Object):
@ -35,14 +54,16 @@ class ShellService(dbus.service.Object):
self._owner.connect('color-changed', self._owner_color_changed_cb) self._owner.connect('color-changed', self._owner_color_changed_cb)
self._home_model = self._shell_model.get_home() self._home_model = self._shell_model.get_home()
self._home_model.connect('active-activity-changed', self._cur_activity_changed_cb) self._home_model.connect('active-activity-changed',
self._cur_activity_changed_cb)
bus = dbus.SessionBus() bus = dbus.SessionBus()
bus_name = dbus.service.BusName(_DBUS_SERVICE, bus=bus) bus_name = dbus.service.BusName(_DBUS_SERVICE, bus=bus)
dbus.service.Object.__init__(self, bus_name, _DBUS_PATH) dbus.service.Object.__init__(self, bus_name, _DBUS_PATH)
@dbus.service.method(_DBUS_INTERFACE, in_signature="s", out_signature="b") @dbus.service.method(_DBUS_ACTIVITY_REGISTRY_IFACE,
def add_bundle(self, bundle_path): in_signature="s", out_signature="b")
def AddBundle(self, bundle_path):
"""Register the activity bundle with the global registry """Register the activity bundle with the global registry
bundle_path -- path to the activity bundle's root directory, bundle_path -- path to the activity bundle's root directory,
@ -55,28 +76,55 @@ class ShellService(dbus.service.Object):
registry = bundleregistry.get_registry() registry = bundleregistry.get_registry()
return registry.add_bundle(bundle_path) return registry.add_bundle(bundle_path)
@dbus.service.signal(_DBUS_OWNER_INTERFACE, signature="s") @dbus.service.method(_DBUS_ACTIVITY_REGISTRY_IFACE,
in_signature="s", out_signature="aa{sv}")
def GetActivitiesForName(self, name):
result = []
key = name.lower()
for bundle in bundleregistry.get_registry():
name = bundle.get_name().lower()
service_name = bundle.get_service_name().lower()
if name.find(key) != -1 or service_name.find(key) != -1:
info = self._bundle_to_activity_info(bundle)
result.append(info.to_dict())
return result
@dbus.service.method(_DBUS_ACTIVITY_REGISTRY_IFACE,
in_signature="s", out_signature="aa{sv}")
def GetActivitiesForType(self, mime_type):
result = []
for bundle in bundleregistry.get_registry():
if mime_type in bundle.get_mime_types():
info = self._bundle_to_activity_info(bundle)
result.append(info.to_dict())
return result
@dbus.service.signal(_DBUS_OWNER_IFACE, signature="s")
def ColorChanged(self, color): def ColorChanged(self, color):
pass pass
def _owner_color_changed_cb(self, new_color): def _owner_color_changed_cb(self, new_color):
self.ColorChanged(new_color.to_string()) self.ColorChanged(new_color.to_string())
@dbus.service.signal(_DBUS_OWNER_INTERFACE, signature="s") @dbus.service.signal(_DBUS_OWNER_IFACE, signature="s")
def NickChanged(self, nick): def NickChanged(self, nick):
pass pass
def _owner_nick_changed_cb(self, new_nick): def _owner_nick_changed_cb(self, new_nick):
self.NickChanged(new_nick) self.NickChanged(new_nick)
@dbus.service.signal(_DBUS_OWNER_INTERFACE, signature="ay") @dbus.service.signal(_DBUS_OWNER_IFACE, signature="ay")
def IconChanged(self, icon_data): def IconChanged(self, icon_data):
pass pass
def _owner_icon_changed_cb(self, new_icon): def _owner_icon_changed_cb(self, new_icon):
self.IconChanged(dbus.ByteArray(new_icon)) self.IconChanged(dbus.ByteArray(new_icon))
@dbus.service.signal(_DBUS_OWNER_INTERFACE, signature="s") @dbus.service.signal(_DBUS_OWNER_IFACE, signature="s")
def CurrentActivityChanged(self, activity_id): def CurrentActivityChanged(self, activity_id):
pass pass
@ -85,3 +133,7 @@ class ShellService(dbus.service.Object):
if new_activity: if new_activity:
new_id = new_activity.get_activity_id() new_id = new_activity.get_activity_id()
self.CurrentActivityChanged(new_id) self.CurrentActivityChanged(new_id)
def _bundle_to_activity_info(self, bundle):
return ActivityInfo(bundle.get_name(), bundle.get_icon(),
bundle.get_service_name(), bundle.get_path())

View File

@ -20,14 +20,16 @@ import logging
import gobject import gobject
import wnck import wnck
from view.home.HomeWindow import HomeWindow
from sugar.activity.activityhandle import ActivityHandle from sugar.activity.activityhandle import ActivityHandle
from sugar.graphics.popupcontext import PopupContext from sugar.graphics.popupcontext import PopupContext
from sugar.activity import activityfactory
import sugar
from view.ActivityHost import ActivityHost from view.ActivityHost import ActivityHost
from sugar.activity import activityfactory, bundleregistry
from view.frame.frame import Frame from view.frame.frame import Frame
from view.keyhandler import KeyHandler from view.keyhandler import KeyHandler
import sugar from view.home.HomeWindow import HomeWindow
from model import bundleregistry
class Shell(gobject.GObject): class Shell(gobject.GObject):
def __init__(self, model): def __init__(self, model):

View File

@ -20,9 +20,10 @@ import logging
from sugar.graphics import units from sugar.graphics import units
from sugar.graphics.xocolor import XoColor from sugar.graphics.xocolor import XoColor
from sugar.graphics.iconbutton import IconButton from sugar.graphics.iconbutton import IconButton
from sugar.activity import bundleregistry
from sugar import profile from sugar import profile
from model import bundleregistry
class ActivityButton(IconButton): class ActivityButton(IconButton):
def __init__(self, activity, popup_context): def __init__(self, activity, popup_context):
IconButton.__init__(self, icon_name=activity.get_icon(), IconButton.__init__(self, icon_name=activity.get_icon(),

View File

@ -17,11 +17,12 @@
import hippo import hippo
import gobject import gobject
from view.BuddyIcon import BuddyIcon
from sugar.graphics.canvasicon import CanvasIcon from sugar.graphics.canvasicon import CanvasIcon
from sugar.graphics import units from sugar.graphics import units
from sugar.presence import presenceservice from sugar.presence import presenceservice
from sugar.activity import bundleregistry
from model import bundleregistry
from view.BuddyIcon import BuddyIcon
class FriendView(hippo.CanvasBox): class FriendView(hippo.CanvasBox):
def __init__(self, shell, menu_shell, buddy, **kwargs): def __init__(self, shell, menu_shell, buddy, **kwargs):

View File

@ -8,4 +8,4 @@ sugar_PYTHON = \
activityservice.py \ activityservice.py \
bundle.py \ bundle.py \
bundlebuilder.py \ bundlebuilder.py \
bundleregistry.py registry.py

View File

@ -10,16 +10,7 @@ takes a small dictionary with values corresponding to a
sugar.activity.activityhandle.ActivityHandle sugar.activity.activityhandle.ActivityHandle
describing an individual instance of the activity. The describing an individual instance of the activity.
ActivityFactory service is registered with dbus using the
global
sugar.activity.bundleregistry.BundleRegistry
service, which creates dbus .service files in a well known
directory. Those files tell dbus what executable to run
in order to load the ActivityFactory which will provide
the creation service.
Each activity so registered is described by a Each activity so registered is described by a
@ -45,3 +36,6 @@ class. This class allows for querying the ID of the root
window, requesting sharing across the network, and basic window, requesting sharing across the network, and basic
"what type of application are you" queries. "what type of application are you" queries.
""" """
from sugar.activity.registry import ActivityRegistry
from sugar.activity.registry import ActivityInfo

View File

@ -28,7 +28,6 @@ import gtk, gobject
from sugar.presence import presenceservice from sugar.presence import presenceservice
from sugar.activity.activityservice import ActivityService from sugar.activity.activityservice import ActivityService
from sugar.activity import bundleregistry
from sugar.graphics.window import Window from sugar.graphics.window import Window
from sugar.graphics.toolbox import Toolbox from sugar.graphics.toolbox import Toolbox
from sugar.graphics.toolbutton import ToolButton from sugar.graphics.toolbutton import ToolButton
@ -209,7 +208,6 @@ class Activity(Window, gtk.Container):
self.jobject = datastore.create() self.jobject = datastore.create()
self.jobject['title'] = '%s %s' % (get_bundle_name(), 'Activity') self.jobject['title'] = '%s %s' % (get_bundle_name(), 'Activity')
self.jobject['activity'] = self.get_service_name() self.jobject['activity'] = self.get_service_name()
self.jobject['icon'] = self._get_icon()
self.jobject['keep'] = '0' self.jobject['keep'] = '0'
self.jobject['buddies'] = '' self.jobject['buddies'] = ''
self.jobject['preview'] = '' self.jobject['preview'] = ''
@ -332,10 +330,6 @@ class Activity(Window, gtk.Container):
raise raise
self.destroy() self.destroy()
def _get_icon(self):
registry = bundleregistry.get_registry()
return registry.get_bundle(self.get_service_name()).get_icon()
def get_bundle_name(): def get_bundle_name():
"""Return the bundle name for the current process' bundle """Return the bundle name for the current process' bundle
""" """

View File

@ -89,8 +89,7 @@ class ActivityCreationHandler(gobject.GObject):
The specific service which creates new instances of this The specific service which creates new instances of this
particular type of activity is created during the activity particular type of activity is created during the activity
registration process in registration process in shell bundle registry which creates
sugar.activity.bundleregistry.BundleRegistry which creates
service definition files for each registered bundle type. service definition files for each registered bundle type.
""" """
gobject.GObject.__init__(self) gobject.GObject.__init__(self)

View File

@ -151,10 +151,6 @@ class Bundle:
"""Get the activity service name""" """Get the activity service name"""
return self._service_name return self._service_name
def get_object_path(self):
"""Get the path to the service object"""
return '/' + self._service_name.replace('.', '/')
def get_icon(self): def get_icon(self):
"""Get the activity icon name""" """Get the activity icon name"""
return self._icon return self._icon

View File

@ -0,0 +1,62 @@
# Copyright (C) 2006, Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
import dbus
_SHELL_SERVICE = "org.laptop.Shell"
_SHELL_PATH = "/org/laptop/Shell"
_REGISTRY_IFACE = "org.laptop.Shell.ActivityRegistry"
def _activity_info_from_dict(info_dict):
return ActivityInfo(info_dict['name'], info_dict['icon'],
info_dict['service_name'], info_dict['path'])
class ActivityInfo(object):
def __init__(self, name, icon, service_name, path):
self.name = name
self.icon = icon
self.service_name = service_name
self.path = path
def to_dict(self):
return { 'name' : self.name,
'icon' : self.icon,
'service_name' : self.service_name,
'path' : self.path
}
class ActivityRegistry(object):
def __init__(self):
bus = dbus.SessionBus()
bus_object = bus.get_object(_SHELL_SERVICE, _SHELL_PATH)
self._registry = dbus.Interface(bus_object, _REGISTRY_IFACE)
def _convert_info_list(self, info_list):
result = []
for info_dict in info_list:
result.append(_activity_info_from_dict(info_dict))
return result
def get_activities_for_name(self, name):
info_list = self._registry.GetActivitiesForName(name)
return self._convert_info_list(info_list)
def get_activities_for_type(self, mime_type):
info_list = self._registry.GetActivitiesForType(mime_type)
return self._convert_info_list(info_list)

View File

@ -27,12 +27,8 @@ DS_DBUS_INTERFACE = "org.laptop.sugar.DataStore"
DS_DBUS_PATH = "/org/laptop/sugar/DataStore" DS_DBUS_PATH = "/org/laptop/sugar/DataStore"
_bus = dbus.SessionBus() _bus = dbus.SessionBus()
try: _data_store = dbus.Interface(_bus.get_object(DS_DBUS_SERVICE, DS_DBUS_PATH),
_data_store = dbus.Interface(_bus.get_object(DS_DBUS_SERVICE, DS_DBUS_PATH), DS_DBUS_INTERFACE)
DS_DBUS_INTERFACE)
except Exception, e:
_data_store = None
logging.error(e)
def create(properties, filename): def create(properties, filename):
object_id = _data_store.create(dbus.Dictionary(properties), filename) object_id = _data_store.create(dbus.Dictionary(properties), filename)

View File

@ -13,6 +13,7 @@ sugar_PYTHON = \
menushell.py \ menushell.py \
notebook.py \ notebook.py \
roundbox.py \ roundbox.py \
palette.py \
panel.py \ panel.py \
popup.py \ popup.py \
popupcontext.py \ popupcontext.py \

View File

@ -44,8 +44,8 @@ class Palette(gtk.Window):
def __init__(self): def __init__(self):
gobject.GObject.__init__(self) gobject.GObject.__init__(self, type=gtk.WINDOW_POPUP)
gtk.Window.__init__(self, gtk.WINDOW_POPUP) gtk.Window.__init__(self)
self._palette_label = gtk.Label() self._palette_label = gtk.Label()
self._palette_label.set_ellipsize(pango.ELLIPSIZE_START) self._palette_label.set_ellipsize(pango.ELLIPSIZE_START)
@ -74,14 +74,9 @@ class Palette(gtk.Window):
self.set_border_width(self._WIN_BORDER) self.set_border_width(self._WIN_BORDER)
self.add(vbox) self.add(vbox)
self.show()
# Set the palette position using as reference the
# parent widget
self._set_palette_position()
def do_set_property(self, pspec, value): def do_set_property(self, pspec, value):
if pspec.name == 'parent': if pspec.name == 'parent':
self._parent_widget = value self._parent_widget = value
elif pspec.name == 'alignment': elif pspec.name == 'alignment':
@ -89,7 +84,7 @@ class Palette(gtk.Window):
else: else:
raise AssertionError raise AssertionError
def _set_palette_position(self): def set_position(self):
window_axis = self._parent_widget.window.get_origin() window_axis = self._parent_widget.window.get_origin()
parent_rectangle = self._parent_widget.get_allocation() parent_rectangle = self._parent_widget.get_allocation()
@ -156,3 +151,6 @@ class Palette(gtk.Window):
self._button_bar.pack_start(button, True, True, self._PADDING) self._button_bar.pack_start(button, True, True, self._PADDING)
button.show() button.show()
def display(self, button):
self.show()
self.set_position()

View File

@ -18,6 +18,7 @@
import gtk import gtk
from sugar.graphics.icon import Icon from sugar.graphics.icon import Icon
from sugar.graphics.palette import *
class ToolButton(gtk.ToolButton): class ToolButton(gtk.ToolButton):
def __init__(self, named_icon=None): def __init__(self, named_icon=None):
@ -27,4 +28,12 @@ class ToolButton(gtk.ToolButton):
def set_named_icon(self, named_icon): def set_named_icon(self, named_icon):
icon = Icon(named_icon) icon = Icon(named_icon)
self.set_icon_widget(icon) self.set_icon_widget(icon)
icon.show() icon.show()
def set_palette(self, palette):
self.connect('clicked', palette.display)
palette.props.parent = self
palette.props.alignment = ALIGNMENT_BOTTOM_LEFT
def set_tooltip(self, text):
pass