Browse Source

feat: add ability to save PDF file

You can now use the `--format=pdf` argument to save the data computed by
Kosmorro to a PDF file. The new `--output` argument must be given with
the export file path.
tags/v0.6.0
Jérôme Deuchnord 4 years ago
parent
commit
2fadc2a95e
No known key found for this signature in database GPG Key ID: 6D1B91F131F89577
34 changed files with 1093 additions and 52 deletions
  1. +2
    -0
      .gitignore
  2. +1
    -0
      Pipfile
  3. +40
    -1
      Pipfile.lock
  4. +1
    -1
      README.md
  5. BIN
      kosmorrolib/assets/moonphases/png/first-quarter.png
  6. BIN
      kosmorrolib/assets/moonphases/png/full-moon.png
  7. BIN
      kosmorrolib/assets/moonphases/png/last-quarter.png
  8. BIN
      kosmorrolib/assets/moonphases/png/new-moon.png
  9. BIN
      kosmorrolib/assets/moonphases/png/waning-crescent.png
  10. BIN
      kosmorrolib/assets/moonphases/png/waning-gibbous.png
  11. BIN
      kosmorrolib/assets/moonphases/png/waxing-crescent.png
  12. BIN
      kosmorrolib/assets/moonphases/png/waxing-gibbous.png
  13. +78
    -0
      kosmorrolib/assets/moonphases/svg/first-quarter.svg
  14. +74
    -0
      kosmorrolib/assets/moonphases/svg/full-moon.svg
  15. +74
    -0
      kosmorrolib/assets/moonphases/svg/last-quarter.svg
  16. +78
    -0
      kosmorrolib/assets/moonphases/svg/new-moon.svg
  17. +78
    -0
      kosmorrolib/assets/moonphases/svg/waning-crescent.svg
  18. +78
    -0
      kosmorrolib/assets/moonphases/svg/waning-gibbous.svg
  19. +78
    -0
      kosmorrolib/assets/moonphases/svg/waxing-crescent.svg
  20. +78
    -0
      kosmorrolib/assets/moonphases/svg/waxing-gibbous.svg
  21. +90
    -0
      kosmorrolib/assets/pdf/template.tex
  22. +0
    -0
      kosmorrolib/assets/png/kosmorro-icon-white.png
  23. +0
    -0
      kosmorrolib/assets/png/kosmorro-icon.png
  24. +0
    -0
      kosmorrolib/assets/png/kosmorro-logo-white.png
  25. +0
    -0
      kosmorrolib/assets/png/kosmorro-logo.png
  26. +0
    -0
      kosmorrolib/assets/svg/kosmorro-icon-white.svg
  27. +0
    -0
      kosmorrolib/assets/svg/kosmorro-icon.svg
  28. +0
    -0
      kosmorrolib/assets/svg/kosmorro-logo-white.svg
  29. +0
    -0
      kosmorrolib/assets/svg/kosmorro-logo.svg
  30. +149
    -6
      kosmorrolib/dumper.py
  31. +23
    -0
      kosmorrolib/exceptions.py
  32. +84
    -25
      kosmorrolib/locales/messages.pot
  33. +37
    -6
      kosmorrolib/main.py
  34. +50
    -13
      test/dumper.py

+ 2
- 0
.gitignore View File

