def _add_item_dict(self, item): # item_name must be unique if item["name"] in self._items: return False # Add the new item to our item list self._items[item["name"]] = item item["index"] = len(self._items) # Resize the internal table self._inner_table.resize(len(self._items), 4) # Add the Access Modifier button for the new item self._inner_table.attach(GtkAccessModifierButton(item["ac_mod"]), 0, 1, len(self._items) - 1, len(self._items), xoptions=gtk.FILL, yoptions=gtk.FILL) # Add the type of the item type_entry = GtkAutoresizableEntry() type_entry.set_text(item["type"]) type_entry.set_has_frame(False) self._inner_table.attach(type_entry, 1, 2, len(self._items) - 1, len(self._items)) type_entry.connect("changed", self._entry_changed_cb, item["name"], "type") # Add the signature of the item sig_entry = GtkAutoresizableEntry() sig_entry.set_text(item["signature"]) sig_entry.set_has_frame(False) self._inner_table.attach(sig_entry, 2, 3, len(self._items) - 1, len(self._items)) type_entry.connect("changed", self._entry_changed_cb, item["name"], "signature") # Add delete button del_button = gtk.Button() del_button.set_relief(gtk.RELIEF_NONE) del_button.add(gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)) self._inner_table.attach(del_button, 3, 4, len(self._items) - 1, len(self._items), xoptions=gtk.FILL, yoptions=gtk.FILL) del_button.connect("clicked", lambda w: self._delete_item(item["name"])) self._inner_table.show_all() # We signal that the item was added if (self._internal_rebuild == 0): self.emit('item-added', item["name"], item["ac_mod"], item["type"], item["signature"], item["index"]) return True