def build_columns(self): EmbeddedList.build_columns(self) # Need to add attributes to renderers # and connect renderers to the 'edited' signal for colno in range(len(self.columns)): for renderer in self.columns[colno].get_cell_renderers(): renderer.set_property('editable', not self.dbstate.db.readonly) renderer.connect('edited',self.edit_inline,colno)
def build_columns(self): #first the standard text columns with normal method EmbeddedList.build_columns(self) # Need to add attributes to renderers # and connect renderers to the 'edited' signal for colno in range(len(self.columns)): for renderer in self.columns[colno].get_cell_renderers(): renderer.set_property('editable', not self.dbstate.db.readonly) renderer.connect('editing_started', self.on_edit_start, colno) renderer.connect('edited', self.on_edit_inline, self.column_order()[colno][1]) # now we add the two special columns # combobox for type colno = len(self.columns) name = self._column_combo[0] renderer = gtk.CellRendererCombo() renderer.set_property('ellipsize', pango.ELLIPSIZE_END) # set up the comboentry editable no = NameOriginType() self.cmborig = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING) self.cmborigmap = no.get_map().copy() keys = sorted(self.cmborigmap, self.by_value) for key in keys: if key != no.get_custom(): self.cmborig.append(row=[key, self.cmborigmap[key]]) additional = self.dbstate.db.get_origin_types() if additional: for type in additional: if type: self.cmborig.append(row=[no.get_custom(), type]) renderer.set_property("model", self.cmborig) renderer.set_property("text-column", 1) renderer.set_property('editable', not self.dbstate.db.readonly) renderer.connect('editing_started', self.on_edit_start_cmb, colno) renderer.connect('edited', self.on_orig_edited, self._column_combo[3]) # add to treeview column = gtk.TreeViewColumn(name, renderer, text=self._column_combo[3]) column.set_resizable(True) column.set_sort_column_id(self._column_combo[1]) column.set_min_width(self._column_combo[2]) column.set_expand(True) self.columns.append(column) self.tree.append_column(column) # toggle box for primary colno += 1 name = self._column_toggle[0] renderer = gtk.CellRendererToggle() renderer.set_property('activatable', True) renderer.set_property('radio', True) renderer.connect('toggled', self.on_prim_toggled, self._column_toggle[3]) # add to treeview column = gtk.TreeViewColumn(name, renderer, active=self._column_toggle[3]) column.set_resizable(False) column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) column.set_alignment(0.5) column.set_sort_column_id(self._column_toggle[1]) column.set_min_width(self._column_toggle[2]) self.columns.append(column) self.tree.append_column(column)