Merge branch 'master' of git+ssh://benzea@dev.laptop.org/git/sugar-toolkit
This commit is contained in:
commit
31047c1edd
@ -32,11 +32,12 @@ def _activity_info_from_dict(info_dict):
|
|||||||
info_dict['bundle_id'], info_dict['version'],
|
info_dict['bundle_id'], info_dict['version'],
|
||||||
info_dict['path'], info_dict['show_launcher'],
|
info_dict['path'], info_dict['show_launcher'],
|
||||||
info_dict['command'], info_dict['favorite'],
|
info_dict['command'], info_dict['favorite'],
|
||||||
info_dict['installation_time'])
|
info_dict['installation_time'],
|
||||||
|
info_dict['position_x'], info_dict['position_y'])
|
||||||
|
|
||||||
class ActivityInfo(object):
|
class ActivityInfo(object):
|
||||||
def __init__(self, name, icon, bundle_id, version, path, show_launcher,
|
def __init__(self, name, icon, bundle_id, version, path, show_launcher,
|
||||||
command, favorite, installation_time):
|
command, favorite, installation_time, position_x, position_y):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.icon = icon
|
self.icon = icon
|
||||||
self.bundle_id = bundle_id
|
self.bundle_id = bundle_id
|
||||||
@ -46,6 +47,7 @@ class ActivityInfo(object):
|
|||||||
self.show_launcher = show_launcher
|
self.show_launcher = show_launcher
|
||||||
self.favorite = favorite
|
self.favorite = favorite
|
||||||
self.installation_time = installation_time
|
self.installation_time = installation_time
|
||||||
|
self.position = (position_x, position_y)
|
||||||
|
|
||||||
class ActivityRegistry(gobject.GObject):
|
class ActivityRegistry(gobject.GObject):
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
@ -175,6 +177,9 @@ class ActivityRegistry(gobject.GObject):
|
|||||||
def set_activity_favorite(self, bundle_id, version, favorite):
|
def set_activity_favorite(self, bundle_id, version, favorite):
|
||||||
self._registry.SetActivityFavorite(bundle_id, version, favorite)
|
self._registry.SetActivityFavorite(bundle_id, version, favorite)
|
||||||
|
|
||||||
|
def set_activity_position(self, bundle_id, version, x, y):
|
||||||
|
self._registry.SetActivityPosition(bundle_id, version, x, y)
|
||||||
|
|
||||||
_registry = None
|
_registry = None
|
||||||
|
|
||||||
def get_registry():
|
def get_registry():
|
||||||
|
@ -24,23 +24,18 @@ from sugar.graphics.palette import Palette, ToolInvoker
|
|||||||
from sugar.graphics import toolbutton
|
from sugar.graphics import toolbutton
|
||||||
|
|
||||||
class RadioToolButton(gtk.RadioToolButton):
|
class RadioToolButton(gtk.RadioToolButton):
|
||||||
__gtype_name__ = "SugarRadioToolButton"
|
__gtype_name__ = 'SugarRadioToolButton'
|
||||||
|
|
||||||
def __init__(self, named_icon=None, group=None, xo_color=None, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self._accelerator = None
|
self._accelerator = None
|
||||||
self._tooltip = None
|
self._tooltip = None
|
||||||
self._xo_color = xo_color
|
self._xo_color = None
|
||||||
self._palette_invoker = ToolInvoker()
|
self._palette_invoker = ToolInvoker()
|
||||||
|
|
||||||
gobject.GObject.__init__(self, **kwargs)
|
gobject.GObject.__init__(self, **kwargs)
|
||||||
|
|
||||||
self._palette_invoker.attach_tool(self)
|
self._palette_invoker.attach_tool(self)
|
||||||
|
|
||||||
if named_icon:
|
|
||||||
self.set_named_icon(named_icon)
|
|
||||||
if group:
|
|
||||||
self.props.group = group
|
|
||||||
|
|
||||||
def set_tooltip(self, tooltip):
|
def set_tooltip(self, tooltip):
|
||||||
""" Set a simple palette with just a single label.
|
""" Set a simple palette with just a single label.
|
||||||
"""
|
"""
|
||||||
@ -76,6 +71,27 @@ class RadioToolButton(gtk.RadioToolButton):
|
|||||||
self.set_icon_widget(icon)
|
self.set_icon_widget(icon)
|
||||||
icon.show()
|
icon.show()
|
||||||
|
|
||||||
|
def get_named_icon(self):
|
||||||
|
if self.props.icon_widget is not None:
|
||||||
|
return self.props.icon_widget.props.icon_name
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
named_icon = gobject.property(type=str, setter=set_named_icon,
|
||||||
|
getter=get_named_icon)
|
||||||
|
|
||||||
|
def set_xo_color(self, xo_color):
|
||||||
|
if self._xo_color != xo_color:
|
||||||
|
self._xo_color = xo_color
|
||||||
|
if self.props.icon_widget is not None:
|
||||||
|
self.props.icon_widget.props.xo_color = xo_color
|
||||||
|
|
||||||
|
def get_xo_color(self):
|
||||||
|
return self._xo_color
|
||||||
|
|
||||||
|
xo_color = gobject.property(type=str, setter=set_xo_color,
|
||||||
|
getter=get_xo_color)
|
||||||
|
|
||||||
def create_palette(self):
|
def create_palette(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user