@@ -6,6 +6,8 @@ kosmorro.egg-info
coverage.xml
node_modules/
package-lock.json
/kosmorrolib/assets/pdf/*
!/assets/pdf/*.tex

# Translation files are taken care on https://poeditor.com/join/project/GXuhLpdaoh
*.mo


+ 1
- 0
Pipfile View File

@@ -14,6 +14,7 @@ skyfield = ">=1.13.0,<2.0.0"
tabulate = "*"
numpy = ">=1.17.0,<2.0.0"
termcolor = "*"
latex = "*"

[requires]
python_version = "3"

+ 40
- 1
Pipfile.lock View File

@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "fb530146420b5768bc25165302d947d11615aac375e7a63a9076fdddd0372d53"
"sha256": "789ae3ae412a3b57df763f776aa8ce0497d680de59fa09ad22a9b91a4e3d6b4e"
},
"pipfile-spec": 6,
"requires": {
@@ -16,12 +16,45 @@
]
},
"default": {
"data": {
"hashes": [
"sha256:2726a65da1af31e2345b6bba81ae4cee87dddf17f7c62f5c63ba7327a8480667"
],
"version": "==0.4"
},
"decorator": {
"hashes": [
"sha256:54c38050039232e1db4ad7375cfce6748d7b41c29e95a081c8a6d2c30364a2ce",
"sha256:5d19b92a3c8f7f101c8dd86afd86b0f061a8ce4540ab8cd401fa2542756bce6d"
],
"version": "==4.4.1"
},
"funcsigs": {
"hashes": [
"sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca",
"sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"
],
"version": "==1.0.2"
},
"future": {
"hashes": [
"sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"
],
"version": "==0.18.2"
},
"jplephem": {
"hashes": [
"sha256:35a3b67444c7b03433e5ffff89fe10fd78d9bc88c12aafd001631227a1782023"
],
"version": "==2.12"
},
"latex": {
"hashes": [
"sha256:bf10c3fe27e9f3adccebc12e90ec239c86dcba101b89221f6775918211482a79"
],
"index": "pypi",
"version": "==0.7.0"
},
"numpy": {
"hashes": [
"sha256:1786a08236f2c92ae0e70423c45e1e62788ed33028f94ca99c4df03f5be6b3c6",
@@ -94,6 +127,12 @@
"index": "pypi",
"version": "==0.8.6"
},
"tempdir": {
"hashes": [
"sha256:689680ed3ba4cc8347a70e67efc25086ce85b53b9d24a1420899c585bbf7ba8e"
],
"version": "==0.7.1"
},
"termcolor": {
"hashes": [
"sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"


+ 1
- 1
README.md View File

@@ -1,4 +1,4 @@
# ![Kosmorro](assets/png/kosmorro-logo.png)
# ![Kosmorro](kosmorrolib/assets/png/kosmorro-logo.png)
[![codecov](https://codecov.io/gh/Deuchnord/kosmorro/branch/master/graph/badge.svg)](https://codecov.io/gh/Deuchnord/kosmorro) [![Version on PyPI](https://img.shields.io/pypi/v/kosmorro)](https://pypi.org/project/kosmorro) [![Discord](https://img.shields.io/discord/650237632533757965?logo=discord&label=%23kosmorro)](https://discord.gg/nyemBqE)

## About the project


BIN
kosmorrolib/assets/moonphases/png/first-quarter.png View File

Before After
Width: 312  |  Height: 313  |  Size: 36 KiB

BIN
kosmorrolib/assets/moonphases/png/full-moon.png View File

Before After
Width: 312  |  Height: 313  |  Size: 48 KiB

BIN
kosmorrolib/assets/moonphases/png/last-quarter.png View File

Before After
Width: 302  |  Height: 302  |  Size: 35 KiB

BIN
kosmorrolib/assets/moonphases/png/new-moon.png View File

Before After
Width: 312  |  Height: 313  |  Size: 23 KiB

BIN
kosmorrolib/assets/moonphases/png/waning-crescent.png View File

Before After
Width: 312  |  Height: 313  |  Size: 30 KiB

BIN
kosmorrolib/assets/moonphases/png/waning-gibbous.png View File

Before After
Width: 312  |  Height: 313  |  Size: 44 KiB

BIN
kosmorrolib/assets/moonphases/png/waxing-crescent.png View File

Before After
Width: 313  |  Height: 313  |  Size: 30 KiB

BIN
kosmorrolib/assets/moonphases/png/waxing-gibbous.png View File

Before After
Width: 312  |  Height: 313  |  Size: 44 KiB

+ 78
- 0
kosmorrolib/assets/moonphases/svg/first-quarter.svg View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg6593"
version="1.1"
viewBox="0 0 92.682022 92.684395"
height="92.684395mm"
width="92.682022mm">
<defs
id="defs6587">
<radialGradient
gradientTransform="translate(688.05,-50.712)"
r="234.94"
fx="248.94"
cy="354.57001"
cx="245.39"
gradientUnits="userSpaceOnUse"
id="radialGradient4640"
xlink:href="#a" />
<radialGradient
gradientUnits="userSpaceOnUse"
fx="248.94"
r="234.94"
cy="354.57001"
cx="245.39"
id="a">
<stop
id="stop7"
offset="0"
stop-color="#b7c3cc" />
<stop
id="stop9"
offset="1"
stop-color="#001e29" />
</radialGradient>
</defs>
<metadata
id="metadata6590">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(54.656486,-144.82447)"
id="layer1">
<g
id="g6568"
transform="matrix(0.26458333,0,0,0.26458333,-256.00384,138.12983)">
<path
style="fill:#000024;fill-rule:evenodd;stroke-width:1.01019692"
id="path38"
d="m 1092.3945,200.45419 a 156.24949,156.25397 0 1 1 -312.49898,0 156.24949,156.25397 0 1 1 312.49898,0 z" />
<path
style="fill:url(#radialGradient4640);fill-rule:evenodd"
id="path40"
d="m 894.22,56.638 c -25.06,6.447 -47.957,20.982 -65.936,39.456 -33.589,34.689 -49.415,85.84 -39.274,133.3 7.7684,38.332 30.319,73.818 63.261,95.34 39.082,26.542 90.824,33.344 135.13,16.523 44.589,-15.935 80.583,-53.959 92.968,-99.846 14.03,-47.365 2.42,-101 -30.04,-138.25 -27.522,-32.74 -69.296,-52.414 -112.07,-52.8 -2.4338,-0.40982 -30.229,1.5565 -44.039,6.2796 z" />
<path
style="fill-opacity:0.25126002;fill-rule:evenodd"
id="path42"
d="m 1026.92,189.108 c -10.37,17.497 15.281,19.939 24.511,25.141 -3.4576,-31.524 10.512,-20.807 13.141,-30.822 -2.4603,-15.476 -20.24,-18.289 -30.195,-28.185 -0.3689,-19.454 -33.444,-17.876 -30.691,-31.892 -5.3458,-59.729 -15.582,-5.0632 -17.324,-14.89 -11.086,12.896 -14.512,-1.6954 -11.166,-10.995 0.26364,-11.365 -18.639,-11.91 -25.607,-6.5757 -5.8842,3.1388 -14.403,3.9638 -17.373,11.046 -13.66,2.7421 -12.28,-17.783 -26.048,-16.916 -15.276,-6.4266 -21.571,-23.77 -33.99,-13.45 -8.9365,2.8834 -27.358,38.752 -33.694,23.765 -13.5,-9.5163 -20.451,15.279 -20.026,25.654 -6.3485,13.802 -17.899,25.142 -24.397,39.356 -8.0969,13.6 -8.0574,31.852 -2.7715,46.369 16.911,-8.3049 18.513,27.307 24.313,42.266 8.439,10.014 21.898,-12.821 25.417,-6.9099 22.751,14.162 -5.2534,18.337 -1.2166,29.083 4.539,15.527 24.377,5.6814 35.735,9.2032 4.7599,1.8134 10.807,12.467 13.777,3.1751 -1.815,-6.8086 -5.6283,-13.445 4.7747,-13.371 7.3152,-6.3929 17.349,-5.3491 24.821,-7.2415 9.0393,-11.572 -10.092,-19.333 -4.8746,-30.443 2.8779,-11.759 -12.73,-8.4941 -10.462,-18.846 -7.0124,-5.8828 -11.048,-16.424 0.22233,-20.807 7.9487,-5.15 29.707,5.1288 24.31,-11.199 -6.8963,-0.46855 -16.33,-6.6026 -8.8168,-14.327 10.756,-7.5046 26.836,6.3362 36.887,-4.9453 1.0925,-5.4659 4.6002,-20.74 11.751,-10.347 -2.0036,12.706 4.4139,23.496 16.934,28.605 5.6256,3.7827 11.442,24.659 18.96297,12.144 -10.57897,-15.807 -1.3253,-36.935 21.493,-9.7167 -0.2777,2.0581 -0.6355,4.9085 1.6013,6.0725 z M 914.35,129.376 c -3.3727,-9.642 -15.855,0.88715 -7.0124,5.9448 -1.4949,18.168 -23.383,19.29 -37.295,19.685 -8.7173,4.2923 -20.669,6.5967 -27.583,10.788 -1.5637,11.397 17.747,10.622 15.712,22.827 8.4646,11.957 22.01,19.653 28.373,33.172 12.227,10.86 6.5682,-16.046 -1.1103,-17.921 -11.846,-4.4912 -26.133,-24.017 -7.6284,-30.074 12.233,-3.4412 6.304,-25.137 22.916,-20.183 15.144,3.9218 14.776,-14.074 24.42,-20.796 2.2128,-9.6425 -5.7023,-6.6942 -10.791,-3.4427 z" />
<path
style="fill:#000024;fill-opacity:0.86431998"
id="path44"
d="m 936.05,351.958 c -82.8,0 -151.24,-67.499 -151.24,-150.67 0,-83.171 65.111,-150.67 151.24,-150.67 v 301.33 z" />
</g>
</g>
</svg>

+ 74
- 0
kosmorrolib/assets/moonphases/svg/full-moon.svg View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg7949"
version="1.1"
viewBox="0 0 92.68203 92.684395"
height="92.684395mm"
width="92.68203mm">
<defs
id="defs7943">
<radialGradient
gradientTransform="translate(1418.2,-50.712)"
r="234.94"
fx="248.94"
cy="354.57001"
cx="245.39"
gradientUnits="userSpaceOnUse"
id="radialGradient4658"
xlink:href="#a" />
<radialGradient
gradientUnits="userSpaceOnUse"
fx="248.94"
r="234.94"
cy="354.57001"
cx="245.39"
id="a">
<stop
id="stop7"
offset="0"
stop-color="#b7c3cc" />
<stop
id="stop9"
offset="1"
stop-color="#001e29" />
</radialGradient>
</defs>
<metadata
id="metadata7946">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-110.89709,-153.13994)"
id="layer1">
<g
id="g7925"
transform="matrix(0.26458333,0,0,0.26458333,-283.63578,146.4453)">
<path
style="fill:#000024;fill-rule:evenodd;stroke-width:1.01019692"
id="path62"
d="m 1822.5445,200.45419 a 156.2495,156.25398 0 1 1 -312.499,0 156.2495,156.25398 0 1 1 312.499,0 z" />
<path
style="fill:url(#radialGradient4658);fill-rule:evenodd"
id="path64"
d="m 1624.37,56.638 c -25.06,6.447 -47.957,20.982 -65.936,39.456 -33.589,34.689 -49.415,85.84 -39.274,133.3 7.7684,38.332 30.319,73.818 63.261,95.34 39.082,26.542 90.824,33.344 135.13,16.523 44.589,-15.935 80.583,-53.959 92.968,-99.846 14.03,-47.365 2.42,-101 -30.04,-138.25 -27.522,-32.74 -69.296,-52.414 -112.07,-52.8 -2.4338,-0.40982 -30.229,1.5565 -44.039,6.2796 z" />
<path
style="fill-opacity:0.25126002;fill-rule:evenodd"
id="path66"
d="m 1757.07,189.108 c -10.37,17.497 15.281,19.939 24.511,25.141 -3.4576,-31.524 10.512,-20.807 13.141,-30.822 -2.4603,-15.476 -20.24,-18.289 -30.195,-28.185 -0.3689,-19.454 -33.444,-17.876 -30.691,-31.892 -5.3458,-59.729 -15.582,-5.0632 -17.324,-14.89 -11.086,12.896 -14.512,-1.6954 -11.166,-10.995 0.2636,-11.365 -18.639,-11.91 -25.607,-6.5757 -5.8842,3.1388 -14.403,3.9638 -17.373,11.046 -13.66,2.7421 -12.28,-17.783 -26.048,-16.916 -15.276,-6.4266 -21.571,-23.77 -33.99,-13.45 -8.9365,2.8834 -27.358,38.752 -33.694,23.765 -13.5,-9.5163 -20.451,15.279 -20.026,25.654 -6.3485,13.802 -17.899,25.142 -24.397,39.356 -8.0969,13.6 -8.0574,31.852 -2.7715,46.369 16.911,-8.3049 18.513,27.307 24.313,42.266 8.439,10.014 21.898,-12.821 25.417,-6.9099 22.751,14.162 -5.2534,18.337 -1.2166,29.083 4.539,15.527 24.377,5.6814 35.735,9.2032 4.7599,1.8134 10.807,12.467 13.777,3.1751 -1.815,-6.8086 -5.6283,-13.445 4.7747,-13.371 7.3152,-6.3929 17.349,-5.3491 24.821,-7.2415 9.0393,-11.572 -10.092,-19.333 -4.8746,-30.443 2.8779,-11.759 -12.73,-8.4941 -10.462,-18.846 -7.0124,-5.8828 -11.048,-16.424 0.2223,-20.807 7.9487,-5.15 29.707,5.1288 24.31,-11.199 -6.8963,-0.46855 -16.33,-6.6026 -8.8168,-14.327 10.756,-7.5046 26.836,6.3362 36.887,-4.9453 1.0925,-5.4659 4.6002,-20.74 11.751,-10.347 -2.0036,12.706 4.4139,23.496 16.934,28.605 5.6256,3.7827 11.442,24.659 18.963,12.144 -10.579,-15.807 -1.3253,-36.935 21.493,-9.7167 -0.2777,2.0581 -0.6355,4.9085 1.6013,6.0725 z M 1644.5,129.376 c -3.3727,-9.642 -15.855,0.88715 -7.0124,5.9448 -1.4949,18.168 -23.383,19.29 -37.295,19.685 -8.7173,4.2923 -20.669,6.5967 -27.583,10.788 -1.5637,11.397 17.747,10.622 15.712,22.827 8.4646,11.957 22.01,19.653 28.373,33.172 12.227,10.86 6.5682,-16.046 -1.1103,-17.921 -11.846,-4.4912 -26.133,-24.017 -7.6284,-30.074 12.233,-3.4412 6.304,-25.137 22.916,-20.183 15.144,3.9218 14.776,-14.074 24.42,-20.796 2.2128,-9.6425 -5.7023,-6.6942 -10.791,-3.4427 z" />
</g>
</g>
</svg>

+ 74
- 0
kosmorrolib/assets/moonphases/svg/last-quarter.svg View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg9798"
version="1.1"
viewBox="0 0 89.78627 89.811501"
height="89.811501mm"
width="89.78627mm">
<defs
id="defs9792">
<radialGradient
gradientTransform="translate(2148,-50.612)"
r="234.94"
fx="248.94"
cy="354.57001"
cx="245.39"
gradientUnits="userSpaceOnUse"
id="radialGradient4675"
xlink:href="#a" />
<radialGradient
gradientUnits="userSpaceOnUse"
fx="248.94"
r="234.94"
cy="354.57001"
cx="245.39"
id="a">
<stop
id="stop7"
offset="0"
stop-color="#b7c3cc" />
<stop
id="stop9"
offset="1"
stop-color="#001e29" />
</radialGradient>
</defs>
<metadata
id="metadata9795">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-236.32115,-232.43949)"
id="layer1">
<g
id="g9774"
transform="matrix(0.26458333,0,0,0.26458333,-352.91332,224.10231)">
<path
style="fill:url(#radialGradient4675);fill-rule:evenodd"
id="path86"
d="m 2354.17,56.738 c -25.06,6.447 -47.957,20.982 -65.936,39.456 -33.589,34.689 -49.415,85.84 -39.274,133.3 7.7684,38.332 30.319,73.818 63.261,95.34 39.082,26.542 90.824,33.344 135.13,16.523 44.589,-15.935 80.583,-53.959 92.968,-99.846 14.03,-47.365 2.42,-101 -30.04,-138.25 -27.522,-32.74 -69.296,-52.414 -112.07,-52.8 -2.4338,-0.40982 -30.229,1.5565 -44.039,6.2796 z" />
<path
style="fill-opacity:0.25126002;fill-rule:evenodd"
id="path88"
d="m 2486.87,189.208 c -10.37,17.497 15.281,19.939 24.511,25.141 -3.4576,-31.524 10.512,-20.807 13.141,-30.822 -2.4603,-15.476 -20.24,-18.289 -30.195,-28.185 -0.3689,-19.454 -33.444,-17.876 -30.691,-31.892 -5.3458,-59.729 -15.582,-5.0632 -17.324,-14.89 -11.086,12.896 -14.512,-1.6954 -11.166,-10.995 0.2636,-11.365 -18.639,-11.91 -25.607,-6.5757 -5.8842,3.1388 -14.403,3.9638 -17.373,11.046 -13.66,2.7421 -12.28,-17.783 -26.048,-16.916 -15.276,-6.4266 -21.571,-23.77 -33.99,-13.45 -8.9365,2.8834 -27.358,38.752 -33.694,23.765 -13.5,-9.5163 -20.451,15.279 -20.026,25.654 -6.3485,13.802 -17.899,25.142 -24.397,39.356 -8.0969,13.6 -8.0574,31.852 -2.7715,46.369 16.911,-8.3049 18.513,27.307 24.313,42.266 8.439,10.014 21.898,-12.821 25.417,-6.9099 22.751,14.162 -5.2534,18.337 -1.2166,29.083 4.539,15.527 24.377,5.6814 35.735,9.2032 4.7599,1.8134 10.807,12.467 13.777,3.1751 -1.815,-6.8086 -5.6283,-13.445 4.7747,-13.371 7.3152,-6.3929 17.349,-5.3491 24.821,-7.2415 9.0393,-11.572 -10.092,-19.333 -4.8746,-30.443 2.8779,-11.759 -12.73,-8.4941 -10.462,-18.846 -7.0124,-5.8828 -11.048,-16.424 0.2223,-20.807 7.9487,-5.15 29.707,5.1288 24.31,-11.199 -6.8963,-0.46855 -16.33,-6.6026 -8.8168,-14.327 10.756,-7.5046 26.836,6.3362 36.887,-4.9453 1.0925,-5.4659 4.6002,-20.74 11.751,-10.347 -2.0036,12.706 4.4139,23.496 16.934,28.605 5.6256,3.7827 11.442,24.659 18.963,12.144 -10.579,-15.807 -1.3253,-36.935 21.493,-9.7167 -0.2777,2.0581 -0.6355,4.9085 1.6013,6.0725 z M 2374.3,129.476 c -3.3727,-9.642 -15.855,0.88715 -7.0124,5.9448 -1.4949,18.168 -23.383,19.29 -37.295,19.685 -8.7173,4.2923 -20.669,6.5967 -27.583,10.788 -1.5637,11.397 17.747,10.622 15.712,22.827 8.4646,11.957 22.01,19.653 28.373,33.172 12.227,10.86 6.5682,-16.046 -1.1103,-17.921 -11.846,-4.4912 -26.133,-24.017 -7.6284,-30.074 12.233,-3.4412 6.304,-25.137 22.916,-20.183 15.144,3.9218 14.776,-14.074 24.42,-20.796 2.2128,-9.6425 -5.7023,-6.6942 -10.791,-3.4427 z" />
<path
style="fill:#000024;fill-opacity:0.86431998"
id="path90"
d="m 2396.24,352.058 c 82.8,0 151.24,-66.255 151.24,-149.42 0,-83.165 -65.111,-151.91 -151.24,-151.91 z" />
</g>
</g>
</svg>

+ 78
- 0
kosmorrolib/assets/moonphases/svg/new-moon.svg View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg5292"
version="1.1"
viewBox="0 0 92.682014 92.684387"
height="92.684387mm"
width="92.682014mm">
<defs
id="defs5286">
<radialGradient
gradientTransform="translate(-41.85,-50.912)"
r="234.94"
fx="248.94"
cy="354.57001"
cx="245.39"
gradientUnits="userSpaceOnUse"
id="radialGradient4622"
xlink:href="#a" />
<radialGradient
gradientUnits="userSpaceOnUse"
fx="248.94"
r="234.94"
cy="354.57001"
cx="245.39"
id="a">
<stop
id="stop7"
offset="0"
stop-color="#b7c3cc" />
<stop
id="stop9"
offset="1"
stop-color="#001e29" />
</radialGradient>
</defs>
<metadata
id="metadata5289">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-15.647087,-114.58638)"
id="layer1">
<g
id="g4697"
transform="matrix(0.26458333,0,0,0.26458333,7.4191065,107.94465)">
<path
style="fill:#000024;fill-rule:evenodd;stroke-width:1.01019692"
id="path14"
d="m 362.49448,200.25419 a 156.24948,156.25396 0 1 1 -312.498961,0 156.24948,156.25396 0 1 1 312.498961,0 z" />
<path
style="fill:url(#radialGradient4622);fill-rule:evenodd"
id="path16"
d="m 164.32,56.438 c -25.06,6.447 -47.957,20.982 -65.936,39.456 -33.589,34.689 -49.415,85.84 -39.274,133.3 7.7684,38.332 30.319,73.818 63.261,95.34 39.082,26.542 90.824,33.344 135.13,16.523 44.589,-15.935 80.583,-53.959 92.968,-99.846 14.03,-47.365 2.42,-101 -30.04,-138.25 -27.522,-32.74 -69.296,-52.414 -112.07,-52.8 -2.4338,-0.40982 -30.229,1.5565 -44.039,6.2796 z" />
<path
style="fill-opacity:0.25126002;fill-rule:evenodd"
id="path18"
d="m 297.02,188.908 c -10.37,17.497 15.281,19.939 24.511,25.141 -3.4576,-31.524 10.512,-20.807 13.141,-30.822 -2.4603,-15.476 -20.24,-18.289 -30.195,-28.185 -0.36892,-19.454 -33.444,-17.876 -30.691,-31.892 -5.3458,-59.729 -15.582,-5.0632 -17.324,-14.89 -11.086,12.896 -14.512,-1.6954 -11.166,-10.995 0.26364,-11.365 -18.639,-11.91 -25.607,-6.5757 -5.8842,3.1388 -14.403,3.9638 -17.373,11.046 -13.66,2.7421 -12.28,-17.783 -26.048,-16.916 -15.276,-6.4266 -21.571,-23.77 -33.99,-13.45 -8.9365,2.8834 -27.358,38.752 -33.694,23.765 -13.5,-9.5163 -20.451,15.279 -20.026,25.654 -6.3485,13.802 -17.899,25.142 -24.397,39.356 -8.0969,13.6 -8.0574,31.852 -2.7715,46.369 16.911,-8.3049 18.513,27.307 24.313,42.266 8.439,10.014 21.898,-12.821 25.417,-6.9099 22.751,14.162 -5.2534,18.337 -1.2166,29.083 4.539,15.527 24.377,5.6814 35.735,9.2032 4.7599,1.8134 10.807,12.467 13.777,3.1751 -1.815,-6.8086 -5.6283,-13.445 4.7747,-13.371 7.3152,-6.3929 17.349,-5.3491 24.821,-7.2415 9.0393,-11.572 -10.092,-19.333 -4.8746,-30.443 2.8779,-11.759 -12.73,-8.4941 -10.462,-18.846 -7.0124,-5.8828 -11.048,-16.424 0.22233,-20.807 7.9487,-5.15 29.707,5.1288 24.31,-11.199 -6.8963,-0.46855 -16.33,-6.6026 -8.8168,-14.327 10.756,-7.5046 26.836,6.3362 36.887,-4.9453 1.0925,-5.4659 4.6002,-20.74 11.751,-10.347 -2.0036,12.706 4.4139,23.496 16.934,28.605 5.6256,3.7827 11.442,24.659 18.963,12.144 -10.579,-15.807 -1.3253,-36.935 21.493,-9.7167 -0.27777,2.0581 -0.63554,4.9085 1.6013,6.0725 z M 184.45,129.176 c -3.3727,-9.642 -15.855,0.88715 -7.0124,5.9448 -1.4949,18.168 -23.383,19.29 -37.295,19.685 -8.7173,4.2923 -20.669,6.5967 -27.583,10.788 -1.5637,11.397 17.747,10.622 15.712,22.827 8.4646,11.957 22.01,19.653 28.373,33.172 12.227,10.86 6.5682,-16.046 -1.1103,-17.921 -11.846,-4.4912 -26.133,-24.017 -7.6284,-30.074 12.233,-3.4412 6.304,-25.137 22.916,-20.183 15.144,3.9218 14.776,-14.074 24.42,-20.796 2.2128,-9.6425 -5.7023,-6.6942 -10.791,-3.4427 z" />
<path
style="fill:#000024;fill-opacity:0.86431998"
id="path20"
d="m 358.45,201.088 c 0,83.168 -68.058,150.67 -151.91,150.67 -83.852,0 -151.91,-67.499 -151.91,-150.67 0,-83.171 64.682,-150.67 151.91,-150.67 89.933,0 151.91,67.499 151.91,150.67 z" />
</g>
</g>
</svg>

+ 78
- 0
kosmorrolib/assets/moonphases/svg/waning-crescent.svg View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg10495"
version="1.1"
viewBox="0 0 92.68203 92.684402"
height="92.684402mm"
width="92.68203mm">
<defs
id="defs10489">
<radialGradient
gradientTransform="translate(2513.2,-50.612)"
r="234.94"
fx="248.94"
cy="354.57001"
cx="245.39"
gradientUnits="userSpaceOnUse"
id="radialGradient4684"
xlink:href="#a" />
<radialGradient
gradientUnits="userSpaceOnUse"
fx="248.94"
r="234.94"
cy="354.57001"
cx="245.39"
id="a">
<stop
id="stop7"
offset="0"
stop-color="#b7c3cc" />
<stop
id="stop9"
offset="1"
stop-color="#001e29" />
</radialGradient>
</defs>
<metadata
id="metadata10492">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-59.492323,-102.49113)"
id="layer1">
<g
id="g10470"
transform="matrix(0.26458333,0,0,0.26458333,-624.75929,95.770038)">
<path
style="fill:#000024;fill-rule:evenodd;stroke-width:1.01019692"
id="path96"
d="m 2917.5445,200.55419 a 156.2495,156.25398 0 1 1 -312.499,0 156.2495,156.25398 0 1 1 312.499,0 z" />
<path
style="fill:url(#radialGradient4684);fill-rule:evenodd"
id="path98"
d="m 2719.37,56.738 c -25.06,6.447 -47.957,20.982 -65.936,39.456 -33.589,34.689 -49.415,85.84 -39.274,133.3 7.7684,38.332 30.319,73.818 63.261,95.34 39.082,26.542 90.824,33.344 135.13,16.523 44.589,-15.935 80.583,-53.959 92.968,-99.846 14.03,-47.365 2.42,-101 -30.04,-138.25 -27.522,-32.74 -69.296,-52.414 -112.07,-52.8 -2.4338,-0.40982 -30.229,1.5565 -44.039,6.2796 z" />
<path
style="fill-opacity:0.25126002;fill-rule:evenodd"
id="path100"
d="m 2852.07,189.208 c -10.37,17.497 15.281,19.939 24.511,25.141 -3.4576,-31.524 10.512,-20.807 13.141,-30.822 -2.4603,-15.476 -20.24,-18.289 -30.195,-28.185 -0.3689,-19.454 -33.444,-17.876 -30.691,-31.892 -5.3458,-59.729 -15.582,-5.0632 -17.324,-14.89 -11.086,12.896 -14.512,-1.6954 -11.166,-10.995 0.2636,-11.365 -18.639,-11.91 -25.607,-6.5757 -5.8842,3.1388 -14.403,3.9638 -17.373,11.046 -13.66,2.7421 -12.28,-17.783 -26.048,-16.916 -15.276,-6.4266 -21.571,-23.77 -33.99,-13.45 -8.9365,2.8834 -27.358,38.752 -33.694,23.765 -13.5,-9.5163 -20.451,15.279 -20.026,25.654 -6.3485,13.802 -17.899,25.142 -24.397,39.356 -8.0969,13.6 -8.0574,31.852 -2.7715,46.369 16.911,-8.3049 18.513,27.307 24.313,42.266 8.439,10.014 21.898,-12.821 25.417,-6.9099 22.751,14.162 -5.2534,18.337 -1.2166,29.083 4.539,15.527 24.377,5.6814 35.735,9.2032 4.7599,1.8134 10.807,12.467 13.777,3.1751 -1.815,-6.8086 -5.6283,-13.445 4.7747,-13.371 7.3152,-6.3929 17.349,-5.3491 24.821,-7.2415 9.0393,-11.572 -10.092,-19.333 -4.8746,-30.443 2.8779,-11.759 -12.73,-8.4941 -10.462,-18.846 -7.0124,-5.8828 -11.048,-16.424 0.2223,-20.807 7.9487,-5.15 29.707,5.1288 24.31,-11.199 -6.8963,-0.46855 -16.33,-6.6026 -8.8168,-14.327 10.756,-7.5046 26.836,6.3362 36.887,-4.9453 1.0925,-5.4659 4.6002,-20.74 11.751,-10.347 -2.0036,12.706 4.4139,23.496 16.934,28.605 5.6256,3.7827 11.442,24.659 18.963,12.144 -10.579,-15.807 -1.3253,-36.935 21.493,-9.7167 -0.2777,2.0581 -0.6355,4.9085 1.6013,6.0725 z M 2739.5,129.476 c -3.3727,-9.642 -15.855,0.88715 -7.0124,5.9448 -1.4949,18.168 -23.383,19.29 -37.295,19.685 -8.7173,4.2923 -20.669,6.5967 -27.583,10.788 -1.5637,11.397 17.747,10.622 15.712,22.827 8.4646,11.957 22.01,19.653 28.373,33.172 12.227,10.86 6.5682,-16.046 -1.1103,-17.921 -11.846,-4.4912 -26.133,-24.017 -7.6284,-30.074 12.233,-3.4412 6.304,-25.137 22.916,-20.183 15.144,3.9218 14.776,-14.074 24.42,-20.796 2.2128,-9.6425 -5.7023,-6.6942 -10.791,-3.4427 z" />
<path
style="fill:#000024;fill-opacity:0.86431998;fill-rule:evenodd"
id="path102"
d="m 2677.63,200.738 c 0.071,0.26538 -9.293,155.82 76.975,155.82 86.268,0 156.99,-70.513 156.99,-156.52 0,-86.007 -70.722,-155.11 -156.99,-155.11 -86.268,0 -76.975,156.62 -76.975,155.82 z" />
</g>
</g>
</svg>

+ 78
- 0
kosmorrolib/assets/moonphases/svg/waning-gibbous.svg View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg9171"
version="1.1"
viewBox="0 0 92.68203 92.684395"
height="92.684395mm"
width="92.68203mm">
<defs
id="defs9165">
<radialGradient
gradientTransform="translate(1783.2,-50.712)"
r="234.94"
fx="248.94"
cy="354.57001"
cx="245.39"
gradientUnits="userSpaceOnUse"
id="radialGradient4666"
xlink:href="#a" />
<radialGradient
gradientUnits="userSpaceOnUse"
fx="248.94"
r="234.94"
cy="354.57001"
cx="245.39"
id="a">
<stop
id="stop7"
offset="0"
stop-color="#b7c3cc" />
<stop
id="stop9"
offset="1"
stop-color="#001e29" />
</radialGradient>
</defs>
<metadata
id="metadata9168">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(54.656488,-148.60423)"
id="layer1">
<g
id="g8556"
transform="matrix(0.26458333,0,0,0.26458333,-545.76227,141.90959)">
<path
style="fill:#000024;fill-rule:evenodd;stroke-width:1.01019692"
id="path72"
d="m 2187.5445,200.45419 a 156.2495,156.25398 0 1 1 -312.499,0 156.2495,156.25398 0 1 1 312.499,0 z" />
<path
style="fill:url(#radialGradient4666);fill-rule:evenodd"
id="path74"
d="m 1989.37,56.638 c -25.06,6.447 -47.957,20.982 -65.936,39.456 -33.589,34.689 -49.415,85.84 -39.274,133.3 7.7684,38.332 30.319,73.818 63.261,95.34 39.082,26.542 90.824,33.344 135.13,16.523 44.589,-15.935 80.583,-53.959 92.968,-99.846 14.03,-47.365 2.42,-101 -30.04,-138.25 -27.522,-32.74 -69.296,-52.414 -112.07,-52.8 -2.4338,-0.40982 -30.229,1.5565 -44.039,6.2796 z" />
<path
style="fill-opacity:0.25126002;fill-rule:evenodd"
id="path76"
d="m 2122.07,189.108 c -10.37,17.497 15.281,19.939 24.511,25.141 -3.4576,-31.524 10.512,-20.807 13.141,-30.822 -2.4603,-15.476 -20.24,-18.289 -30.195,-28.185 -0.3689,-19.454 -33.444,-17.876 -30.691,-31.892 -5.3458,-59.729 -15.582,-5.0632 -17.324,-14.89 -11.086,12.896 -14.512,-1.6954 -11.166,-10.995 0.2636,-11.365 -18.639,-11.91 -25.607,-6.5757 -5.8842,3.1388 -14.403,3.9638 -17.373,11.046 -13.66,2.7421 -12.28,-17.783 -26.048,-16.916 -15.276,-6.4266 -21.571,-23.77 -33.99,-13.45 -8.9365,2.8834 -27.358,38.752 -33.694,23.765 -13.5,-9.5163 -20.451,15.279 -20.026,25.654 -6.3485,13.802 -17.899,25.142 -24.397,39.356 -8.0969,13.6 -8.0574,31.852 -2.7715,46.369 16.911,-8.3049 18.513,27.307 24.313,42.266 8.439,10.014 21.898,-12.821 25.417,-6.9099 22.751,14.162 -5.2534,18.337 -1.2166,29.083 4.539,15.527 24.377,5.6814 35.735,9.2032 4.7599,1.8134 10.807,12.467 13.777,3.1751 -1.815,-6.8086 -5.6283,-13.445 4.7747,-13.371 7.3152,-6.3929 17.349,-5.3491 24.821,-7.2415 9.0393,-11.572 -10.092,-19.333 -4.8746,-30.443 2.8779,-11.759 -12.73,-8.4941 -10.462,-18.846 -7.0124,-5.8828 -11.048,-16.424 0.2223,-20.807 7.9487,-5.15 29.707,5.1288 24.31,-11.199 -6.8963,-0.46855 -16.33,-6.6026 -8.8168,-14.327 10.756,-7.5046 26.836,6.3362 36.887,-4.9453 1.0925,-5.4659 4.6002,-20.74 11.751,-10.347 -2.0036,12.706 4.4139,23.496 16.934,28.605 5.6256,3.7827 11.442,24.659 18.963,12.144 -10.579,-15.807 -1.3253,-36.935 21.493,-9.7167 -0.2777,2.0581 -0.6355,4.9085 1.6013,6.0725 z M 2009.5,129.376 c -3.3727,-9.642 -15.855,0.88715 -7.0124,5.9448 -1.4949,18.168 -23.383,19.29 -37.295,19.685 -8.7173,4.2923 -20.669,6.5967 -27.583,10.788 -1.5637,11.397 17.747,10.622 15.712,22.827 8.4646,11.957 22.01,19.653 28.373,33.172 12.227,10.86 6.5682,-16.046 -1.1103,-17.921 -11.846,-4.4912 -26.133,-24.017 -7.6284,-30.074 12.233,-3.4412 6.304,-25.137 22.916,-20.183 15.144,3.9218 14.776,-14.074 24.42,-20.796 2.2128,-9.6425 -5.7023,-6.6942 -10.791,-3.4427 z" />
<path
style="fill:#000024;fill-opacity:0.86431998"
id="path78"
d="m 2031.09,351.958 c 82.8,0 150.54,-68.432 150.54,-151.6 0,-83.168 -64.411,-149.73 -150.54,-149.73 103.26,-4.0552 104.5,307.88 0,301.33 z" />
</g>
</g>
</svg>

+ 78
- 0
kosmorrolib/assets/moonphases/svg/waxing-crescent.svg View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg5978"
version="1.1"
viewBox="0 0 92.787987 92.694862"
height="92.694862mm"
width="92.787987mm">
<defs
id="defs5972">
<radialGradient
gradientTransform="translate(323.55,-50.712)"
r="234.94"
fx="248.94"
cy="354.57001"
cx="245.39"
gradientUnits="userSpaceOnUse"
id="radialGradient4631"
xlink:href="#a" />
<radialGradient
gradientUnits="userSpaceOnUse"
fx="248.94"
r="234.94"
cy="354.57001"
cx="245.39"
id="a">
<stop
id="stop7"
offset="0"
stop-color="#b7c3cc" />
<stop
id="stop9"
offset="1"
stop-color="#001e29" />
</radialGradient>
</defs>
<metadata
id="metadata5975">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(52.441611,-215.87876)"
id="layer1">
<g
id="g5953"
transform="matrix(0.26458333,0,0,0.26458333,-157.24237,209.19458)">
<path
style="fill:#000024;fill-rule:evenodd;stroke-width:1.01019692"
id="path26"
d="m 727.89449,200.45419 a 156.24948,156.25403 0 1 1 -312.49897,0 156.24949,156.25397 0 1 1 312.49897,0 z" />
<path
style="fill:url(#radialGradient4631);fill-rule:evenodd"
id="path28"
d="m 529.72,56.638 c -25.06,6.447 -47.957,20.982 -65.936,39.456 -33.589,34.689 -49.415,85.84 -39.274,133.3 7.7684,38.332 30.319,73.818 63.261,95.34 39.082,26.542 90.824,33.344 135.13,16.523 44.589,-15.935 80.583,-53.959 92.968,-99.846 14.03,-47.365 2.42,-101 -30.04,-138.25 -27.522,-32.74 -69.296,-52.414 -112.07,-52.8 -2.4338,-0.40982 -30.229,1.5565 -44.039,6.2796 z" />
<path
style="fill-opacity:0.25126002;fill-rule:evenodd"
id="path30"
d="m 662.42,189.108 c -10.37,17.497 15.281,19.939 24.511,25.141 -3.4576,-31.524 10.512,-20.807 13.141,-30.822 -2.4603,-15.476 -20.24,-18.289 -30.195,-28.185 -0.36892,-19.454 -33.444,-17.876 -30.691,-31.892 -5.3458,-59.729 -15.582,-5.0632 -17.324,-14.89 -11.086,12.896 -14.512,-1.6954 -11.166,-10.995 0.26364,-11.365 -18.639,-11.91 -25.607,-6.5757 -5.8842,3.1388 -14.403,3.9638 -17.373,11.046 -13.66,2.7421 -12.28,-17.783 -26.048,-16.916 -15.276,-6.4266 -21.571,-23.77 -33.99,-13.45 -8.9365,2.8834 -27.358,38.752 -33.694,23.765 -13.5,-9.5163 -20.451,15.279 -20.026,25.654 -6.3485,13.802 -17.899,25.142 -24.397,39.356 -8.0969,13.6 -8.0574,31.852 -2.7715,46.369 16.911,-8.3049 18.513,27.307 24.313,42.266 8.439,10.014 21.898,-12.821 25.417,-6.9099 22.751,14.162 -5.2534,18.337 -1.2166,29.083 4.539,15.527 24.377,5.6814 35.735,9.2032 4.7599,1.8134 10.807,12.467 13.777,3.1751 -1.815,-6.8086 -5.6283,-13.445 4.7747,-13.371 7.3152,-6.3929 17.349,-5.3491 24.821,-7.2415 9.0393,-11.572 -10.092,-19.333 -4.8746,-30.443 2.8779,-11.759 -12.73,-8.4941 -10.462,-18.846 -7.0124,-5.8828 -11.048,-16.424 0.22233,-20.807 7.9487,-5.15 29.707,5.1288 24.31,-11.199 -6.8963,-0.46855 -16.33,-6.6026 -8.8168,-14.327 10.756,-7.5046 26.836,6.3362 36.887,-4.9453 1.0925,-5.4659 4.6002,-20.74 11.751,-10.347 -2.0036,12.706 4.4139,23.496 16.934,28.605 5.6256,3.7827 11.442,24.659 18.963,12.144 -10.579,-15.807 -1.3253,-36.935 21.493,-9.7167 -0.27777,2.0581 -0.63554,4.9085 1.6013,6.0725 z M 549.85,129.376 c -3.3727,-9.642 -15.855,0.88715 -7.0124,5.9448 -1.4949,18.168 -23.383,19.29 -37.295,19.685 -8.7173,4.2923 -20.669,6.5967 -27.583,10.788 -1.5637,11.397 17.747,10.622 15.712,22.827 8.4646,11.957 22.01,19.653 28.373,33.172 12.227,10.86 6.5682,-16.046 -1.1103,-17.921 -11.846,-4.4912 -26.133,-24.017 -7.6284,-30.074 12.233,-3.4412 6.304,-25.137 22.916,-20.183 15.144,3.9218 14.776,-14.074 24.42,-20.796 2.2128,-9.6425 -5.7023,-6.6942 -10.791,-3.4427 z" />
<path
style="fill:#000024;fill-opacity:0.86431998;fill-rule:evenodd"
id="path32"
d="m 648.25,200.638 c -0.0711,0.26538 9.293,155.82 -76.975,155.82 -86.268,0 -156.28,-69.806 -156.28,-155.82 0,-86.014 70.015,-155.82 156.28,-155.82 86.265,0 76.975,156.62 76.975,155.82 z" />
</g>
</g>
</svg>

+ 78
- 0
kosmorrolib/assets/moonphases/svg/waxing-gibbous.svg View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg7227"
version="1.1"
viewBox="0 0 92.68203 92.684395"
height="92.684395mm"
width="92.68203mm">
<defs
id="defs7221">
<radialGradient
gradientTransform="translate(1053.2,-50.612)"
r="234.94"
fx="248.94"
cy="354.57001"
cx="245.39"
gradientUnits="userSpaceOnUse"
id="radialGradient4649"
xlink:href="#a" />
<radialGradient
gradientUnits="userSpaceOnUse"
fx="248.94"
r="234.94"
cy="354.57001"
cx="245.39"
id="a">
<stop
id="stop7"
offset="0"
stop-color="#b7c3cc" />
<stop
id="stop9"
offset="1"
stop-color="#001e29" />
</radialGradient>
</defs>
<metadata
id="metadata7224">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(7.7874386,-141.04471)"
id="layer1">
<g
id="g7202"
transform="matrix(0.26458333,0,0,0.26458333,-305.74739,134.32361)">
<path
style="fill:#000024;fill-rule:evenodd;stroke-width:1.01019692"
id="path50"
d="m 1457.5445,200.55419 a 156.2495,156.25398 0 1 1 -312.499,0 156.2495,156.25398 0 1 1 312.499,0 z" />
<path
style="fill:url(#radialGradient4649);fill-rule:evenodd"
id="path52"
d="m 1259.37,56.738 c -25.06,6.447 -47.957,20.982 -65.936,39.456 -33.589,34.689 -49.415,85.84 -39.274,133.3 7.7684,38.332 30.319,73.818 63.261,95.34 39.082,26.542 90.824,33.344 135.13,16.523 44.589,-15.935 80.583,-53.959 92.968,-99.846 14.03,-47.365 2.42,-101 -30.04,-138.25 -27.522,-32.74 -69.296,-52.414 -112.07,-52.8 -2.4338,-0.40982 -30.229,1.5565 -44.039,6.2796 z" />
<path
style="fill-opacity:0.25126002;fill-rule:evenodd"
id="path54"
d="m 1392.07,189.208 c -10.37,17.497 15.281,19.939 24.511,25.141 -3.4576,-31.524 10.512,-20.807 13.141,-30.822 -2.4603,-15.476 -20.24,-18.289 -30.195,-28.185 -0.3689,-19.454 -33.444,-17.876 -30.691,-31.892 -5.3458,-59.729 -15.582,-5.0632 -17.324,-14.89 -11.086,12.896 -14.512,-1.6954 -11.166,-10.995 0.2636,-11.365 -18.639,-11.91 -25.607,-6.5757 -5.8842,3.1388 -14.403,3.9638 -17.373,11.046 -13.66,2.7421 -12.28,-17.783 -26.048,-16.916 -15.276,-6.4266 -21.571,-23.77 -33.99,-13.45 -8.9365,2.8834 -27.358,38.752 -33.694,23.765 -13.5,-9.5163 -20.451,15.279 -20.026,25.654 -6.3485,13.802 -17.899,25.142 -24.397,39.356 -8.0969,13.6 -8.0574,31.852 -2.7715,46.369 16.911,-8.3049 18.513,27.307 24.313,42.266 8.439,10.014 21.898,-12.821 25.417,-6.9099 22.751,14.162 -5.2534,18.337 -1.2166,29.083 4.539,15.527 24.377,5.6814 35.735,9.2032 4.7599,1.8134 10.807,12.467 13.777,3.1751 -1.815,-6.8086 -5.6283,-13.445 4.7747,-13.371 7.3152,-6.3929 17.349,-5.3491 24.821,-7.2415 9.0393,-11.572 -10.092,-19.333 -4.8746,-30.443 2.8779,-11.759 -12.73,-8.4941 -10.462,-18.846 -7.0124,-5.8828 -11.048,-16.424 0.2223,-20.807 7.9487,-5.15 29.707,5.1288 24.31,-11.199 -6.8963,-0.46855 -16.33,-6.6026 -8.8168,-14.327 10.756,-7.5046 26.836,6.3362 36.887,-4.9453 1.0925,-5.4659 4.6002,-20.74 11.751,-10.347 -2.0036,12.706 4.4139,23.496 16.934,28.605 5.6256,3.7827 11.442,24.659 18.963,12.144 -10.579,-15.807 -1.3253,-36.935 21.493,-9.7167 -0.2777,2.0581 -0.6355,4.9085 1.6013,6.0725 z M 1279.5,129.476 c -3.3727,-9.642 -15.855,0.88715 -7.0124,5.9448 -1.4949,18.168 -23.383,19.29 -37.295,19.685 -8.7173,4.2923 -20.669,6.5967 -27.583,10.788 -1.5637,11.397 17.747,10.622 15.712,22.827 8.4646,11.957 22.01,19.653 28.373,33.172 12.227,10.86 6.5682,-16.046 -1.1103,-17.921 -11.846,-4.4912 -26.133,-24.017 -7.6284,-30.074 12.233,-3.4412 6.304,-25.137 22.916,-20.183 15.144,3.9218 14.776,-14.074 24.42,-20.796 2.2128,-9.6425 -5.7023,-6.6942 -10.791,-3.4427 z" />
<path
style="fill:#000024;fill-opacity:0.86431998"
id="path56"
d="m 1301.56,352.058 c -82.8,0 -150.78,-67.499 -150.78,-150.67 0,-83.171 64.644,-150.67 150.78,-150.67 -103.26,-4.0552 -104.5,307.88 0,301.33 z" />
</g>
</g>
</svg>

+ 90
- 0
kosmorrolib/assets/pdf/template.tex View File

@@ -0,0 +1,90 @@
\documentclass[a4paper,12pt]{article}

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

% Fix non-break spaces issues
\DeclareUnicodeCharacter{202F}{~}

\hypersetup{pdfinfo={
Title={+++DOCUMENT-TITLE+++},
Creator={Kosmorro v+++KOSMORRO-VERSION+++}
}}

\pagenumbering{gobble}
\setcounter{secnumdepth}{0}

\title{\sffamily\href{http://kosmorro.space}{\includegraphics[width=5cm]{+++KOSMORRO-LOGO+++}}\\+++DOCUMENT-TITLE+++}
\date{\vspace{-11mm}\sffamily +++DOCUMENT-DATE+++}

\begin{document}

\newcommand{\object}[4]{
\hline
\textbf{#1} & {#2} & {#3} & {#4}\\
}

\newcommand{\moonphase}[2]{
\begin{center}
\begin{minipage}{2cm}
\includegraphics[width=\linewidth]{#1}
\end{minipage}
\hspace{5mm}
\begin{minipage}{7cm}
\textbf{+++CURRENT-MOON-PHASE-TITLE+++}\\#2
\end{minipage}
\end{center}
}

\newenvironment{ephemerides}{
\begin{table}[h]
\centering
\begin{tabular}{lccc}
\textbf{+++EPHEMERIDES-OBJECT+++} &
\textbf{+++EPHEMERIDES-RISE-TIME+++} &
\textbf{+++EPHEMERIDES-CULMINATION-TIME+++} &
\textbf{+++EPHEMERIDES-SET-TIME+++}\\
\hline
}{
\end{tabular}
\end{table}
}

\newcommand{\event}[2]{
\textbf{#1} & {#2}\\
}

\newenvironment{events}{
\begin{table}[h]
\begin{tabular}{ll}
}{
\end{tabular}
\end{table}
}

\maketitle

+++INTRODUCTION+++

\moonphase{+++MOON-PHASE-GRAPHICS+++}{+++CURRENT-MOON-PHASE+++}

%%% BEGIN-EPHEMERIDES-SECTION
\section{\sffamily +++SECTION-EPHEMERIDES+++}

\begin{ephemerides}
+++EPHEMERIDES+++
\end{ephemerides}
%%% END-EPHEMERIDES-SECTION

%%% BEGIN-EVENTS-SECTION
\section{\sffamily +++SECTION-EVENTS+++}

\begin{events}
+++EVENTS+++
\end{events}
%%% END-EVENTS-SECTION

\end{document}

assets/png/kosmorro-icon-white.png → kosmorrolib/assets/png/kosmorro-icon-white.png View File


assets/png/kosmorro-icon.png → kosmorrolib/assets/png/kosmorro-icon.png View File


assets/png/kosmorro-logo-white.png → kosmorrolib/assets/png/kosmorro-logo-white.png View File


assets/png/kosmorro-logo.png → kosmorrolib/assets/png/kosmorro-logo.png View File


assets/svg/kosmorro-icon-white.svg → kosmorrolib/assets/svg/kosmorro-icon-white.svg View File


assets/svg/kosmorro-icon.svg → kosmorrolib/assets/svg/kosmorro-icon.svg View File


assets/svg/kosmorro-logo-white.svg → kosmorrolib/assets/svg/kosmorro-logo-white.svg View File


assets/svg/kosmorro-logo.svg → kosmorrolib/assets/svg/kosmorro-logo.svg View File


+ 149
- 6
kosmorrolib/dumper.py View File

@@ -19,12 +19,19 @@
from abc import ABC, abstractmethod
import datetime
import json
import os
from tabulate import tabulate
from skyfield.timelib import Time
from numpy import int64
from termcolor import colored
from .data import Object, AsterEphemerides, MoonPhase, Event
from .i18n import _
from .version import VERSION
from .exceptions import UnavailableFeatureError
try:
from latex import build_pdf
except ImportError:
build_pdf = None

FULL_DATE_FORMAT = _('{day_of_week} {month} {day_number}, {year}').format(day_of_week='%A', month='%B',
day_number='%d', year='%Y')
@@ -39,10 +46,22 @@ class Dumper(ABC):
self.date = date
self.with_colors = with_colors

def get_date_as_string(self, capitalized: bool = False) -> str:
date = self.date.strftime(FULL_DATE_FORMAT)

if capitalized:
return ''.join([date[0].upper(), date[1:]])

return date

@abstractmethod
def to_string(self):
pass

@staticmethod
def is_file_output_needed() -> bool:
return False


class JsonDumper(Dumper):
def to_string(self):
@@ -83,7 +102,7 @@ class JsonDumper(Dumper):

class TextDumper(Dumper):
def to_string(self):
text = [self.style(self.get_date(), 'h1')]
text = [self.style(self.get_date_as_string(capitalized=True), 'h1')]

if len(self.ephemeris['details']) > 0:
text.append(self.get_asters(self.ephemeris['details']))
@@ -112,11 +131,6 @@ class TextDumper(Dumper):

return styles[tag](text)

def get_date(self) -> str:
date = self.date.strftime(FULL_DATE_FORMAT)

return ''.join([date[0].upper(), date[1:]])

def get_asters(self, asters: [Object]) -> str:
data = []

@@ -164,3 +178,132 @@ class TextDumper(Dumper):
)

return '\n'.join([current_moon_phase, new_moon_phase])


class _LatexDumper(Dumper):
def to_string(self):
template_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'assets', 'pdf', 'template.tex')

with open(template_path, mode='r') as file:
template = file.read()

return self._make_document(template)

def _make_document(self, template: str) -> str:
kosmorro_logo_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'assets', 'png', 'kosmorro-logo.png')
moon_phase_graphics = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'assets', 'moonphases', 'png',
'.'.join([self.ephemeris['moon_phase'].identifier.lower().replace('_', '-'),
'png']))

document = template

if len(self.ephemeris['details']) == 0:
document = self._remove_section(document, 'ephemerides')

if len(self.events) == 0:
document = self._remove_section(document, 'events')

document = document \
.replace('+++KOSMORRO-VERSION+++', VERSION) \
.replace('+++KOSMORRO-LOGO+++', kosmorro_logo_path) \
.replace('+++DOCUMENT-TITLE+++', _('A Summary of your Sky')) \
.replace('+++DOCUMENT-DATE+++', self.get_date_as_string(capitalized=True)) \
.replace('+++INTRODUCTION+++',
'\n\n'.join([
_("This document summarizes the ephemerides and the events of {date}. "
"It aims to help you to prepare your observation session.").format(
date=self.get_date_as_string()),
_("Don't forget to check the weather forecast before you go out with your material.")
])) \
.replace('+++SECTION-EPHEMERIDES+++', _('Ephemerides of the day')) \
.replace('+++EPHEMERIDES-OBJECT+++', _('Object')) \
.replace('+++EPHEMERIDES-RISE-TIME+++', _('Rise time')) \
.replace('+++EPHEMERIDES-CULMINATION-TIME+++', _('Culmination time')) \
.replace('+++EPHEMERIDES-SET-TIME+++', _('Set time')) \
.replace('+++EPHEMERIDES+++', self._make_ephemerides()) \
.replace('+++MOON-PHASE-GRAPHICS+++', moon_phase_graphics) \
.replace('+++CURRENT-MOON-PHASE-TITLE+++', _('Moon phase:')) \
.replace('+++CURRENT-MOON-PHASE+++', self.ephemeris['moon_phase'].get_phase()) \
.replace('+++SECTION-EVENTS+++', _('Expected events')) \
.replace('+++EVENTS+++', self._make_events())

return document

def _make_ephemerides(self) -> str:
latex = []

for aster in self.ephemeris['details']:
if aster.ephemerides.rise_time is not None:
aster_rise = aster.ephemerides.rise_time.utc_strftime(TIME_FORMAT)
else:
aster_rise = '-'

if aster.ephemerides.culmination_time is not None:
aster_culmination = aster.ephemerides.culmination_time.utc_strftime(TIME_FORMAT)
else:
aster_culmination = '-'

if aster.ephemerides.set_time is not None:
aster_set = aster.ephemerides.set_time.utc_strftime(TIME_FORMAT)
else:
aster_set = '-'

latex.append(r'\object{%s}{%s}{%s}{%s}' % (aster.name,
aster_rise,
aster_culmination,
aster_set))

return ''.join(latex)

def _make_events(self) -> str:
latex = []

for event in self.events:
latex.append(r'\event{%s}{%s}' % (event.start_time.utc_strftime(TIME_FORMAT),
event.get_description()))

return ''.join(latex)

@staticmethod
def _remove_section(document: str, section: str):
begin_section_tag = '%%%%%% BEGIN-%s-SECTION' % section.upper()
end_section_tag = '%%%%%% END-%s-SECTION' % section.upper()

document = document.split('\n')
new_document = []

ignore_line = False
for line in document:
if begin_section_tag in line or end_section_tag in line:
ignore_line = not ignore_line
continue
if ignore_line:
continue
new_document.append(line)

return '\n'.join(new_document)


class PdfDumper(Dumper):
def to_string(self):
try:
latex_dumper = _LatexDumper(self.ephemeris, self.events, self.date, self.with_colors)
return self._compile(latex_dumper.to_string())
except RuntimeError:
raise UnavailableFeatureError(_("Building PDFs was not possible, because some dependencies are not"
" installed.\nPlease look at the documentation at http://kosmorro.space "
"for more information."))

@staticmethod
def is_file_output_needed() -> bool:
return True

@staticmethod
def _compile(latex_input) -> bytes:
if build_pdf is None:
raise RuntimeError('Python latex module not found')

return bytes(build_pdf(latex_input))

+ 23
- 0
kosmorrolib/exceptions.py View File

@@ -0,0 +1,23 @@
#!/usr/bin/env python3

# Kosmorro - Compute The Next Ephemerides
# Copyright (C) 2019 Jérôme Deuchnord <jerome@deuchnord.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.


class UnavailableFeatureError(RuntimeError):
def __init__(self, msg: str):
super(UnavailableFeatureError, self).__init__()
self.msg = msg

+ 84
- 25
kosmorrolib/locales/messages.pot View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: kosmorro 0.5.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2020-02-03 13:19+0100\n"
"POT-Creation-Date: 2020-02-04 13:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -99,111 +99,170 @@ msgstr ""
msgid "%s and %s are in conjunction"
msgstr ""

#: kosmorrolib/dumper.py:29
#: kosmorrolib/dumper.py:36
msgid "{day_of_week} {month} {day_number}, {year}"
msgstr ""

#: kosmorrolib/dumper.py:31
#: kosmorrolib/dumper.py:38
msgid "{hours}:{minutes}"
msgstr ""

#: kosmorrolib/dumper.py:94
#: kosmorrolib/dumper.py:113
msgid "Expected events:"
msgstr ""

#: kosmorrolib/dumper.py:97
#: kosmorrolib/dumper.py:116
msgid "Note: All the hours are given in UTC."
msgstr ""

#: kosmorrolib/dumper.py:143
#: kosmorrolib/dumper.py:157 kosmorrolib/dumper.py:222
msgid "Object"
msgstr ""

#: kosmorrolib/dumper.py:144
#: kosmorrolib/dumper.py:158 kosmorrolib/dumper.py:223
msgid "Rise time"
msgstr ""

#: kosmorrolib/dumper.py:145
#: kosmorrolib/dumper.py:159 kosmorrolib/dumper.py:224
msgid "Culmination time"
msgstr ""

#: kosmorrolib/dumper.py:146
#: kosmorrolib/dumper.py:160 kosmorrolib/dumper.py:225
msgid "Set time"
msgstr ""

#: kosmorrolib/dumper.py:159
#: kosmorrolib/dumper.py:173 kosmorrolib/dumper.py:228
msgid "Moon phase:"
msgstr ""

#: kosmorrolib/dumper.py:160
#: kosmorrolib/dumper.py:174
msgid "{next_moon_phase} on {next_moon_phase_date} at {next_moon_phase_time}"
msgstr ""

#: kosmorrolib/main.py:76
msgid "Running on Python {python_version}"
#: kosmorrolib/dumper.py:212
msgid "A Summary of your Sky"
msgstr ""

#: kosmorrolib/dumper.py:216
msgid ""
"This document summarizes the ephemerides and the events of {date}. It "
"aims to help you to prepare your observation session."
msgstr ""

#: kosmorrolib/dumper.py:219
msgid ""
"Don't forget to check the weather forecast before you go out with your "
"material."
msgstr ""

#: kosmorrolib/dumper.py:221
msgid "Ephemerides of the day"
msgstr ""

#: kosmorrolib/dumper.py:230
msgid "Expected events"
msgstr ""

#: kosmorrolib/dumper.py:296
msgid ""
"Building PDFs was not possible, because some dependencies are not "
"installed.\n"
"Please look at the documentation at http://kosmorro.space for more "
"information."
msgstr ""

#: kosmorrolib/main.py:58
msgid ""
"Save the planet and paper!\n"
"Consider printing you PDF document only if really necessary, and use the "
"other side of the sheet."
msgstr ""

#: kosmorrolib/main.py:62
msgid ""
"PDF output will not contain the ephemerides, because you didn't provide "
"the observation coordinate."
msgstr ""

#: kosmorrolib/main.py:82
msgid "Could not save the output in \"{path}\": {error}"
msgstr ""

#: kosmorrolib/main.py:87
msgid "Selected output format needs an output file (--output)."
msgstr ""

#: kosmorrolib/main.py:104
msgid "Running on Python {python_version}"
msgstr ""

#: kosmorrolib/main.py:110
msgid "Do you really want to clear Kosmorro's cache? [yN] "
msgstr ""

#: kosmorrolib/main.py:89
#: kosmorrolib/main.py:117
msgid "Answer did not match expected options, cache not cleared."
msgstr ""

#: kosmorrolib/main.py:98
#: kosmorrolib/main.py:126
msgid ""
"Compute the ephemerides and the events for a given date, at a given "
"position on Earth."
msgstr ""

#: kosmorrolib/main.py:100
#: kosmorrolib/main.py:128
msgid ""
"By default, only the events will be computed for today ({date}).\n"
"To compute also the ephemerides, latitude and longitude arguments are "
"needed."
msgstr ""

#: kosmorrolib/main.py:105
#: kosmorrolib/main.py:133
msgid "Show the program version"
msgstr ""

#: kosmorrolib/main.py:107
#: kosmorrolib/main.py:135
msgid "Delete all the files Kosmorro stored in the cache."
msgstr ""

#: kosmorrolib/main.py:109
#: kosmorrolib/main.py:137
msgid "The format under which the information have to be output"
msgstr ""

#: kosmorrolib/main.py:111
#: kosmorrolib/main.py:139
msgid "The observer's latitude on Earth"
msgstr ""

#: kosmorrolib/main.py:113
#: kosmorrolib/main.py:141
msgid "The observer's longitude on Earth"
msgstr ""

#: kosmorrolib/main.py:115
#: kosmorrolib/main.py:143
msgid ""
"A number between 1 and 28, 29, 30 or 31 (depending on the month). The day"
" you want to compute the ephemerides for. Defaults to {default_day} (the"
" current day)."
msgstr ""

#: kosmorrolib/main.py:119
#: kosmorrolib/main.py:147
msgid ""
"A number between 1 and 12. The month you want to compute the ephemerides "
"for. Defaults to {default_month} (the current month)."
msgstr ""

#: kosmorrolib/main.py:122
#: kosmorrolib/main.py:150
msgid ""
"The year you want to compute the ephemerides for. Defaults to "
"{default_year} (the current year)."
msgstr ""

#: kosmorrolib/main.py:125
#: kosmorrolib/main.py:153
msgid "Disable the colors in the console."
msgstr ""

#: kosmorrolib/main.py:155
msgid ""
"A file to export the output to. If not given, the standard output is "
"used. This argument is needed for PDF format."
msgstr ""


+ 37
- 6
kosmorrolib/main.py View File

@@ -22,6 +22,7 @@ import re
import sys

from datetime import date
from termcolor import colored

from kosmorrolib.version import VERSION
from kosmorrolib import dumper
@@ -29,6 +30,7 @@ from kosmorrolib import core
from kosmorrolib import events
from kosmorrolib.i18n import _
from .ephemerides import EphemeridesComputer, Position
from .exceptions import UnavailableFeatureError


def main():
@@ -52,13 +54,38 @@ def main():
else:
position = Position(args.latitude, args.longitude)

ephemeris = EphemeridesComputer(position)
ephemerides = ephemeris.compute_ephemerides(year, month, day)
if args.format == 'pdf':
print(_('Save the planet and paper!\n'
'Consider printing you PDF document only if really necessary, and use the other side of the sheet.'))
if position is None:
print()
print(colored(_("PDF output will not contain the ephemerides, because you didn't provide the observation "
"coordinate."), 'yellow'))

events_list = events.search_events(compute_date)
try:
ephemeris = EphemeridesComputer(position)
ephemerides = ephemeris.compute_ephemerides(year, month, day)

dump = output_formats[args.format](ephemerides, events_list, compute_date, args.colors)
print(dump.to_string())
events_list = events.search_events(compute_date)

selected_dumper = output_formats[args.format](ephemerides, events_list, compute_date, args.colors)
output = selected_dumper.to_string()
except UnavailableFeatureError as error:
print(colored(error.msg, 'red'))
return 2

if args.output is not None:
try:
with open(args.output, 'wb') as output_file:
output_file.write(output)
except OSError as error:
print(_('Could not save the output in "{path}": {error}').format(path=args.output,
error=error.strerror))
elif not selected_dumper.is_file_output_needed():
print(output)
else:
print(_('Selected output format needs an output file (--output).'))
return 1

return 0

@@ -66,7 +93,8 @@ def main():
def get_dumpers() -> {str: dumper.Dumper}:
return {
'text': dumper.TextDumper,
'json': dumper.JsonDumper
'json': dumper.JsonDumper,
'pdf': dumper.PdfDumper
}


@@ -123,5 +151,8 @@ def get_args(output_formats: [str]):
' Defaults to {default_year} (the current year).').format(default_year=today.year))
parser.add_argument('--no-colors', dest='colors', action='store_false',
help=_('Disable the colors in the console.'))
parser.add_argument('--output', '-o', type=str, default=None,
help=_('A file to export the output to. If not given, the standard output is used. '
'This argument is needed for PDF format.'))

return parser.parse_args()

+ 50
- 13
test/dumper.py View File

@@ -2,7 +2,7 @@ import unittest
from datetime import date

from kosmorrolib.data import AsterEphemerides, Planet, MoonPhase, Event
from kosmorrolib.dumper import JsonDumper, TextDumper
from kosmorrolib.dumper import JsonDumper, TextDumper, _LatexDumper
from kosmorrolib.core import get_timescale


@@ -39,8 +39,7 @@ class DumperTestCase(unittest.TestCase):
' }\n'
' ]\n'
'}', JsonDumper(data,
[Event('OPPOSITION', [Planet('Mars', 'MARS')],
get_timescale().utc(2018, 7, 27, 5, 12))]
self._get_events()
).to_string())

def test_text_dumper_without_events(self):
@@ -65,10 +64,7 @@ class DumperTestCase(unittest.TestCase):
'Expected events:\n'
'05:12 Mars is in opposition\n\n'
'Note: All the hours are given in UTC.',
TextDumper(ephemerides, [Event('OPPOSITION',
[Planet('Mars', 'MARS')],
get_timescale().utc(2018, 7, 27, 5, 12))
], date=date(2019, 10, 14), with_colors=False).to_string())
TextDumper(ephemerides, self._get_events(), date=date(2019, 10, 14), with_colors=False).to_string())

def test_text_dumper_without_ephemerides_and_with_events(self):
ephemerides = self._get_data(False)
@@ -78,18 +74,59 @@ class DumperTestCase(unittest.TestCase):
'Expected events:\n'
'05:12 Mars is in opposition\n\n'
'Note: All the hours are given in UTC.',
TextDumper(ephemerides, [Event('OPPOSITION',
[Planet('Mars', 'MARS')],
get_timescale().utc(2018, 7, 27, 5, 12))
], date=date(2019, 10, 14), with_colors=False).to_string())
TextDumper(ephemerides, self._get_events(), date=date(2019, 10, 14), with_colors=False).to_string())

def test_latex_dumper(self):
latex = _LatexDumper(self._get_data(), self._get_events(), date=date(2019, 10, 14)).to_string()
self.assertRegex(latex, 'Monday October 14, 2019')
self.assertRegex(latex, 'Full Moon')
self.assertRegex(latex, r'\\section{\\sffamily Expected events}')
self.assertRegex(latex, r'\\section{\\sffamily Ephemerides of the day}')
self.assertRegex(latex, r'\\object\{Mars\}\{-\}\{-\}\{-\}')
self.assertRegex(latex, r'\\event\{05:12\}\{Mars is in opposition\}')

latex = _LatexDumper(self._get_data(aster_rise_set=True),
self._get_events(), date=date(2019, 10, 14)).to_string()
self.assertRegex(latex, r'\\object\{Mars\}\{08:00\}\{13:00\}\{23:00\}')

def test_latex_dumper_without_ephemerides(self):
latex = _LatexDumper(self._get_data(False), self._get_events(), date=date(2019, 10, 14)).to_string()
self.assertRegex(latex, 'Monday October 14, 2019')
self.assertRegex(latex, 'Full Moon')
self.assertRegex(latex, r'\\section{\\sffamily Expected events}')
self.assertRegex(latex, r'\\event\{05:12\}\{Mars is in opposition\}')

self.assertNotRegex(latex, r'\\object\{Mars\}\{-\}\{-\}\{-\}')
self.assertNotRegex(latex, r'\\section{\\sffamily Ephemerides of the day}')

def test_latex_dumper_without_events(self):
latex = _LatexDumper(self._get_data(), [], date=date(2019, 10, 14)).to_string()
self.assertRegex(latex, 'Monday October 14, 2019')
self.assertRegex(latex, 'Full Moon')
self.assertRegex(latex, r'\\object\{Mars\}\{-\}\{-\}\{-\}')
self.assertRegex(latex, r'\\section{\\sffamily Ephemerides of the day}')

self.assertNotRegex(latex, r'\\section{\\sffamily Expected events}')

@staticmethod
def _get_data(has_ephemerides: bool = True):
def _get_data(has_ephemerides: bool = True, aster_rise_set=False):
rise_time = get_timescale().utc(2019, 10, 14, 8) if aster_rise_set else None
culmination_time = get_timescale().utc(2019, 10, 14, 13) if aster_rise_set else None
set_time = get_timescale().utc(2019, 10, 14, 23) if aster_rise_set else None

return {
'moon_phase': MoonPhase('FULL_MOON', get_timescale().utc(2019, 10, 14), get_timescale().utc(2019, 10, 21)),
'details': [Planet('Mars', 'MARS', AsterEphemerides(None, None, None))] if has_ephemerides else []
'details': [Planet('Mars', 'MARS',
AsterEphemerides(rise_time, culmination_time, set_time))] if has_ephemerides else []
}

@staticmethod
def _get_events():
return [Event('OPPOSITION',
[Planet('Mars', 'MARS')],
get_timescale().utc(2018, 7, 27, 5, 12))
]


if __name__ == '__main__':
unittest.main()

Loading…
Cancel
Save