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 committed Mar 7, 2020
1 parent e773f3b commit 5533c1a
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 @@ -108,3 +109,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 5533c1a

Please sign in to comment.