From 5533c1a17274335b67b42cabf063ae1370ac70c8 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 | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/halo/halo_notebook.py b/halo/halo_notebook.py index c2e30a4..059662d 100644 --- a/halo/halo_notebook.py +++ b/halo/halo_notebook.py @@ -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): @@ -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