← Back to team overview

gtg-contributors team mailing list archive

Re: tag-bg-color patch

 

Hi Meg,

I have looke dat your branch, and I have some comments:

 - first, you should use blank spaces instead of tabs (that's the
convention we follow in GTG for indentation). Indeed, due to the use
of tabs, the indentation in your code may not be right, and the code
could be interpreted correctly by python. Change the tabs to 4 blank
spaces. I f you use gedit, I recommend you enable the "Use spaces
instead of tabs" option in the preferences.

- you should replace

tag_color = t.get_tag('color')

with:

tag_color = t.get_attribute('color')

('t' is already the tag object, what you want is its color attribute)

- the code following this line is not really correct, it should be
something like this:

        if tag_color is None:
            tag_color = '#F0F'
        colored_tag = {'background': tag_color, 'foreground': 'black'}
        texttag = buff.create_tag(None,**colored_tag)#pylint: disable-msg=W0142
        texttag.set_data('is_tag', True)
        texttag.set_data('tagname', tag)

Try this, and see if it works,

Bertrand

2012/3/30 meg ford <meg387@xxxxxxxxx>:
> I also pushed code changes to launchpad. still not working, but I'll look at
> it tomorrow morning if I have time, otherwise after Flourish! is over on
> Saturday (most likely outcome).
>
>
> Meg
>
> 2012/3/29 meg ford <meg387@xxxxxxxxx>
>>
>> Hi,
>> I sent in the proposal. Please give feedback. I'll finish up the bug fix
>> as soon as possible.
>> Thanks!
>> Meg
>>
>>
>> 2012/3/29 meg ford <meg387@xxxxxxxxx>
>>>
>>> + I'll push the new version of the code as soon as I get a chance so you
>>> can take a look at it. Thanks for the help!
>>>
>>>
>>> 2012/3/29 meg ford <meg387@xxxxxxxxx>
>>>>
>>>> Hi,
>>>>
>>>> 2012/3/29 Izidor Matušov <izidor.matusov@xxxxxxxxx>
>>>>>
>>>>> It is about really old API calls.
>>>>>
>>>>> If you replace lines 355 - 359 with this code:
>>>>>
>>>>> t = self.req.get_tag(tag)
>>>>> if t is None:
>>>>>  pass # something bad has happened and it should be handled
>>>>> tag_color = t.get_attribute('color')
>>>>> if tag_color is None:
>>>>>  tag_color = <default color>
>>>>
>>>>
>>>> I tried it out, but it doesn't work yet. I think that what I'm doing is
>>>> taking the color that has been assigned to the tag shapes in
>>>> on_colorchooser_activate, and assigning it instead of the default color when
>>>> it has been set, and keeping it 'default' when it hasn't. I think the
>>>> problem is that the highlight (default) color doesn't have a setter (maybe
>>>> the color is hardcoded in?).
>>>>
>>>> Does this sound at all correct? I'm getting this debug message:
>>>> Traceback (most recent call last):
>>>>   File "/home/meg/gtg/trunk/GTG/gtk/browser/browser.py", line 729, in
>>>> on_colorchooser_activate
>>>>     t.set_attribute("color", strcolor)
>>>> AttributeError: 'str' object has no attribute 'set_attribute'
>>>>
>>>>
>>>> Meg
>>>>>
>>>>>
>>>>>
>>>>> That could should be equivalent. I haven't tested that code, writing
>>>>> that just top of my head.
>>>>>
>>>>> Izidor
>>>>
>>>>
>>>
>>
>



-- 
Bertrand Rousseau


References