MCPcopy
hub / github.com/Textualize/rich / refresh

Method refresh

rich/live.py:244–276  ·  view source on GitHub ↗

Update the display of the Live Render.

(self)

Source from the content-addressed store, hash-verified

242 self.refresh()
243
244 def refresh(self) -> None:
245 """Update the display of the Live Render."""
246 with self._lock:
247 self._live_render.set_renderable(self.renderable)
248 if self._nested:
249 if self.console._live_stack:
250 self.console._live_stack[0].refresh()
251 return
252
253 if self.console.is_jupyter: # pragma: no cover
254 try:
255 from IPython.display import display
256 from ipywidgets import Output
257 except ImportError:
258 import warnings
259
260 warnings.warn('install "ipywidgets" for Jupyter support')
261 else:
262 if self.ipy_widget is None:
263 self.ipy_widget = Output()
264 display(self.ipy_widget)
265
266 with self.ipy_widget:
267 self.ipy_widget.clear_output(wait=True)
268 self.console.print(self._live_render.renderable)
269 elif self.console.is_terminal and not self.console.is_dumb_terminal:
270 with self.console:
271 self.console.print(Control())
272 elif (
273 not self._started and not self.transient
274 ): # if it is finished allow files or dumb-terminals to see final result
275 with self.console:
276 self.console.print(Control())
277
278 def process_renderables(
279 self, renderables: List[ConsoleRenderable]

Callers 5

startMethod · 0.95
stopMethod · 0.95
updateMethod · 0.95
test_live_screenFunction · 0.45
runMethod · 0.45

Calls 4

displayFunction · 0.85
ControlClass · 0.85
set_renderableMethod · 0.80
printMethod · 0.80

Tested by 1

test_live_screenFunction · 0.36