Skip to content

Commit

Permalink
Warn when image cannot be reloaded, document limitation with manipula…
Browse files Browse the repository at this point in the history
…ted images
  • Loading branch information
Beuc committed Dec 14, 2019
1 parent b570cf8 commit 28bab6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions renpy/display/im.py
Expand Up @@ -354,6 +354,8 @@ def kill(self, ce):
# This reloads a cache entry from disk.
def reload(self, image_ref, **kwargs):
ce = self.cache.get(image_ref)
if ce is None:
raise KeyError(image_ref)
self.kill(ce)
self.get(ce.what, **kwargs)

Expand Down
9 changes: 8 additions & 1 deletion renpy/webloader.py
Expand Up @@ -196,7 +196,14 @@ def process_downloaded_resources():
(rr.xhr.statusText or "network error"), rr.relpath, fullpath))

#print("reloading", rr.relpath)
renpy.display.im.cache.reload(rr.obj, render=True)
try:
renpy.display.im.cache.reload(rr.obj, render=True)
except KeyError, e:
print(("Warning: cannot reload {} which is not loaded in the cache"
+ " (maybe image is part of a Transform,"
+ " or cache was cleared)")
.format(rr.obj.identity))


unlink[fullpath] = unlink.get(fullpath, 0) + 1
reloaded = True
Expand Down

0 comments on commit 28bab6a

Please sign in to comment.