Browse Source

Fix some issues provided by revert

pull/419/head
Jérôme Deuchnord 1 month ago
parent
commit
661eed4eeb
5 changed files with 151 additions and 91 deletions
  1. +1
    -1
      kosmorro/__main__.py
  2. +0
    -8
      kosmorro/assets/latex/template.tex
  3. +5
    -5
      kosmorro/dumper.py
  4. +139
    -72
      kosmorro/locales/messages.pot
  5. +6
    -5
      tests/general.py

+ 1
- 1
kosmorro/__main__.py View File

@@ -355,7 +355,7 @@ def get_args(output_formats: [str]):
dest="show_graph", dest="show_graph",
action="store_false", action="store_false",
help=_( help=_(
"Do not generate a graph to represent the rise and set times in the PDF format."
"Do not generate a graph to represent the rise and set times in the LaTeX or PDF file."
), ),
) )
parser.add_argument( parser.add_argument(


+ 0
- 8
kosmorro/assets/latex/template.tex View File

@@ -1,13 +1,5 @@
\documentclass[a4paper,12pt]{article} \documentclass[a4paper,12pt]{article}


% This file has been generated with Kosmorro version +++KOSMORRO-VERSION+++ (https://kosmorro.space) on +++CURRENT-DATE+++.
% Feel free to modify it at your needs.
%
% To compile this file, you will need to install LaTeX distribution like:
%
% - TeXLive (https://tug.org/texlive/) on Windows and Linux
% - MacTeX (https://www.tug.org/mactex/) on macOS

\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} \usepackage[T1]{fontenc}
\usepackage[margin=25mm]{geometry} \usepackage[margin=25mm]{geometry}


+ 5
- 5
kosmorro/dumper.py View File

@@ -43,9 +43,9 @@ from .utils import KOSMORRO_VERSION




class Dumper(ABC): class Dumper(ABC):
ephemerides: [AsterEphemerides]
ephemerides: list[AsterEphemerides]
moon_phase: MoonPhase moon_phase: MoonPhase
events: [Event]
events: list[Event]
date: datetime.date date: datetime.date
timezone: int timezone: int
with_colors: bool with_colors: bool
@@ -53,9 +53,9 @@ class Dumper(ABC):


def __init__( def __init__(
self, self,
ephemerides: [AsterEphemerides],
ephemerides: list[AsterEphemerides],
moon_phase: MoonPhase, moon_phase: MoonPhase,
events: [Event],
events: list[Event],
date: datetime.date, date: datetime.date,
timezone: int, timezone: int,
with_colors: bool, with_colors: bool,
@@ -281,7 +281,7 @@ class LatexDumper(Dumper):


document = template document = template


if self.ephemerides is None:
if len(self.ephemerides) == 0:
document = self._remove_section(document, "ephemerides") document = self._remove_section(document, "ephemerides")


if len(self.events) == 0: if len(self.events) == 0:


+ 139
- 72
kosmorro/locales/messages.pot View File

@@ -1,118 +1,145 @@
# Translations template for PROJECT. # Translations template for PROJECT.
# Copyright (C) 2023 ORGANIZATION
# Copyright (C) 2025 ORGANIZATION
# This file is distributed under the same license as the PROJECT project. # This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2023.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
# #
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PROJECT VERSION\n" "Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-05-24 13:41+0200\n"
"POT-Creation-Date: 2025-10-19 16:22+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.12.1\n"
"Generated-By: Babel 2.17.0\n"


#: kosmorro/__main__.py:82
#: kosmorro/__main__.py:89
msgid "" msgid ""
"Save the planet and paper!\n" "Save the planet and paper!\n"
"Consider printing your PDF document only if really necessary, and use the" "Consider printing your PDF document only if really necessary, and use the"
" other side of the sheet." " other side of the sheet."
msgstr "" msgstr ""


#: kosmorro/__main__.py:90
#: kosmorro/__main__.py:97
msgid "" msgid ""
"PDF output will not contain the ephemerides, because you didn't provide " "PDF output will not contain the ephemerides, because you didn't provide "
"the observation coordinates." "the observation coordinates."
msgstr "" msgstr ""


#: kosmorro/__main__.py:142
#: kosmorro/__main__.py:115
msgid ""
"Environment variable KOSMORRO_TIMEZONE is deprecated. Use TZ instead, "
"which is more standard."
msgstr ""

#: kosmorro/__main__.py:124
#, python-brace-format
msgid "Unknown timezone: {timezone}"
msgstr ""

#: kosmorro/__main__.py:167
#, python-brace-format
msgid "The file could not be saved in \"{path}\": {error}" msgid "The file could not be saved in \"{path}\": {error}"
msgstr "" msgstr ""


#: kosmorro/__main__.py:156
#: kosmorro/__main__.py:181
msgid "Please provide a file path to export in this format (--output)." msgid "Please provide a file path to export in this format (--output)."
msgstr "" msgstr ""


#: kosmorro/__main__.py:187
#: kosmorro/__main__.py:213
#, python-brace-format
msgid "Moon phase can only be computed between {min_date} and {max_date}" msgid "Moon phase can only be computed between {min_date} and {max_date}"
msgstr "" msgstr ""


#: kosmorro/__main__.py:238
#: kosmorro/__main__.py:264
#, python-brace-format
msgid "Running on Python {python_version} with Kosmorrolib v{kosmorrolib_version}" msgid "Running on Python {python_version} with Kosmorrolib v{kosmorrolib_version}"
msgstr "" msgstr ""


#: kosmorro/__main__.py:251
#: kosmorro/__main__.py:277
msgid "" msgid ""
"Compute the ephemerides and the events for a given date and a given " "Compute the ephemerides and the events for a given date and a given "
"position on Earth." "position on Earth."
msgstr "" msgstr ""


#: kosmorro/__main__.py:254
#: kosmorro/__main__.py:280
msgid "" msgid ""
"By default, only the events will be computed for today.\n" "By default, only the events will be computed for today.\n"
"To compute also the ephemerides, latitude and longitude arguments are " "To compute also the ephemerides, latitude and longitude arguments are "
"needed." "needed."
msgstr "" msgstr ""


#: kosmorro/__main__.py:267
#: kosmorro/__main__.py:292
msgid "Show the program version" msgid "Show the program version"
msgstr "" msgstr ""


#: kosmorro/__main__.py:275
#: kosmorro/__main__.py:301
msgid "" msgid ""
"The format to output the information to. If not provided, the output " "The format to output the information to. If not provided, the output "
"format will be inferred from the file extension of the output file." "format will be inferred from the file extension of the output file."
msgstr "" msgstr ""


#: kosmorro/__main__.py:285
#: kosmorro/__main__.py:311
#, python-brace-format
msgid "" msgid ""
"The observer's position on Earth, in the \"{latitude},{longitude}\" " "The observer's position on Earth, in the \"{latitude},{longitude}\" "
"format. Can also be set in the KOSMORRO_POSITION environment variable." "format. Can also be set in the KOSMORRO_POSITION environment variable."
msgstr "" msgstr ""


#: kosmorro/__main__.py:295
#: kosmorro/__main__.py:321
msgid "" msgid ""
"The date for which the ephemerides must be calculated. Can be in the " "The date for which the ephemerides must be calculated. Can be in the "
"YYYY-MM-DD format or an interval in the \"[+-]YyMmDd\" format (with Y, M," "YYYY-MM-DD format or an interval in the \"[+-]YyMmDd\" format (with Y, M,"
" and D numbers). Defaults to current date." " and D numbers). Defaults to current date."
msgstr "" msgstr ""


#: kosmorro/__main__.py:306
#: kosmorro/__main__.py:332
msgid "" msgid ""
"The timezone to display the hours in (e.g. 2 for UTC+2 or -3 for UTC-3). "
"Can also be set in the KOSMORRO_TIMEZONE environment variable."
"The timezone to use to display the hours. It can be either a number (e.g."
" 1 for UTC+1) or a timezone name (e.g. Europe/Paris). See "
"https://en.wikipedia.org/wiki/List_of_tz_database_time_zones to find your"
" timezone. Can also be set in the TZ environment variable."
msgstr "" msgstr ""


#: kosmorro/__main__.py:315
#: kosmorro/__main__.py:341
msgid "Disable the colors in the console." msgid "Disable the colors in the console."
msgstr "" msgstr ""


#: kosmorro/__main__.py:322
#: kosmorro/__main__.py:349
msgid "" msgid ""
"A file to export the output to. If not given, the standard output is " "A file to export the output to. If not given, the standard output is "
"used. This argument is needed for PDF format." "used. This argument is needed for PDF format."
msgstr "" msgstr ""


#: kosmorro/__main__.py:331
#: kosmorro/__main__.py:358
msgid "" msgid ""
"Do not generate a graph to represent the rise and set times in the PDF "
"format."
"Do not generate a graph to represent the rise and set times in the LaTeX "
"or PDF file."
msgstr "" msgstr ""


#: kosmorro/__main__.py:339
#: kosmorro/__main__.py:365
msgid "Show debugging messages" msgid "Show debugging messages"
msgstr "" msgstr ""


#: kosmorro/__main__.py:373
msgid "Print a script allowing completion for your shell"
msgstr ""

#: kosmorro/__main__.py:383
msgid "No completion script available for this shell."
msgstr ""

#: kosmorro/date.py:17 #: kosmorro/date.py:17
#, python-brace-format
msgid "The date {date} is not valid: {error}" msgid "The date {date} is not valid: {error}"
msgstr "" msgstr ""


#: kosmorro/date.py:39
#: kosmorro/date.py:40
#, python-brace-format
msgid "" msgid ""
"The date {date} does not match the required YYYY-MM-DD format or the " "The date {date} does not match the required YYYY-MM-DD format or the "
"offset format." "offset format."
@@ -126,23 +153,24 @@ msgstr ""
msgid "Note: All the hours are given in UTC." msgid "Note: All the hours are given in UTC."
msgstr "" msgstr ""


#: kosmorro/dumper.py:151
#: kosmorro/dumper.py:152
#, python-brace-format
msgid "Note: All the hours are given in the UTC{offset} timezone." msgid "Note: All the hours are given in the UTC{offset} timezone."
msgstr "" msgstr ""


#: kosmorro/dumper.py:205 kosmorro/dumper.py:339
#: kosmorro/dumper.py:205 kosmorro/dumper.py:336
msgid "Object" msgid "Object"
msgstr "" msgstr ""


#: kosmorro/dumper.py:206 kosmorro/dumper.py:340
#: kosmorro/dumper.py:206 kosmorro/dumper.py:337
msgid "Rise time" msgid "Rise time"
msgstr "" msgstr ""


#: kosmorro/dumper.py:207 kosmorro/dumper.py:342
#: kosmorro/dumper.py:207 kosmorro/dumper.py:339
msgid "Culmination time" msgid "Culmination time"
msgstr "" msgstr ""


#: kosmorro/dumper.py:208 kosmorro/dumper.py:344
#: kosmorro/dumper.py:208 kosmorro/dumper.py:341
msgid "Set time" msgid "Set time"
msgstr "" msgstr ""


@@ -150,44 +178,46 @@ msgstr ""
msgid "Moon phase is unavailable for this date." msgid "Moon phase is unavailable for this date."
msgstr "" msgstr ""


#: kosmorro/dumper.py:238 kosmorro/dumper.py:348
msgid "Moon phase:"
msgstr ""

#: kosmorro/dumper.py:242
#: kosmorro/dumper.py:240
#, python-brace-format
msgid "{next_moon_phase} on {next_moon_phase_date} at {next_moon_phase_time}" msgid "{next_moon_phase} on {next_moon_phase_date} at {next_moon_phase_time}"
msgstr "" msgstr ""


#: kosmorro/dumper.py:312
#: kosmorro/dumper.py:309
msgid "Overview of your sky" msgid "Overview of your sky"
msgstr "" msgstr ""


#: kosmorro/dumper.py:320
#: kosmorro/dumper.py:318
#, python-brace-format
msgid "" msgid ""
"This document summarizes the ephemerides and the events of {date}. It " "This document summarizes the ephemerides and the events of {date}. It "
"aims to help you to prepare your observation session. All the hours are " "aims to help you to prepare your observation session. All the hours are "
"given in {timezone}." "given in {timezone}."
msgstr "" msgstr ""


#: kosmorro/dumper.py:330
#: kosmorro/dumper.py:328
msgid "" msgid ""
"Don't forget to check the weather forecast before you go out with your " "Don't forget to check the weather forecast before you go out with your "
"equipment." "equipment."
msgstr "" msgstr ""


#: kosmorro/dumper.py:337
#: kosmorro/dumper.py:334
msgid "Ephemerides of the day" msgid "Ephemerides of the day"
msgstr "" msgstr ""


#: kosmorro/dumper.py:346
#: kosmorro/dumper.py:343
msgid "hours" msgid "hours"
msgstr "" msgstr ""


#: kosmorro/dumper.py:353
#: kosmorro/dumper.py:345
msgid "Moon phase:"
msgstr ""

#: kosmorro/dumper.py:350
msgid "Expected events" msgid "Expected events"
msgstr "" msgstr ""


#: kosmorro/dumper.py:493
#: kosmorro/dumper.py:491
msgid "" msgid ""
"Building PDF was not possible, because some dependencies are not " "Building PDF was not possible, because some dependencies are not "
"installed.\n" "installed.\n"
@@ -195,7 +225,7 @@ msgid ""
"pdf/ for more information." "pdf/ for more information."
msgstr "" msgstr ""


#: kosmorro/dumper.py:542
#: kosmorro/dumper.py:540
#, python-format #, python-format
msgid "" msgid ""
"An error occurred during the compilation of the PDF.\n" "An error occurred during the compilation of the PDF.\n"
@@ -203,11 +233,13 @@ msgid ""
"share the content of the log file at /tmp/kosmorro-%s.log" "share the content of the log file at /tmp/kosmorro-%s.log"
msgstr "" msgstr ""


#: kosmorro/exceptions.py:35
#: kosmorro/exceptions.py:36
#, python-brace-format
msgid "The date must be between {minimum_date} and {maximum_date}" msgid "The date must be between {minimum_date} and {maximum_date}"
msgstr "" msgstr ""


#: kosmorro/exceptions.py:48
#: kosmorro/exceptions.py:49
#, python-brace-format
msgid "" msgid ""
"Invalid output format: {output_format}. Output file must end with: " "Invalid output format: {output_format}. Output file must end with: "
"{accepted_extensions}" "{accepted_extensions}"
@@ -218,129 +250,164 @@ msgstr ""
msgid "The given position (%s) is not valid." msgid "The given position (%s) is not valid."
msgstr "" msgstr ""


#: kosmorro/geolocation.py:29
#: kosmorro/geolocation.py:30
msgid "The given Plus Code seems to be a short code, please provide a full code." msgid "The given Plus Code seems to be a short code, please provide a full code."
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:11
#: kosmorro/i18n/strings.py:21
#, python-format #, python-format
msgid "%s is in opposition" msgid "%s is in opposition"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:12
#: kosmorro/i18n/strings.py:26
#, python-format #, python-format
msgid "%s and %s are in conjunction" msgid "%s and %s are in conjunction"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:13
#: kosmorro/i18n/strings.py:35
#, python-format #, python-format
msgid "%s occults %s" msgid "%s occults %s"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:15
#: kosmorro/i18n/strings.py:44
#, python-format #, python-format
msgid "Elongation of %s is maximal" msgid "Elongation of %s is maximal"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:18
#: kosmorro/i18n/strings.py:50
#, python-format #, python-format
msgid "%s is at its periapsis" msgid "%s is at its periapsis"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:19
#: kosmorro/i18n/strings.py:55
#, python-format #, python-format
msgid "%s is at its apoapsis" msgid "%s is at its apoapsis"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:35
#: kosmorro/i18n/strings.py:61
msgid "March equinox"
msgstr ""

#: kosmorro/i18n/strings.py:63
msgid "June solstice"
msgstr ""

#: kosmorro/i18n/strings.py:65
msgid "September equinox"
msgstr ""

#: kosmorro/i18n/strings.py:67
msgid "December solstice"
msgstr ""

#: kosmorro/i18n/strings.py:73
#, python-format
msgid "Total lunar eclipse until %(hour)s"
msgstr ""

#: kosmorro/i18n/strings.py:78
#, python-format
msgid "Penumbral lunar eclipse until %(hour)s"
msgstr ""

#: kosmorro/i18n/strings.py:83
#, python-format
msgid "Partial lunar eclipse until %(hour)s"
msgstr ""

#: kosmorro/i18n/strings.py:99
msgid "New Moon" msgid "New Moon"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:36
#: kosmorro/i18n/strings.py:100
msgid "Waxing Crescent" msgid "Waxing Crescent"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:37
#: kosmorro/i18n/strings.py:101
msgid "First Quarter" msgid "First Quarter"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:38
#: kosmorro/i18n/strings.py:102
msgid "Waxing Gibbous" msgid "Waxing Gibbous"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:39
#: kosmorro/i18n/strings.py:103
msgid "Full Moon" msgid "Full Moon"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:40
#: kosmorro/i18n/strings.py:104
msgid "Waning Gibbous" msgid "Waning Gibbous"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:41
#: kosmorro/i18n/strings.py:105
msgid "Last Quarter" msgid "Last Quarter"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:42
#: kosmorro/i18n/strings.py:106
msgid "Waning Crescent" msgid "Waning Crescent"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:53
#: kosmorro/i18n/strings.py:117
msgid "Sun" msgid "Sun"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:54
#: kosmorro/i18n/strings.py:118
msgid "Moon" msgid "Moon"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:55
#: kosmorro/i18n/strings.py:119
msgid "Mercury" msgid "Mercury"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:56
#: kosmorro/i18n/strings.py:120
msgid "Venus" msgid "Venus"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:57
#: kosmorro/i18n/strings.py:121
msgid "Earth" msgid "Earth"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:58
#: kosmorro/i18n/strings.py:122
msgid "Mars" msgid "Mars"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:59
#: kosmorro/i18n/strings.py:123
msgid "Jupiter" msgid "Jupiter"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:60
#: kosmorro/i18n/strings.py:124
msgid "Saturn" msgid "Saturn"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:61
#: kosmorro/i18n/strings.py:125
msgid "Uranus" msgid "Uranus"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:62
#: kosmorro/i18n/strings.py:126
msgid "Neptune" msgid "Neptune"
msgstr "" msgstr ""


#: kosmorro/i18n/strings.py:63
#: kosmorro/i18n/strings.py:127
msgid "Pluto" msgid "Pluto"
msgstr "" msgstr ""


#: kosmorro/i18n/utils.py:27 #: kosmorro/i18n/utils.py:27
#, python-brace-format
msgid "{day_of_week} {month} {day_number}, {year}" msgid "{day_of_week} {month} {day_number}, {year}"
msgstr "" msgstr ""


#: kosmorro/i18n/utils.py:30 #: kosmorro/i18n/utils.py:30
#, python-brace-format
msgid "{month} {day_number}, {hours}:{minutes}" msgid "{month} {day_number}, {hours}:{minutes}"
msgstr "" msgstr ""


#: kosmorro/i18n/utils.py:33 #: kosmorro/i18n/utils.py:33
#, python-brace-format
msgid "{month} {day_number}, {year}" msgid "{month} {day_number}, {year}"
msgstr "" msgstr ""


#: kosmorro/i18n/utils.py:36 #: kosmorro/i18n/utils.py:36
#, python-brace-format
msgid "{hours}:{minutes}" msgid "{hours}:{minutes}"
msgstr "" msgstr ""



+ 6
- 5
tests/general.py View File

@@ -74,7 +74,7 @@ options:
standard output is used. This argument is needed for standard output is used. This argument is needed for
PDF format. PDF format.
--no-graph Do not generate a graph to represent the rise and set --no-graph Do not generate a graph to represent the rise and set
times in the PDF format.
times in the LaTeX or PDF file.
--debug Show debugging messages --debug Show debugging messages
--completion COMPLETION --completion COMPLETION
Print a script allowing completion for your shell Print a script allowing completion for your shell
@@ -86,7 +86,7 @@ ephemerides, latitude and longitude arguments are needed.
else: else:
assert ( assert (
result.stdout result.stdout
== """usage: kosmorro [-h] [--version] [--format {txt,json,tex}]
== """usage: kosmorro [-h] [--version] [--format {txt,json,pdf,tex}]
[--position POSITION] [--date DATE] [--timezone TIMEZONE] [--position POSITION] [--date DATE] [--timezone TIMEZONE]
[--no-colors] [--output OUTPUT] [--no-graph] [--debug] [--no-colors] [--output OUTPUT] [--no-graph] [--debug]
[--completion COMPLETION] [--completion COMPLETION]
@@ -97,7 +97,7 @@ on Earth.
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
--version, -v Show the program version --version, -v Show the program version
--format, -f {txt,json,tex}
--format, -f {txt,json,pdf,tex}
The format to output the information to. If not The format to output the information to. If not
provided, the output format will be inferred from the provided, the output format will be inferred from the
file extension of the output file. file extension of the output file.
@@ -117,9 +117,10 @@ options:
Can also be set in the TZ environment variable. Can also be set in the TZ environment variable.
--no-colors Disable the colors in the console. --no-colors Disable the colors in the console.
--output, -o OUTPUT A file to export the output to. If not given, the --output, -o OUTPUT A file to export the output to. If not given, the
standard output is used.
standard output is used. This argument is needed for
PDF format.
--no-graph Do not generate a graph to represent the rise and set --no-graph Do not generate a graph to represent the rise and set
times in the LaTeX file.
times in the LaTeX or PDF file.
--debug Show debugging messages --debug Show debugging messages
--completion COMPLETION --completion COMPLETION
Print a script allowing completion for your shell Print a script allowing completion for your shell


Loading…
Cancel
Save