When using <img>, put the src in quotes. Otherwise the filename is likely to have spaces in it, and the <img> src will break. Also, in Windows use backslashes for local resources instead of forward slashes

This commit is contained in:
Micah Lee 2018-02-24 18:38:40 -08:00
parent f41ad976ea
commit 3797e9e203
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 7 additions and 3 deletions

View File

@ -57,7 +57,7 @@ def get_platform():
"""
Returns the platform OnionShare is running on.
"""
plat = platform.system()
plat = platform.system()
if re.match('^.*BSD$', plat):
plat = 'BSD'
return plat
@ -69,6 +69,10 @@ def get_resource_path(filename):
"""
p = get_platform()
# On Windows, and in Windows dev mode, switch slashes in incoming filename to backslackes
if p == 'Windows':
filename = filename.replace('/', '\\')
if getattr(sys, 'onionshare_dev_mode', False):
# Look for resources directory relative to python file
prefix = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))), 'share')

View File

@ -684,7 +684,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_completed_downloads_image = common.get_resource_path('images/download_completed_none.png')
else:
self.info_completed_downloads_image = common.get_resource_path('images/download_completed.png')
self.info_completed_downloads_count.setText('<img src={0:s} /> {1:d}'.format(self.info_completed_downloads_image, count))
self.info_completed_downloads_count.setText('<img src="{0:s}" /> {1:d}'.format(self.info_completed_downloads_image, count))
self.info_completed_downloads_count.setToolTip(strings._('info_completed_downloads_tooltip', True).format(count))
def update_downloads_in_progress(self, count):
@ -695,7 +695,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_in_progress_downloads_image = common.get_resource_path('images/download_in_progress_none.png')
else:
self.info_in_progress_downloads_image = common.get_resource_path('images/download_in_progress.png')
self.info_in_progress_downloads_count.setText('<img src={0:s} /> {1:d}'.format(self.info_in_progress_downloads_image, count))
self.info_in_progress_downloads_count.setText('<img src="{0:s}" /> {1:d}'.format(self.info_in_progress_downloads_image, count))
self.info_in_progress_downloads_count.setToolTip(strings._('info_in_progress_downloads_tooltip', True).format(count))
def closeEvent(self, e):