""" Silique (https://www.silique.fr) Copyright (C) 2025 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . """ from ..i18n import _ from ..config import ROUGAIL_VARIABLE_TYPE from .four_columns import Table as FourTable class Table(FourTable): """The five columns table""" name = "five_columns" level = 60 def clear(self): super().clear() self.five_column = False def _add(self) -> tuple: first_column = self.add_first_column() second_column = self.get_column(self.description, self.help_, self.validators, self.choices, self.examples, self.tags) if second_column: self.second_column = True third_column = self.get_column(self.default) if third_column: self.third_column = True types = self.formatter.property_to_string( self.informations, self.calculated_properties, self.modified_attributes, contents=["type"], ) four_column = self.get_column(types) if four_column: self.four_column = True mode = self.formatter.property_to_string( self.informations, self.calculated_properties, self.modified_attributes, contents=["mode", "access_control"], ) five_column = self.get_column(mode, *self.calculated_properties) if five_column: self.five_column = True return first_column, second_column, third_column, four_column, five_column def headers(self) -> tuple: header = super().headers() if self.five_column: header.append(_("Access control")) return header def get_columns(self): for column in self.columns: ret = [column[0]] if self.second_column: ret.append(column[1]) if self.third_column: ret.append(column[2]) if self.four_column: ret.append(column[3]) if self.five_column: ret.append(column[4]) yield ret def set_properties(self): self.properties = self.formatter.property_to_string( self.informations, self.calculated_properties, self.modified_attributes, contents=["properties", "validator"], )