@@ -40,26 +40,23 @@ def _make_output_widget(self):
40
40
41
41
return Output ()
42
42
43
- # TODO: using property and setter
44
- def _output (self , text = "" ):
45
- return ({"name" : "stdout" , "output_type" : "stream" , "text" : text },)
46
-
47
43
def clear (self ):
48
44
if not self .enabled :
49
45
return self
50
46
51
47
with self .output :
52
- self . output . outputs += self . _output ( " \r " )
53
- self . output . outputs += self . _output (self .CLEAR_LINE )
48
+ print ( ' \r ' , end = " " )
49
+ print (self .CLEAR_LINE , end = "" )
54
50
55
- self .output .outputs = self ._output ()
56
51
return self
57
52
58
53
def _render_frame (self ):
54
+ self .output .clear_output (wait = True )
59
55
frame = self .frame ()
60
- output = "\r {}" .format (frame )
56
+ output = '\r {}' .format (frame )
57
+
61
58
with self .output :
62
- self . output . outputs += self . _output ( output )
59
+ print ( output , end = "" )
63
60
64
61
def start (self , text = None ):
65
62
if text is not None :
@@ -114,31 +111,13 @@ def stop_and_persist(self, symbol=" ", text=None):
114
111
115
112
self .stop ()
116
113
117
- output = "\r {} {}\n " .format (
118
- * [(text , symbol ) if self ._placement == "right" else (symbol , text )][0 ]
119
- )
114
+ output = '\r {} {}\n ' .format (* [
115
+ (text , symbol )
116
+ if self ._placement == 'right' else
117
+ (symbol , text )
118
+ ][0 ])
119
+
120
+ self .output .clear_output (wait = True )
120
121
121
122
with self .output :
122
- self .output .outputs = self ._output (output )
123
-
124
- def _get_spinner (self , spinner ):
125
- """Extracts spinner value from options and returns value
126
- containing spinner frames and interval, defaults to 'dots' spinner.
127
- Parameters
128
- ----------
129
- spinner : dict, str
130
- Contains spinner value or type of spinner to be used
131
- Returns
132
- -------
133
- dict
134
- Contains frames and interval defining spinner
135
- """
136
- default_spinner = Spinners ['dots' ].value
137
-
138
- if spinner and type (spinner ) == dict :
139
- return spinner
140
-
141
- if all ([is_text_type (spinner ), spinner in Spinners .__members__ ]):
142
- return Spinners [spinner ].value
143
- else :
144
- return default_spinner
123
+ print (output , end = "" )
0 commit comments