From 36a4d0da991eccd2142c5cd573319ad015478d1c Mon Sep 17 00:00:00 2001 From: Brennen Raimer <> Date: Sat, 7 Mar 2020 12:40:22 -0500 Subject: [PATCH] halonotebook no longer overwrite spinner on Windows resolves #141 --- halo/halo_notebook.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/halo/halo_notebook.py b/halo/halo_notebook.py index 753fd7a..6990d07 100644 --- a/halo/halo_notebook.py +++ b/halo/halo_notebook.py @@ -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__( @@ -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