MCPcopy
hub / github.com/Textualize/textual / refresh_css

Method refresh_css

src/textual/app.py:3797–3819  ·  view source on GitHub ↗

Refresh CSS. Args: animate: Also execute CSS animations.

(self, animate: bool = True)

Source from the content-addressed store, hash-verified

3795 return self
3796
3797 def refresh_css(self, animate: bool = True) -> None:
3798 """Refresh CSS.
3799
3800 Args:
3801 animate: Also execute CSS animations.
3802 """
3803 stylesheet = self.app.stylesheet
3804 stylesheet.set_variables(self.get_css_variables())
3805 stylesheet.reparse()
3806 stylesheet.update(self.app, animate=animate)
3807 try:
3808 if self.screen.is_mounted:
3809 self.screen._refresh_layout(self.size)
3810 self.screen._css_update_count = self._css_update_count
3811 except ScreenError:
3812 pass
3813 # The other screens in the stack will need to know about some style
3814 # changes, as a final pass let's check in on every screen that isn't
3815 # the current one and update them too.
3816 for screen in self.screen_stack:
3817 if screen != self.screen:
3818 stylesheet.update(screen, animate=animate)
3819 screen._css_update_count = self._css_update_count
3820
3821 def _display(self, screen: Screen, renderable: RenderableType | None) -> None:
3822 """Display a renderable within a sync.

Callers 2

_init_modeMethod · 0.95
switch_modeMethod · 0.95

Calls 5

get_css_variablesMethod · 0.95
set_variablesMethod · 0.80
reparseMethod · 0.80
_refresh_layoutMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected