Skip to content

Commit

Permalink
update logos to svg versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Oct 27, 2023
1 parent 188b3a6 commit c5d9019
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/notebooks/figanos_docs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@
"outputs": [],
"source": [
"# To set a new default logo we can simply use an existing entry\n",
"l.set_logo(l.ouranos_logo_horizontal_couleur, \"default\")\n",
"l.set_logo(l.logo-ouranos-horizontal-couleur, \"default\")\n",
"print(f\"Default logo is found at: {l.default}\")\n",
"l.set_logo(l.ouranos_logo_vertical_couleur, \"my_custom_logo\")\n",
"l.set_logo(l.logo-ouranos-vertical-couleur, \"my_custom_logo\")\n",
"print(f\"my_custom_logo installed at: {l.my_custom_logo}.\")\n",
"\n",
"# Show all installed logos\n",
Expand Down
27 changes: 11 additions & 16 deletions figanos/_logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,20 @@ def install_ouranos_logos(self, *, permitted: bool = False) -> None:
if permitted:
for orientation in ["horizontal", "vertical"]:
for colour in ["couleur", "blanc", "noir"]:
for suffix in ["png", "svg"]:
if suffix == "svg" and not (
orientation == "horizontal" and colour == "couleur"
):
continue
file = f"ouranos_logo_{orientation}_{colour}.{suffix}"
if not (self.config / file).exists():
logo_url = urllib.parse.urljoin(OURANOS_LOGOS_URL, file)
try:
urllib.request.urlretrieve(logo_url, self.config / file)
self.set_logo(self.config / file)
except Exception as e:
logging.error(
f"Error downloading or setting Ouranos logo: {e}"
)
file = f"logo-ouranos-{orientation}-{colour}.svg"
if not (self.config / file).exists():
logo_url = urllib.parse.urljoin(OURANOS_LOGOS_URL, file)
try:
urllib.request.urlretrieve(logo_url, self.config / file)
self.set_logo(self.config / file)
except Exception as e:
logging.error(
f"Error downloading or setting Ouranos logo: {e}"
)

if Path(self.default).stem == "figanos_logo":
_default_ouranos_logo = (
self.config / "ouranos_logo_horizontal_couleur.svg"
self.config / "logo-ouranos-horizontal-couleur.svg"
)
warnings.warn(f"Setting default logo to {_default_ouranos_logo}.")
self.set_logo(_default_ouranos_logo, name="default")
Expand Down

0 comments on commit c5d9019

Please sign in to comment.