mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-12-05 06:10:02 -05:00
Enforce webp for remote images
This commit is contained in:
parent
3028301fb1
commit
7bd3a3a888
3 changed files with 19 additions and 11 deletions
|
|
@ -86,12 +86,12 @@ class ImageWidget(urwid.Widget):
|
|||
super().__init__()
|
||||
if self.path: self.load()
|
||||
|
||||
def load(self, path=None):
|
||||
def load(self, path=None, remote_source=False):
|
||||
if path: self.path = path
|
||||
if self.path:
|
||||
from ._imagedata import ImageData
|
||||
self._ti_path = os.path.abspath(os.fspath(self.path))
|
||||
self._ti_data = ImageData(self._ti_path)
|
||||
self._ti_data = ImageData(self._ti_path, remote_source=remote_source)
|
||||
|
||||
if self._ti_data.ok:
|
||||
# Register with the image store (de-duplicates identical data
|
||||
|
|
@ -99,6 +99,9 @@ class ImageWidget(urwid.Widget):
|
|||
self._ti_key = self._ti_data.key
|
||||
image_store.register(self._ti_key, self._ti_data.data)
|
||||
self._invalidate()
|
||||
else:
|
||||
error_msg = self._ti_data.error or "Unknown error"
|
||||
self.notice(f"Error: {error_msg}")
|
||||
|
||||
def notice(self, msg=""):
|
||||
if not msg: self._notice = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue