[chimera-dev] binding handlers to SortableTable checkboxes

Jan Kosinski kosinski at embl.de
Sat Oct 17 05:33:46 PDT 2015


Ah, right! I followed your suggestion and got it working nicely with python property decorator. Much more elegant and modular than the subclassing solution, thanks! My data is a list of custom objects, so problem with adjusting that.

Jan

On 17 Oct 2015, at 01:16, Eric Pettersen <pett at cgl.ucsf.edu> wrote:

> Hi Jan,
> 	You don’t say what the data in the table is, but one would normally deal with this by responding to the attribute change in the data rather than intercepting the table trying to set the attribute.  For instance, if your data is an attribute then change it into a property so that you can perform additional actions when the attribute is changed.  Again, I don’t know what your data is or what level of control you have over it, so I’m offering suggestions in the dark here.
> 
> —Eric
> 
>> On Oct 16, 2015, at 2:55 PM, Jan Kosinski <kosinski at embl.de> wrote:
>> 
>> Hi again,
>> 
>> How to attach handlers to checkboxes in the CGLtk SortableTable so the handler is invoked automatically when the checkbox is (un)checked?
>> 
>> I get it working by subclassing and overriding _widgetCB as below but maybe you have sth more convenient?
>> 
>> class ComponentSortableTable(SortableTable):
>>   def __init__(self,parent,*args,**kwargs):
>>       SortableTable.__init__(self,parent,*args,**kwargs)
>> 
>>   def _widgetCB(self, datum, column, newVal=None):
>>       SortableTable._widgetCB(self, datum, column, newVal=newVal)
>> 	<my code
>> 	if column.title == ‘show’:
>>>> 	>
>> 
>> Thanks,
>> Jan
>> _______________________________________________
>> Chimera-dev mailing list
>> Chimera-dev at cgl.ucsf.edu
>> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
>> 
> 





More information about the Chimera-dev mailing list