Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 5, 2024
1 parent 3e73265 commit ce1f736
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/ansys/mechanical/core/embedding/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,33 @@
import typing

import ansys.mechanical.core as mech
import ansys.mechanical.core.embedding.utils as utils
from ansys.mechanical.core.embedding.poster import Poster
import ansys.mechanical.core.embedding.utils as utils


def _exit(background_app: "BackgroundApp"):
"""Stop the thread serving the Background App."""
background_app.stop()
atexit.unregister(_exit)


class BackgroundApp:
"""Background App."""

__app: mech.App = None
__app_thread: threading.Thread = None
__stopped: bool = False
__stop_signaled: bool = False
__poster: Poster = None
def __init__(
self,
**kwargs
):

def __init__(self, **kwargs):
if BackgroundApp.__app_thread == None:
assert not BackgroundApp.__stopped, "Cannot initialize a BackgroundApp once it has been stopped!"
BackgroundApp.__app_thread = threading.Thread(target=self._start_app, kwargs=kwargs, daemon=True)
assert (
not BackgroundApp.__stopped
), "Cannot initialize a BackgroundApp once it has been stopped!"
BackgroundApp.__app_thread = threading.Thread(
target=self._start_app, kwargs=kwargs, daemon=True
)
BackgroundApp.__app_thread.start()

while BackgroundApp.__poster is None:
Expand Down

0 comments on commit ce1f736

Please sign in to comment.