Ticket #1435: sugar-1435.patch

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

    From 182e6b3558e7151f88ee0cfb6a02081a8df1d7c0 Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Sun, 27 Sep 2009 17:05:27 +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..cc93966 100644
    a b STABLE. 
    2222import random
    2323import logging
    2424
     25from sugar.graphics import style
     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, fallback to default',
     235                    color_string)
     236            color_string = '%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
     237                                      style.COLOR_TRANSPARENT.get_svg())
     238            randomize = False
    235239        else:
    236240            randomize = False
    237241