def __build_columns(self): """ Builds the columns for the tree view. First, removes the old columns in the column list. The builds new columns and inserts them into the tree. """ for (i, col) in enumerate(self._COLS): if col.type == self.COL_COMBO: column = ComboMapColumn(col.title, self.__combo_edited, RegisterModel.BIT2STR, i) elif col.type == self.COL_TEXT: column = EditableColumn(col.title, self.__text_edited, i) else: self.__icon_renderer = gtk.CellRendererPixbuf() column = gtk.TreeViewColumn("", self.__icon_renderer, stock_id=i) self.__icon_col = column column.set_min_width(col.size) column.set_expand(col.expand) if i == 1: self.__col = column if col.sort_column >= 0: column.set_sort_column_id(col.sort_column) self.__obj.append_column(column) self.__obj.set_search_column(3) self.__obj.set_tooltip_column(RegisterModel.TOOLTIP_COL)
def __build_bitfield_columns(self, combo_edit, text_edit): """ Builds the columns for the tree view. First, removes the old columns in the column list. The builds new columns and inserts them into the tree. """ for (i, col) in enumerate(self.BIT_COLS): if i == BitModel.TYPE_COL: column = ComboMapColumn(col[BIT_TITLE], combo_edit, TYPE2STR, i) elif i == BitModel.RESET_TYPE_COL: column = ComboMapColumn(col[BIT_TITLE], combo_edit, BitModel.RESET2STR, i) elif i == BitModel.ICON_COL: renderer = gtk.CellRendererPixbuf() column = gtk.TreeViewColumn("", renderer, stock_id=i) else: column = EditableColumn(col[BIT_TITLE], text_edit, i, col[BIT_MONO]) if i == BitModel.BIT_COL: self.__col = column if col[BIT_SORT] >= 0: column.set_sort_column_id(col[BIT_SORT]) column.set_min_width(col[BIT_SIZE]) column.set_expand(col[BIT_EXPAND]) column.set_resizable(True) self.__obj.append_column(column)