Re: [gDesklets] Current status of Bug #604103 "<list> prefs item doesn't save software-created items"



Hi there,

wow... great to see all this work and the improvements!

The changes to ConfigList are looking really good to me (haven't tested
it yet though).
Have you ever thought about joining the gDesklets developer group ?
(wink wink ;) )

This would make thing easier for all of us and it would be nice to get
things moving on (again).

Greetings, Bjoern

Am 04.02.2012 17:11, schrieb Joe Sapp:
> Woah, nice work.  Hey, if it works I'll look further into it.  Or maybe
> Bjoern can since he wrote the original code (we're both pretty busy...).
> What do you say?
> 
> Joe
> 
> On 02/03/2012 10:46 AM, Ronny Lorenz wrote:
>> Hello everyone.
>>
>> I recently used the <list> tag in a desklet and managed to overcome the lack
>> of automagical storage of my software created items using
>> some scripting in the desklet. But when I restored the items list and they
>> are shown properly by the config dialog the problem arises that
>> I cant set the selection. After setting the bound variable (bound to <list>)
>> to a list, e.g. ['0','1'] to indicate that the first and second item
>> should be checked, the gtk widget does not get updated!
>>
>> I traced back the problem down to "config/ConfigList.py"
>> ConfigList.__setp_value() method.
>> Here, the 'value' that gets passed together with 'key' usually is a list of
>> stringified indices
>> But the implemented code tries to find an item of type 'value' in its item
>> list and therefore
>> always fails with an error since the item list is a list of again
>> stringified indices and not lists
>> of such.
>>
>> After I thought a little about that I found, especially regarding cases
>> where 'value' contains
>> elements which are not included in the items list, that one can just throw
>> out all such occurences.
>> After doing this a call of ConfigList._set_selection() with the reduced list
>> then redraws the selection
>> in the widgets.
>> One could also throw out duplicate entries from the list at this place...?
>>
>> I implemented that behavior now and it seems to be working quite well
>>
>> Maybe the developers can have a look at the changes I made or just comment
>> on the current status
>> of a fix of this issue
>>
>> Greetz
>>
>> Ronny
>>
>>
>>
>> Below is the diff of 0.3x branch Rev. 186 and my hack
>>
>> --- a/config/ConfigList.py    2010-09-08 15:55:54.000000000 +0200
>> +++ b/config/ConfigList.py    2012-02-03 15:41:01.468154337 +0100
>> @@ -226,14 +226,29 @@
>>
>>
>>      def _setp_value(self, key, value):
>> -        # set the value (selection) property
>> -        try:
>> -            index = self.__items_values.index(value)
>> -        except:
>> -            index = 0
>> +        # create a temporary list from value
>> +        # which contains only values from
>> +        # self.__items_values
>> +        tmplist = []
>> +        for v in value:
>> +          try:
>> +            index = self.__items_values.index(v)
>> +            tmplist.append(v)
>> +          except:
>> +            index = -1
>>
>> -        if index:
>> -            self.__listview.set_cursor(index)
>> -            self.__listview.scroll_to_cell(index)
>> +        # update the selection according to
>> +        # tmplist
>> +        self._set_selection(key, tmplist)
>> +
>> +#        # set the value (selection) property
>> +#        try:
>> +#            index = self.__items_values.index(value)
>> +#        except:
>> +#            index = 0
>> +#
>> +#        if index:
>> +#            self.__listview.set_cursor(index)
>> +#            self.__listview.scroll_to_cell(index)
>>          self._set_config(value)
>>          self._setp(key, value)
>>
>> _______________________________________________
>> gdesklets-list mailing list
>> gdesklets-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gdesklets-list
> 
> _______________________________________________
> gdesklets-list mailing list
> gdesklets-list gnome org
> http://mail.gnome.org/mailman/listinfo/gdesklets-list
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]