diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobwidget.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobwidget.py | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py index 6cf73b0747..39428270a8 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py | |||
@@ -119,6 +119,7 @@ class HobViewTable (gtk.VBox): | |||
119 | self.table_tree.set_headers_clickable(True) | 119 | self.table_tree.set_headers_clickable(True) |
120 | self.table_tree.set_enable_search(True) | 120 | self.table_tree.set_enable_search(True) |
121 | self.table_tree.set_rules_hint(True) | 121 | self.table_tree.set_rules_hint(True) |
122 | self.table_tree.set_enable_tree_lines(True) | ||
122 | self.table_tree.get_selection().set_mode(gtk.SELECTION_SINGLE) | 123 | self.table_tree.get_selection().set_mode(gtk.SELECTION_SINGLE) |
123 | self.toggle_columns = [] | 124 | self.toggle_columns = [] |
124 | self.table_tree.connect("row-activated", self.row_activated_cb) | 125 | self.table_tree.connect("row-activated", self.row_activated_cb) |
@@ -140,6 +141,8 @@ class HobViewTable (gtk.VBox): | |||
140 | cell = gtk.CellRendererText() | 141 | cell = gtk.CellRendererText() |
141 | col.pack_start(cell, True) | 142 | col.pack_start(cell, True) |
142 | col.set_attributes(cell, text=column['col_id']) | 143 | col.set_attributes(cell, text=column['col_id']) |
144 | if 'col_t_id' in column.keys(): | ||
145 | col.add_attribute(cell, 'font', column['col_t_id']) | ||
143 | elif column['col_style'] == 'check toggle': | 146 | elif column['col_style'] == 'check toggle': |
144 | cell = HobCellRendererToggle() | 147 | cell = HobCellRendererToggle() |
145 | cell.set_property('activatable', True) | 148 | cell.set_property('activatable', True) |
@@ -149,6 +152,8 @@ class HobViewTable (gtk.VBox): | |||
149 | col.pack_end(cell, True) | 152 | col.pack_end(cell, True) |
150 | col.set_attributes(cell, active=column['col_id']) | 153 | col.set_attributes(cell, active=column['col_id']) |
151 | self.toggle_columns.append(column['col_name']) | 154 | self.toggle_columns.append(column['col_name']) |
155 | if 'col_group' in column.keys(): | ||
156 | col.set_cell_data_func(cell, self.set_group_number_cb) | ||
152 | elif column['col_style'] == 'radio toggle': | 157 | elif column['col_style'] == 'radio toggle': |
153 | cell = gtk.CellRendererToggle() | 158 | cell = gtk.CellRendererToggle() |
154 | cell.set_property('activatable', True) | 159 | cell.set_property('activatable', True) |
@@ -162,6 +167,8 @@ class HobViewTable (gtk.VBox): | |||
162 | cell = gtk.CellRendererText() | 167 | cell = gtk.CellRendererText() |
163 | col.pack_start(cell, True) | 168 | col.pack_start(cell, True) |
164 | col.set_cell_data_func(cell, self.display_binb_cb, column['col_id']) | 169 | col.set_cell_data_func(cell, self.display_binb_cb, column['col_id']) |
170 | if 'col_t_id' in column.keys(): | ||
171 | col.add_attribute(cell, 'font', column['col_t_id']) | ||
165 | 172 | ||
166 | scroll = gtk.ScrolledWindow() | 173 | scroll = gtk.ScrolledWindow() |
167 | scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) | 174 | scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) |
@@ -204,6 +211,15 @@ class HobViewTable (gtk.VBox): | |||
204 | def stop_cell_fadeinout_cb(self, ctrl, cell, tree): | 211 | def stop_cell_fadeinout_cb(self, ctrl, cell, tree): |
205 | self.emit("cell-fadeinout-stopped", ctrl, cell, tree) | 212 | self.emit("cell-fadeinout-stopped", ctrl, cell, tree) |
206 | 213 | ||
214 | def set_group_number_cb(self, col, cell, model, iter): | ||
215 | if model and (model.iter_parent(iter) == None): | ||
216 | cell.cell_attr["number_of_children"] = model.iter_n_children(iter) | ||
217 | else: | ||
218 | cell.cell_attr["number_of_children"] = 0 | ||
219 | |||
220 | def connect_group_selection(self, cb_func): | ||
221 | self.table_tree.get_selection().connect("changed", cb_func) | ||
222 | |||
207 | """ | 223 | """ |
208 | A method to calculate a softened value for the colour of widget when in the | 224 | A method to calculate a softened value for the colour of widget when in the |
209 | provided state. | 225 | provided state. |
@@ -1084,11 +1100,17 @@ class HobCellRendererToggle(gtk.CellRendererToggle): | |||
1084 | gtk.CellRendererToggle.__init__(self) | 1100 | gtk.CellRendererToggle.__init__(self) |
1085 | self.ctrl = HobCellRendererController(is_draw_row=True) | 1101 | self.ctrl = HobCellRendererController(is_draw_row=True) |
1086 | self.ctrl.running_mode = self.ctrl.MODE_ONE_SHORT | 1102 | self.ctrl.running_mode = self.ctrl.MODE_ONE_SHORT |
1087 | self.cell_attr = {"fadeout": False} | 1103 | self.cell_attr = {"fadeout": False, "number_of_children": 0} |
1088 | 1104 | ||
1089 | def do_render(self, window, widget, background_area, cell_area, expose_area, flags): | 1105 | def do_render(self, window, widget, background_area, cell_area, expose_area, flags): |
1090 | if (not self.ctrl) or (not widget): | 1106 | if (not self.ctrl) or (not widget): |
1091 | return | 1107 | return |
1108 | |||
1109 | if flags & gtk.CELL_RENDERER_SELECTED: | ||
1110 | state = gtk.STATE_SELECTED | ||
1111 | else: | ||
1112 | state = gtk.STATE_NORMAL | ||
1113 | |||
1092 | if self.ctrl.is_active(): | 1114 | if self.ctrl.is_active(): |
1093 | path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2) | 1115 | path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2) |
1094 | # sometimes the parameters of cell_area will be a negative number,such as pull up down the scroll bar | 1116 | # sometimes the parameters of cell_area will be a negative number,such as pull up down the scroll bar |
@@ -1097,14 +1119,23 @@ class HobCellRendererToggle(gtk.CellRendererToggle): | |||
1097 | path = path[0] | 1119 | path = path[0] |
1098 | if path in self.ctrl.running_cell_areas: | 1120 | if path in self.ctrl.running_cell_areas: |
1099 | cr = window.cairo_create() | 1121 | cr = window.cairo_create() |
1100 | color = gtk.gdk.Color(HobColors.WHITE) | 1122 | color = widget.get_style().base[state] |
1101 | 1123 | ||
1102 | row_x, _, row_width, _ = widget.get_visible_rect() | 1124 | row_x, _, row_width, _ = widget.get_visible_rect() |
1103 | border_y = self.get_property("ypad") | 1125 | border_y = self.get_property("ypad") |
1104 | self.ctrl.on_draw_fadeinout_cb(cr, color, row_x, cell_area.y - border_y, row_width, \ | 1126 | self.ctrl.on_draw_fadeinout_cb(cr, color, row_x, cell_area.y - border_y, row_width, \ |
1105 | cell_area.height + border_y * 2, self.cell_attr["fadeout"]) | 1127 | cell_area.height + border_y * 2, self.cell_attr["fadeout"]) |
1106 | 1128 | # draw number of a group | |
1107 | return gtk.CellRendererToggle.do_render(self, window, widget, background_area, cell_area, expose_area, flags) | 1129 | if self.cell_attr["number_of_children"]: |
1130 | text = "%d pkg" % self.cell_attr["number_of_children"] | ||
1131 | pangolayout = widget.create_pango_layout(text) | ||
1132 | textw, texth = pangolayout.get_pixel_size() | ||
1133 | x = cell_area.x + (cell_area.width/2) - (textw/2) | ||
1134 | y = cell_area.y + (cell_area.height/2) - (texth/2) | ||
1135 | |||
1136 | widget.style.paint_layout(window, state, True, cell_area, widget, "checkbox", x, y, pangolayout) | ||
1137 | else: | ||
1138 | return gtk.CellRendererToggle.do_render(self, window, widget, background_area, cell_area, expose_area, flags) | ||
1108 | 1139 | ||
1109 | '''delay: normally delay time is 1000ms | 1140 | '''delay: normally delay time is 1000ms |
1110 | cell_list: whilch cells need to be render | 1141 | cell_list: whilch cells need to be render |