""" 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 ..utils import CommonTable class Table(CommonTable): """The three columns table""" name = "three_columns" level = 30 def __init__(self, *args) -> None: super().__init__(*args) self.second_column = False self.third_column = False def _add(self) -> tuple: first_column = self.get_column(self.paths, self.properties, self.commandlines, self.environments) if first_column: self.first_column = True 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: header = [_("Variable")] if self.second_column: header.append(_("Description")) if self.third_column: header.append(_("Default value")) return header def get_columns(self): if not self.second_column or not self.third_column: raise Exception() return [[col1] for col1, col2, c in self.columns] return self.columns 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 )