Skip to content

Commit

Permalink
halonotebook no longer overwrite spinner on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Brennen Raimer authored and norweeg committed Nov 24, 2020
1 parent 89c7934 commit 36a4d0d
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions halo/halo_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import halo.cursor as cursor

from halo import Halo
from halo._utils import colored_frame, decode_utf_8_text

from halo._utils import colored_frame, decode_utf_8_text, is_text_type
from spinners.spinners import Spinners

class HaloNotebook(Halo):
def __init__(
Expand Down Expand Up @@ -120,3 +120,25 @@ def stop_and_persist(self, symbol=" ", text=None):

with self.output:
self.output.outputs = self._output(output)

def _get_spinner(self, spinner):
"""Extracts spinner value from options and returns value
containing spinner frames and interval, defaults to 'dots' spinner.
Parameters
----------
spinner : dict, str
Contains spinner value or type of spinner to be used
Returns
-------
dict
Contains frames and interval defining spinner
"""
default_spinner = Spinners['dots'].value

if spinner and type(spinner) == dict:
return spinner

if all([is_text_type(spinner), spinner in Spinners.__members__]):
return Spinners[spinner].value
else:
return default_spinner

0 comments on commit 36a4d0d

Please sign in to comment.