Ticket #1435: sugar-1435.2.patch

File sugar-1435.2.patch, 1.3 KB (added by alsroot, 15 years ago)
  • src/sugar/graphics/xocolor.py

    From 44d694387231059bb1c5a313b3da1abd0543095b Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Wed, 30 Sep 2009 15:47:11 +0000
    Subject: Do no use random color if metadata color is not valid #1435
    
    ---
     src/sugar/graphics/xocolor.py |   10 +++++++---
     1 files changed, 7 insertions(+), 3 deletions(-)
    
    diff --git a/src/sugar/graphics/xocolor.py b/src/sugar/graphics/xocolor.py
    index 00238d9..fd329cb 100644
    a b STABLE. 
    2222import random
    2323import logging
    2424
     25import gconf
     26
    2527colors = [
    2628['#B20008', '#FF2B34'], \
    2729['#FF2B34', '#B20008'], \
    class XoColor: 
    229231        if color_string == None:
    230232            randomize = True
    231233        elif not is_valid(color_string):
    232             logging.error('Color string is not valid: %s, will generate a '
    233                           'random color pair.', color_string)
    234             randomize = True
     234            logging.debug('Color string is not valid: %s, '
     235                          'fallback to default', color_string)
     236            client = gconf.client_get_default()
     237            color_string = client.get_string('/desktop/sugar/user/color')
     238            randomize = False
    235239        else:
    236240            randomize = False
    237241