Browse Source

Fix slide update on download

- Also fix ssl error for image download

Fixes #1
dev
octogene 4 years ago
parent
commit
1bef32438c
  1. 8
      hadaly/app.py

8
hadaly/app.py

@ -385,6 +385,7 @@ class HadalyApp(App):
os.path.basename(urlparse(url).path))
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 5.1; rv:31.0) "
"Gecko/20100101 Firefox/31.0"}
url = url.replace("https", "http")
req = UrlRequest(url, self.reload_slide,
file_path=path,
on_progress=self.show_download_progress,
@ -409,9 +410,11 @@ class HadalyApp(App):
if img_src[0] == 'http' and img_src[2].endswith(filename):
Logger.debug('Application: Found slide ! '
'Updating image source...')
slide.img.img_src = os.path.join(self.tempdir, filename)
# Update presentation info
idx = self.presentation['slides'].index(slide.img.get_slide_info())
slide.img.img_src = self.presentation['slides'][idx]['img_src'] = os.path.join(self.tempdir, filename)
Logger.debug('Application: {src}'.format(src=slide.img.img_src))
slide.img.thumb_src = self.create_thumbnail(slide.img.img_src)
slide.img.thumb_src = self.presentation['slides'][idx]['thumb_src'] =self.create_thumbnail(slide.img.img_src)
slide.img.update_texture_size()
self.root.current = 'editor'
@ -507,6 +510,7 @@ class HadalyApp(App):
)
for photo in results:
photo['thumb'] = photo['thumb'].replace("https", "http")
Logger.debug('Search : Loading {url}'.format(url=photo['thumb']))
image = ItemButton(photo=photo,
source=photo['thumb'], keep_ratio=True)

Loading…
Cancel
Save