Skip to content

Commit

Permalink
Merge branch 'halonotebook-fix-spinners' into halonotebook-fix-persist
Browse files Browse the repository at this point in the history
  • Loading branch information
Brennen Raimer committed Mar 7, 2020
2 parents 95e6828 + 5533c1a commit 294247f
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion halo/halo_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import threading

import cursor
from spinners.spinners import Spinners

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)


class HaloNotebook(Halo):
Expand Down Expand Up @@ -107,3 +108,25 @@ def stop_and_persist(self, symbol=' ', text=None):

with self.output:
print(output, end="")

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 294247f

Please sign in to comment.