summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobwidget.py
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-03-16 13:40:41 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-20 15:21:33 +0000
commit9ecdbc377c6ab6848afb0a378c5804918951f6b7 (patch)
tree6a399868e8e832298e94bd8a03eaf0b7728b7950 /bitbake/lib/bb/ui/crumbs/hobwidget.py
parentdab638e150fb2af56f54f0752383965b016f4960 (diff)
downloadpoky-9ecdbc377c6ab6848afb0a378c5804918951f6b7.tar.gz
Hob: change the code style to enumerate a list in a for-loop
We use the more common style to enumerate a list in a for-loop (http://docs.python.org/library/functions.html#enumerate), that is: try to use for item in mylist, and try to use for i, item in enumerate(list) rather than for i in range(len(mylist)) (From Poky rev: 33c21bc60bd1542f81d33c328f116dec424728cd) (Bitbake rev: 9b168239a5d9693573438eb6514938b81de85af3) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobwidget.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobwidget.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 2c3d8311d1..247bbd1de4 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -109,38 +109,38 @@ class HobViewTable (gtk.VBox):
109 self.toggle_columns = [] 109 self.toggle_columns = []
110 self.table_tree.connect("row-activated", self.row_activated_cb) 110 self.table_tree.connect("row-activated", self.row_activated_cb)
111 111
112 for i in range(len(columns)): 112 for i, column in enumerate(columns):
113 col = gtk.TreeViewColumn(columns[i]['col_name']) 113 col = gtk.TreeViewColumn(column['col_name'])
114 col.set_clickable(True) 114 col.set_clickable(True)
115 col.set_resizable(True) 115 col.set_resizable(True)
116 col.set_sort_column_id(columns[i]['col_id']) 116 col.set_sort_column_id(column['col_id'])
117 if 'col_min' in columns[i].keys(): 117 if 'col_min' in column.keys():
118 col.set_min_width(columns[i]['col_min']) 118 col.set_min_width(column['col_min'])
119 if 'col_max' in columns[i].keys(): 119 if 'col_max' in column.keys():
120 col.set_max_width(columns[i]['col_max']) 120 col.set_max_width(column['col_max'])
121 self.table_tree.append_column(col) 121 self.table_tree.append_column(col)
122 122
123 if (not 'col_style' in columns[i].keys()) or columns[i]['col_style'] == 'text': 123 if (not 'col_style' in column.keys()) or column['col_style'] == 'text':
124 cell = gtk.CellRendererText() 124 cell = gtk.CellRendererText()
125 col.pack_start(cell, True) 125 col.pack_start(cell, True)
126 col.set_attributes(cell, text=columns[i]['col_id']) 126 col.set_attributes(cell, text=column['col_id'])
127 elif columns[i]['col_style'] == 'check toggle': 127 elif column['col_style'] == 'check toggle':
128 cell = gtk.CellRendererToggle() 128 cell = gtk.CellRendererToggle()
129 cell.set_property('activatable', True) 129 cell.set_property('activatable', True)
130 cell.connect("toggled", self.toggled_cb, i, self.table_tree) 130 cell.connect("toggled", self.toggled_cb, i, self.table_tree)
131 self.toggle_id = i 131 self.toggle_id = i
132 col.pack_end(cell, True) 132 col.pack_end(cell, True)
133 col.set_attributes(cell, active=columns[i]['col_id']) 133 col.set_attributes(cell, active=column['col_id'])
134 self.toggle_columns.append(columns[i]['col_name']) 134 self.toggle_columns.append(column['col_name'])
135 elif columns[i]['col_style'] == 'radio toggle': 135 elif column['col_style'] == 'radio toggle':
136 cell = gtk.CellRendererToggle() 136 cell = gtk.CellRendererToggle()
137 cell.set_property('activatable', True) 137 cell.set_property('activatable', True)
138 cell.set_radio(True) 138 cell.set_radio(True)
139 cell.connect("toggled", self.toggled_cb, i, self.table_tree) 139 cell.connect("toggled", self.toggled_cb, i, self.table_tree)
140 self.toggle_id = i 140 self.toggle_id = i
141 col.pack_end(cell, True) 141 col.pack_end(cell, True)
142 col.set_attributes(cell, active=columns[i]['col_id']) 142 col.set_attributes(cell, active=column['col_id'])
143 self.toggle_columns.append(columns[i]['col_name']) 143 self.toggle_columns.append(column['col_name'])
144 144
145 scroll = gtk.ScrolledWindow() 145 scroll = gtk.ScrolledWindow()
146 scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) 146 scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)