Merge branch 'master' of git+ssh://guillaume@dev.laptop.org/git/sugar
This commit is contained in:
commit
dcbacb1bba
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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())
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -14,7 +14,13 @@ _system_colors = {
|
||||
'desktop-background' : '#E2E2E3',
|
||||
'menu-background' : '#414141',
|
||||
'menu-separator' : '#D1D1D2',
|
||||
'menu-border' : '#D1D1D2'
|
||||
'menu-border' : '#D1D1D2',
|
||||
'button-normal' : '#FFFFFF',
|
||||
'button-background-normal' : '#424242',
|
||||
'button-hover' : '#808080',
|
||||
'button-background-hover' : '#000000',
|
||||
'button-inactive' : '#808080',
|
||||
'button-background-inactive' : '#424242'
|
||||
}
|
||||
|
||||
def _html_to_rgb(html_color):
|
||||
@ -79,3 +85,9 @@ DESKTOP_BACKGROUND = SystemColor('desktop-background')
|
||||
MENU_BACKGROUND = SystemColor('menu-background')
|
||||
MENU_SEPARATOR = SystemColor('menu-separator')
|
||||
MENU_BORDER = SystemColor('menu-border')
|
||||
BUTTON_NORMAL = SystemColor('button-normal')
|
||||
BUTTON_BACKGROUND_NORMAL = SystemColor('button-background-normal')
|
||||
BUTTON_HOVER = SystemColor('button-hover')
|
||||
BUTTON_BACKGROUND_HOVER = SystemColor('button-background-hover')
|
||||
BUTTON_INACTIVE = SystemColor('button-inactive')
|
||||
BUTTON_BACKGROUND_INACTIVE = SystemColor('button-background-inactive')
|
||||
|
@ -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)
|
||||
|
@ -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))
|
@ -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')
|
||||
|
@ -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 = []
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user