[bitbake-devel] [PATCH 01/32] Hob: make HobViewTable more general in hob and make the image selection dialog and the image details page reuse it.

Wang, Shane shane.wang at intel.com
Fri Mar 2 07:19:50 UTC 2012


Joshua Lock wrote on 2012-03-01:
>>           for i in range(len(columns)):
>>               col = gtk.TreeViewColumn(columns[i]['col_name'])
>>               col.set_clickable(True)
>>               col.set_resizable(True)
>>               col.set_sort_column_id(columns[i]['col_id'])
>> -            col.set_min_width(columns[i]['col_min'])
>> -            col.set_max_width(columns[i]['col_max'])
> 
> There are a few calls to columns[i].keys() below, I'd recommend making
> the call once per iteration and assigning it to a variable.

OK, will address that later in a separate patch.

> 
> Usually in Python we'd just do a boolean test on the object like:
> 
> 		if widget:
> 			row = 1
> 		elif varlist and vallist:
> 			row = len(varlist)
> 
If it is the style, I can change that some time later.
But I have to say, using "if widget:" is not save enough.
I have even used "if var:" to test "if var != None" but unfortunately var != None but = 0, since var is an integer in that case.
Python is so free without type checking than C++.


>> hbox = gtk.HBox(False, 5)
> 
> *Beep* 5 for padding? :-)

OK, 6

--
Shane




More information about the bitbake-devel mailing list