summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2018-02-25 14:58:39 +1100
committerGitHub <noreply@github.com>2018-02-25 14:58:39 +1100
commit0dfbb38acf4ff9f2fcd21a19f532128e5ff21ffd (patch)
treef1d9bf9a152544b6bffbfb13e476a7a724ff18da
parentc0ba9ab27857f4aa92e90f2694d5fa27d67e4acb (diff)
parent79b461d07110b050e011c7997e3060105cede444 (diff)
downloadonionshare-0dfbb38acf4ff9f2fcd21a19f532128e5ff21ffd.tar.gz
onionshare-0dfbb38acf4ff9f2fcd21a19f532128e5ff21ffd.zip
Merge pull request #644 from micahflee/641_fix_images_windows
Fix the broken images in Windows
-rw-r--r--.gitignore1
-rw-r--r--onionshare/common.py6
-rw-r--r--onionshare_gui/onionshare_gui.py16
-rw-r--r--share/locale/en.json2
-rw-r--r--test/test_onionshare_common.py6
5 files changed, 15 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index 712484d6..b202993b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,7 @@ pip-log.txt
.tox
nosetests.xml
.cache
+.pytest_cache
# Translations
*.mo
diff --git a/onionshare/common.py b/onionshare/common.py
index d90f3b78..0d00c7b1 100644
--- a/onionshare/common.py
+++ b/onionshare/common.py
@@ -56,7 +56,7 @@ def get_platform():
"""
Returns the platform OnionShare is running on.
"""
- plat = platform.system()
+ plat = platform.system()
if plat.endswith('BSD'):
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')
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 4f664225..5c05ae18 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -116,8 +116,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_label = QtWidgets.QLabel()
self.info_label.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
- self.info_in_progress_download_count = QtWidgets.QLabel()
- self.info_in_progress_download_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
+ self.info_in_progress_downloads_count = QtWidgets.QLabel()
+ self.info_in_progress_downloads_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
self.info_completed_downloads_count = QtWidgets.QLabel()
self.info_completed_downloads_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
@@ -127,7 +127,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.info_layout.addWidget(self.info_label)
self.info_layout.addStretch()
- self.info_layout.addWidget(self.info_in_progress_download_count)
+ self.info_layout.addWidget(self.info_in_progress_downloads_count)
self.info_layout.addWidget(self.info_completed_downloads_count)
self.info_widget = QtWidgets.QWidget()
@@ -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):
@@ -692,11 +692,11 @@ class OnionShareGui(QtWidgets.QMainWindow):
Update the 'Downloads in progress' info widget.
"""
if count == 0:
- self.info_in_progress_download_image = common.get_resource_path('images/download_in_progress_none.png')
+ self.info_in_progress_downloads_image = common.get_resource_path('images/download_in_progress_none.png')
else:
- self.info_in_progress_download_image = common.get_resource_path('images/download_in_progress.png')
- self.info_in_progress_download_count.setText('<img src={0:s} /> {1:d}'.format(self.info_in_progress_download_image, count))
- self.info_in_progress_download_count.setToolTip(strings._('info_in_progress_downloads_tooltip', True).format(count))
+ 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.setToolTip(strings._('info_in_progress_downloads_tooltip', True).format(count))
def closeEvent(self, e):
common.log('OnionShareGui', 'closeEvent')
diff --git a/share/locale/en.json b/share/locale/en.json
index 3c426c67..e3375b25 100644
--- a/share/locale/en.json
+++ b/share/locale/en.json
@@ -141,7 +141,7 @@
"gui_server_timeout_expired": "The chosen timeout has already expired.\nPlease update the timeout and then you may start sharing.",
"share_via_onionshare": "Share via OnionShare",
"gui_save_private_key_checkbox": "Use a persistent address\n(unchecking will delete any saved address)",
- "gui_url_description": "<b>Anyone</b> with this link can <b>download</b> your files using <b>Tor Browser</b>: <img src={} />",
+ "gui_url_description": "<b>Anyone</b> with this link can <b>download</b> your files using <b>Tor Browser</b>: <img src='{}' />",
"gui_url_label_persistent": "This share will not stop automatically unless a timer is set.<br><br>Every share will have the same address (to use one-time addresses, disable persistence in the Settings)",
"gui_url_label_stay_open": "This share will not stop automatically unless a timer is set.",
"gui_url_label_onetime": "This share will stop after the first download",
diff --git a/test/test_onionshare_common.py b/test/test_onionshare_common.py
index f574ad7f..cb864313 100644
--- a/test/test_onionshare_common.py
+++ b/test/test_onionshare_common.py
@@ -193,12 +193,6 @@ class TestGetResourcePath:
common.get_resource_path(os.path.join(prefix, 'test_filename')) ==
os.path.join(prefix, 'test_filename'))
- def test_frozen_windows(self, platform_windows, sys_frozen):
- prefix = os.path.join(os.path.dirname(sys.executable), 'share')
- assert (
- common.get_resource_path(os.path.join(prefix, 'test_filename')) ==
- os.path.join(prefix, 'test_filename'))
-
class TestGetTorPaths:
# @pytest.mark.skipif(sys.platform != 'Darwin', reason='requires MacOS') ?