55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
"""
|
|
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 <http://www.gnu.org/licenses/>.
|
|
"""
|
|
|
|
from ..i18n import _
|
|
from ..utils import CommonTabular
|
|
|
|
|
|
class Tabular(CommonTabular):
|
|
"""The two columns tabular"""
|
|
|
|
name = "two_columns"
|
|
level = 10
|
|
|
|
def clear(self):
|
|
super().clear()
|
|
self.second_column = False
|
|
|
|
def _add(self) -> tuple:
|
|
first_column = self.add_first_column()
|
|
default = self.default if not self.default_is_already_set else None
|
|
second_column = self.get_column(self.description, self.help_, self.validators, self.choices, default, self.examples, self.tags, *self.calculated_properties)
|
|
if second_column:
|
|
self.second_column = True
|
|
return first_column, second_column
|
|
|
|
def add_first_column(self) -> str:
|
|
return self.get_column(self.paths, self.properties, self.commandlines, self.environments)
|
|
|
|
def headers(self) -> tuple:
|
|
headers = [_("Variable")]
|
|
if self.second_column:
|
|
headers.append(_("Description"))
|
|
return headers
|
|
|
|
def get_columns(self):
|
|
for column in self.columns:
|
|
ret = [column[0]]
|
|
if self.second_column:
|
|
ret.append(column[1])
|
|
yield ret
|