def _set_pixbuf(self, column, cell, model, iter, data): value = model.get_value(iter, 0) q = t = type(value) p = get_icon_option(value) if p is not None: q = (t, p) try: icon = self.icon_cache[q] except KeyError: stock_id = stock.get_stock_id(t, p) if stock_id: icon = self.render_icon(stock_id, Gtk.IconSize.MENU, "") else: icon = None self.icon_cache[q] = icon cell.set_property("pixbuf", icon)
def on_drag_data_get(self, context, selection_data, info, time): """ Get the data to be dropped by on_drag_data_received(). We send the id of the dragged element. """ selection = self.get_selection() model, iter = selection.get_selected() if iter: element = model.get_value(iter, 0) p = get_icon_option(element) p = p if p else '' # 'id#stereotype' is being send if info == NamespaceView.TARGET_ELEMENT_ID: selection_data.set(selection_data.target, 8, '%s#%s' % (element.id, p)) else: selection_data.set(selection_data.target, 8, '%s#%s' % (element.name, p)) return True