diff --git a/services/nm/nmclient.py b/services/nm/nmclient.py index cd381fbc..e9db0eec 100644 --- a/services/nm/nmclient.py +++ b/services/nm/nmclient.py @@ -27,7 +27,6 @@ from gettext import gettext as _ import hippo import style -from sugar.graphics.iconcolor import IconColor from sugar.graphics.timeline import Timeline from wepkeydialog import WEPKeyDialog from bubble import Bubble diff --git a/services/presence/Buddy.py b/services/presence/Buddy.py index 0864bb4c..8e4c78f5 100644 --- a/services/presence/Buddy.py +++ b/services/presence/Buddy.py @@ -20,7 +20,7 @@ import logging import gobject import dbus, dbus.service from sugar import profile -from sugar.graphics import iconcolor +from sugar.graphics import xocolor PRESENCE_SERVICE_TYPE = "_presence_olpc._tcp" @@ -261,7 +261,7 @@ class Buddy(object): self._valid = True self._get_buddy_icon(service) color = service.get_one_property(_BUDDY_KEY_COLOR) - if iconcolor.is_valid(color): + if xocolor.is_valid(color): self._color = color self._current_activity = service.get_one_property(_BUDDY_KEY_CURACT) # Monitor further buddy property changes, like current activity @@ -276,7 +276,7 @@ class Buddy(object): def __buddy_presence_service_property_changed_cb(self, service, keys): if _BUDDY_KEY_COLOR in keys: new_color = service.get_one_property(_BUDDY_KEY_COLOR) - if new_color and self._color != new_color and iconcolor.is_valid(new_color): + if new_color and self._color != new_color and xocolor.is_valid(new_color): self._color = new_color self._dbus_helper.PropertyChanged([_BUDDY_KEY_COLOR]) if _BUDDY_KEY_CURACT in keys: diff --git a/services/presence2/buddy.py b/services/presence2/buddy.py index 984bf949..df1bcc7e 100644 --- a/services/presence2/buddy.py +++ b/services/presence2/buddy.py @@ -18,7 +18,6 @@ import gobject import dbus, dbus.service from sugar import profile -from sugar.graphics import iconcolor _BUDDY_PATH = "/org/laptop/Sugar/Presence/Buddies/" _BUDDY_INTERFACE = "org.laptop.Sugar.Presence.Buddy" diff --git a/shell/model/BuddyModel.py b/shell/model/BuddyModel.py index 8e175e75..9f1ad7f9 100644 --- a/shell/model/BuddyModel.py +++ b/shell/model/BuddyModel.py @@ -15,7 +15,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from sugar.presence import PresenceService -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor import gobject _NOT_PRESENT_COLOR = "#888888,#BBBBBB" @@ -67,7 +67,7 @@ class BuddyModel(gobject.GObject): self.__set_color_from_string(_NOT_PRESENT_COLOR) def __set_color_from_string(self, color_string): - self._color = IconColor(color_string) + self._color = XoColor(color_string) def get_name(self): return self._name diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py index 6c9f8832..bb3c223b 100644 --- a/shell/model/MeshModel.py +++ b/shell/model/MeshModel.py @@ -16,7 +16,7 @@ import gobject -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar.presence import PresenceService from sugar.activity import bundleregistry from model.BuddyModel import BuddyModel @@ -34,7 +34,7 @@ class ActivityModel: return self._bundle.get_icon() def get_color(self): - return IconColor(self._activity.get_color()) + return XoColor(self._activity.get_color()) def get_service(self): return self._service diff --git a/shell/model/homeactivity.py b/shell/model/homeactivity.py index d4962f31..f823f598 100644 --- a/shell/model/homeactivity.py +++ b/shell/model/homeactivity.py @@ -20,7 +20,7 @@ import logging import gobject import dbus -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar.presence import PresenceService from sugar import profile @@ -100,7 +100,7 @@ class HomeActivity(gobject.GObject): def get_icon_color(self): activity = PresenceService.get_instance().get_activity(self._id) if activity != None: - return IconColor(activity.get_color()) + return XoColor(activity.get_color()) else: return profile.get_color() diff --git a/shell/view/FirstTimeDialog.py b/shell/view/FirstTimeDialog.py index 0ae82ef6..cb56bb74 100644 --- a/shell/view/FirstTimeDialog.py +++ b/shell/view/FirstTimeDialog.py @@ -20,7 +20,7 @@ from ConfigParser import ConfigParser import gtk from gettext import gettext as _ -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar import env class FirstTimeDialog(gtk.Dialog): @@ -60,7 +60,7 @@ class FirstTimeDialog(gtk.Dialog): section = 'Buddy' cp.add_section(section) cp.set(section, 'NickName', self._entry.get_text()) - cp.set(section, 'Color', IconColor().to_string()) + cp.set(section, 'Color', XoColor().to_string()) config_path = os.path.join(env.get_profile_path(), 'config') fileobject = open(config_path, 'w') diff --git a/shell/view/clipboardicon.py b/shell/view/clipboardicon.py index 65eafb77..faf2e18d 100644 --- a/shell/view/clipboardicon.py +++ b/shell/view/clipboardicon.py @@ -2,7 +2,7 @@ import logging from sugar.graphics.canvasicon import CanvasIcon from view.clipboardmenu import ClipboardMenu -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar.graphics import units from sugar.activity import activityfactory from sugar.clipboard import clipboardservice @@ -43,9 +43,9 @@ class ClipboardIcon(CanvasIcon): self._menu.set_state(name, percent, preview, activity) if activity and percent < 100: - self.set_property('color', IconColor("#000000,#424242")) + self.set_property('color', XoColor("#000000,#424242")) else: - self.set_property('color', IconColor("#000000,#FFFFFF")) + self.set_property('color', XoColor("#000000,#FFFFFF")) def _activity_create_success_cb(self, handler, activity): activity.start(util.unique_id()) diff --git a/shell/view/frame/ActivitiesBox.py b/shell/view/frame/ActivitiesBox.py index 5d4c59d7..8041a621 100644 --- a/shell/view/frame/ActivitiesBox.py +++ b/shell/view/frame/ActivitiesBox.py @@ -18,7 +18,7 @@ import hippo import logging from sugar.graphics import units -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar.graphics.iconbutton import IconButton from sugar.presence import PresenceService from sugar.activity import bundleregistry diff --git a/shell/view/frame/FriendsBox.py b/shell/view/frame/FriendsBox.py index 5b88fb13..9b12f6c2 100644 --- a/shell/view/frame/FriendsBox.py +++ b/shell/view/frame/FriendsBox.py @@ -17,7 +17,6 @@ import hippo from sugar.graphics.canvasicon import CanvasIcon -from sugar.graphics.iconcolor import IconColor from sugar.presence import PresenceService from view.BuddyIcon import BuddyIcon from model.BuddyModel import BuddyModel diff --git a/shell/view/frame/ZoomBox.py b/shell/view/frame/ZoomBox.py index e77e350c..0cb0c34a 100644 --- a/shell/view/frame/ZoomBox.py +++ b/shell/view/frame/ZoomBox.py @@ -20,7 +20,6 @@ from gettext import gettext as _ import hippo from sugar.graphics.menu import Menu, MenuItem -from sugar.graphics.iconcolor import IconColor from sugar.graphics.iconbutton import IconButton import sugar diff --git a/shell/view/home/HomeBox.py b/shell/view/home/HomeBox.py index c6c0f882..0d5f999d 100644 --- a/shell/view/home/HomeBox.py +++ b/shell/view/home/HomeBox.py @@ -19,7 +19,7 @@ import math import hippo from sugar.graphics import units -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from view.home.activitiesdonut import ActivitiesDonut from view.devices import deviceview @@ -59,7 +59,7 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem): if self._donut: self.remove(self._donut) self._donut = None - self._my_icon.props.color = IconColor('insensitive') + self._my_icon.props.color = XoColor('insensitive') def do_allocate(self, width, height, origin_changed): hippo.CanvasBox.do_allocate(self, width, height, origin_changed) diff --git a/shell/view/home/activitiesdonut.py b/shell/view/home/activitiesdonut.py index b1ec62d6..6c411ae2 100644 --- a/shell/view/home/activitiesdonut.py +++ b/shell/view/home/activitiesdonut.py @@ -21,7 +21,7 @@ import colorsys from sugar.graphics.canvasicon import CanvasIcon from sugar.graphics import units -from sugar.graphics import iconcolor +from sugar.graphics import xocolor from sugar import profile # TODO: rgb_to_html and html_to_rgb are useful elsewhere @@ -89,7 +89,7 @@ class ActivityIcon(CanvasIcon): new_fill = rgb_to_html(*colorsys.hsv_to_rgb(h, s * factor, v)) h, s, v = colorsys.rgb_to_hsv(*html_to_rgb(self._orig_color.get_stroke_color())) new_stroke = rgb_to_html(*colorsys.hsv_to_rgb(h, s * factor, v)) - return iconcolor.IconColor("%s,%s" % (new_stroke, new_fill)) + return xocolor.XoColor("%s,%s" % (new_stroke, new_fill)) def _pulse_cb(self): if self._direction == 1: diff --git a/sugar/graphics/Makefile.am b/sugar/graphics/Makefile.am index ee1c578d..375857f2 100644 --- a/sugar/graphics/Makefile.am +++ b/sugar/graphics/Makefile.am @@ -9,7 +9,6 @@ sugar_PYTHON = \ entry.py \ font.py \ frame.py \ - iconcolor.py \ label.py \ menu.py \ menushell.py \ @@ -21,4 +20,5 @@ sugar_PYTHON = \ spreadbox.py \ timeline.py \ toolbar.py \ - units.py + units.py \ + xocolor.py diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 67c35aa5..7cf1ed24 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -24,7 +24,6 @@ import rsvg import cairo import time -from sugar.graphics.iconcolor import IconColor from sugar.graphics.timeline import Timeline from sugar.graphics.popup import Popup from sugar.graphics import color diff --git a/sugar/graphics/iconbutton.py b/sugar/graphics/iconbutton.py index b1992a60..78196d08 100644 --- a/sugar/graphics/iconbutton.py +++ b/sugar/graphics/iconbutton.py @@ -21,7 +21,7 @@ import gobject import hippo from canvasicon import CanvasIcon -from iconcolor import IconColor +from xocolor import XoColor from sugar.graphics import units from sugar import profile @@ -47,11 +47,11 @@ class IconButton(CanvasIcon): if self.props.color: self._normal_color = self.props.color else: - self._normal_color = IconColor('white') + self._normal_color = XoColor('white') self.props.color = self._normal_color self._prelight_color = profile.get_color() - self._inactive_color = IconColor('#808080,#424242') + self._inactive_color = XoColor('#808080,#424242') self._set_size(STANDARD_SIZE) self.connect('button-press-event', self._button_press_event_cb) diff --git a/sugar/graphics/iconcolor.py b/sugar/graphics/xocolor.py similarity index 99% rename from sugar/graphics/iconcolor.py rename to sugar/graphics/xocolor.py index ca1ca6a7..07fe80e4 100644 --- a/sugar/graphics/iconcolor.py +++ b/sugar/graphics/xocolor.py @@ -595,7 +595,7 @@ def _parse_string(color_string): def is_valid(color_string): return (_parse_string(color_string) != None) -class IconColor: +class XoColor: def __init__(self, color_string=None): if color_string == None or not is_valid(color_string): n = int(random.random() * (len(_colors) - 1)) diff --git a/sugar/profile.py b/sugar/profile.py index 65f8582c..cb1309b2 100644 --- a/sugar/profile.py +++ b/sugar/profile.py @@ -18,7 +18,7 @@ import os from ConfigParser import ConfigParser from sugar import env -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor class _Profile(object): def __init__(self): @@ -39,7 +39,7 @@ class _Profile(object): self.name = cp.get('Buddy', 'NickName') if cp.has_option('Buddy', 'Color'): - self.color = IconColor(cp.get('Buddy', 'Color')) + self.color = XoColor(cp.get('Buddy', 'Color')) if cp.has_option('Buddy', 'PublicKey'): self.pubkey = cp.get('Buddy', 'PublicKey') diff --git a/sugar/simulator.py b/sugar/simulator.py index c97f364a..fd592ee4 100644 --- a/sugar/simulator.py +++ b/sugar/simulator.py @@ -22,7 +22,7 @@ import gobject import dbus from sugar.presence import PresenceService -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar.p2p import Stream from sugar import util @@ -135,7 +135,7 @@ class Bot(object): def __init__(self): self.name = Bot._name_collection.get_name() - self.color = IconColor() + self.color = XoColor() self.icon = None self._queue = [] diff --git a/tests/sketch/sketchactivity.py b/tests/sketch/sketchactivity.py index 31aff35d..97db0c48 100644 --- a/tests/sketch/sketchactivity.py +++ b/tests/sketch/sketchactivity.py @@ -26,7 +26,7 @@ from sugar.presence import PresenceService from sugar.activity.Activity import Activity from sugar.chat.sketchpad import SketchPad from sugar.chat.sketchpad import Sketch -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar import profile class NetworkController(gobject.GObject): @@ -150,7 +150,7 @@ class SharedSketchPad(SketchPad.SketchPad): str_color = buddy.get_color() if not str_color: str_color = "#348798" # FIXME - color = IconColor(str_color) + color = XoColor(str_color) stroke_color = _html_to_rgb_color(color.get_stroke_color()) sketch = Sketch.Sketch(stroke_color) for item in path: diff --git a/tests/test-snowflake-box.py b/tests/test-snowflake-box.py index dd703934..abbc79d4 100755 --- a/tests/test-snowflake-box.py +++ b/tests/test-snowflake-box.py @@ -28,18 +28,18 @@ import hippo from sugar.graphics.snowflakebox import SnowflakeBox from sugar.graphics.spreadbox import SpreadBox -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar.graphics.canvasicon import CanvasIcon def _create_snowflake(parent, children): - color = IconColor() + color = XoColor() icon = CanvasIcon(size=40, color=color, icon_name='activity-groupchat') parent.append(icon, hippo.PACK_FIXED) parent.set_root(icon) for i in range(0, children): - color = IconColor() + color = XoColor() icon = CanvasIcon(size=60, color=color, icon_name='stock-buddy') parent.append(icon, hippo.PACK_FIXED) diff --git a/tests/test-spread-box.py b/tests/test-spread-box.py index dc4e73eb..ba774c40 100755 --- a/tests/test-spread-box.py +++ b/tests/test-spread-box.py @@ -27,11 +27,11 @@ import gtk import hippo from sugar.graphics.spreadbox import SpreadBox -from sugar.graphics.iconcolor import IconColor +from sugar.graphics.xocolor import XoColor from sugar.graphics.canvasicon import CanvasIcon def _create_icon(): - color = IconColor() + color = XoColor() icon = CanvasIcon(size=100, color=color, icon_name='stock-buddy')