Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to force use of a custom spinner in Windows #181

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions halo/halo.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(
interval=-1,
enabled=True,
stream=sys.stdout,
force=False
):
"""Constructs the Halo object.
Parameters
Expand All @@ -76,7 +77,10 @@ def __init__(
Spinner enabled or not.
stream : io, optional
Output.
force : bool, optional
Should force the use of the custom spinner if the platform is not supported
"""
self.force = force
self._color = color
self._animation = animation

Expand All @@ -88,7 +92,6 @@ def __init__(
int(interval) if int(interval) > 0 else self._spinner["interval"]
)
self._stream = stream

self.placement = placement
self._frame_index = 0
self._text_index = 0
Expand Down Expand Up @@ -333,7 +336,7 @@ def _get_spinner(self, spinner):
if spinner and type(spinner) == dict:
return spinner

if is_supported():
if is_supported() or self.force:
if all([is_text_type(spinner), spinner in Spinners.__members__]):
return Spinners[spinner].value
else:
Expand Down