Skip to content

Commit

Permalink
better alg for splash screen
Browse files Browse the repository at this point in the history
  • Loading branch information
otvam committed Jun 30, 2023
1 parent 3ceadcd commit 9894b8e
Showing 1 changed file with 45 additions and 6 deletions.
51 changes: 45 additions & 6 deletions pypeec/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,29 @@
# create the logger
LOGGER = log.get_logger("MAIN")

# get logo display status
# get the logo display status
DISPLAY_LOGO = config.DISPLAY_LOGO

# display the logo
if DISPLAY_LOGO:
with importlib.resources.open_text("pypeec", "pypeec.txt") as file_logo:
data = file_logo.read()
print(data, flush=True)
# init the logo display status
STATUS_LOGO = False


def _display_logo():
"""
Display the logo as a splash screen.
"""

# variable with the logo status
global STATUS_LOGO

# display the logo
if DISPLAY_LOGO and not STATUS_LOGO:
with importlib.resources.open_text("pypeec", "pypeec.txt") as file_logo:
data = file_logo.read()
print(data, flush=True)

# logo has been displayed
STATUS_LOGO = True


def run_mesher_data(data_geometry, **kwargs):
Expand All @@ -48,6 +63,9 @@ def run_mesher_data(data_geometry, **kwargs):
data_voxel: dict (output data)
"""

# display logo
_display_logo()

# load the tool
LOGGER.info("load the mesher")
from pypeec.run import mesher
Expand Down Expand Up @@ -83,6 +101,9 @@ def run_mesher_file(file_geometry, file_voxel, **kwargs):
None if the termination is successful.
"""

# display logo
_display_logo()

# run the tool
try:
# load data
Expand Down Expand Up @@ -133,6 +154,9 @@ def run_viewer_data(data_voxel, data_point, data_viewer, **kwargs):
None if the termination is successful.
"""

# display logo
_display_logo()

# load the tool
LOGGER.info("load the viewer")
from pypeec.run import viewer
Expand Down Expand Up @@ -176,6 +200,9 @@ def run_viewer_file(file_voxel, file_point, file_viewer, **kwargs):
None if the termination is successful.
"""

# display logo
_display_logo()

# run the tool
try:
# load data
Expand Down Expand Up @@ -217,6 +244,9 @@ def run_solver_data(data_voxel, data_problem, data_tolerance, **kwargs):
data_solution: dict (output data)
"""

# display logo
_display_logo()

# load the tool
LOGGER.info("load the solver")
from pypeec.run import solver
Expand Down Expand Up @@ -254,6 +284,9 @@ def run_solver_file(file_voxel, file_problem, file_tolerance, file_solution, **k
None if the termination is successful.
"""

# display logo
_display_logo()

# run the tool
try:
# load data
Expand Down Expand Up @@ -309,6 +342,9 @@ def run_plotter_data(data_solution, data_point, data_plotter, **kwargs):
None if the termination is successful.
"""

# display logo
_display_logo()

# load the tool
LOGGER.info("load the plotter")
from pypeec.run import plotter
Expand Down Expand Up @@ -355,6 +391,9 @@ def run_plotter_file(file_solution, file_point, file_plotter, **kwargs):
None if the termination is successful.
"""

# display logo
_display_logo()

# run the tool
try:
# load data
Expand Down

0 comments on commit 9894b8e

Please sign in to comment.