Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Oct 25, 2024
1 parent 3862bef commit be2aaa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions nicegui/elements/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Union

from .. import optional_features
from ..logging import log
from .mixins.source_element import SourceElement

try:
Expand Down Expand Up @@ -37,6 +38,9 @@ def _set_props(self, source: Union[str, Path, 'PIL_Image']) -> None:

def force_reload(self) -> None:
"""Force the image to reload from the source."""
if self._props['src'].startswith('data:'):
log.warning('ui.image: force_reload() only works with network sources (not base64)')
return
self._props['t'] = time.time()
self.update()

Expand Down
4 changes: 2 additions & 2 deletions nicegui/elements/interactive_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def _set_props(self, source: Union[str, Path, 'PIL_Image']) -> None: # noqa: UP

def force_reload(self) -> None:
"""Force the image to reload from the source."""
if self.source.startswith('data:'):
log.warning('interactive_image: force_reload() only works with network sources (not base64)')
if self._props['src'].startswith('data:'):
log.warning('ui.interactive_image: force_reload() only works with network sources (not base64)')
return
self._props['t'] = time.time()
self.update()

0 comments on commit be2aaa2

Please sign in to comment.