""" Silique (https://www.silique.fr) Copyright (C) 2025-2026 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 .two_columns import Tabular as TwoTabular class Tabular(TwoTabular): """The three columns tabular""" name = "three_columns" level = 30 def clear(self): super().clear() self.third_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, *self.calculated_properties, ) if second_column: self.second_column = True third_column = self.get_column(self.default) if third_column: self.third_column = True return first_column, second_column, third_column def headers(self) -> tuple: headers = super().headers() if self.third_column: headers.append(_("Default value")) return headers 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]) yield ret def set_default(self): if "default" in self.informations: self.default = self.formatter.convert_section_to_string( "default", self.informations, self.modified_attributes, multi=self.multi, section_name=False, ) else: self.default = None def set_choices(self): self.default_is_already_set, self.choices = ( self.formatter.convert_choices_to_string( self.informations, self.modified_attributes, with_default=False ) )