From f41ad976ea081d132e49c7ea946eb87b975de16e Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 24 Feb 2018 18:37:19 -0800 Subject: Rename in_progress_download to in_progress_downloads (plural) everywhere, to be consistent with completed_downloads --- onionshare_gui/onionshare_gui.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 4f664225..56a1967b 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() @@ -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(' {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(' {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') -- cgit v1.2.3-54-g00ecf From 3797e9e2039bbc0109222cd94e32557938ca8dad Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 24 Feb 2018 18:38:40 -0800 Subject: When using , put the src in quotes. Otherwise the filename is likely to have spaces in it, and the src will break. Also, in Windows use backslashes for local resources instead of forward slashes --- onionshare/common.py | 6 +++++- onionshare_gui/onionshare_gui.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/onionshare/common.py b/onionshare/common.py index 79d62ca9..9703e0f5 100644 --- a/onionshare/common.py +++ b/onionshare/common.py @@ -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') diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 56a1967b..5c05ae18 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -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(' {1:d}'.format(self.info_completed_downloads_image, count)) + self.info_completed_downloads_count.setText(' {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(' {1:d}'.format(self.info_in_progress_downloads_image, count)) + self.info_in_progress_downloads_count.setText(' {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): -- cgit v1.2.3-54-g00ecf From 471ccef9d3f3c60f3e590385dce3f6bf7921ca98 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 24 Feb 2018 19:17:18 -0800 Subject: Remove test_frozen_windows test because it is verify difficult to test for on a non-Windows platform --- test/test_onionshare_common.py | 6 ------ 1 file changed, 6 deletions(-) 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') ? -- cgit v1.2.3-54-g00ecf From 6ded178343d2ff7f8614c660dd82cc9be73f667a Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 24 Feb 2018 19:17:29 -0800 Subject: Add pytest cache to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3-54-g00ecf From 43930058fbf76e613e7e8ffb62a383a4b9fef393 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 24 Feb 2018 19:39:03 -0800 Subject: Put src in quotes --- share/locale/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": "Anyone with this link can download your files using Tor Browser: ", + "gui_url_description": "Anyone with this link can download your files using Tor Browser: ", "gui_url_label_persistent": "This share will not stop automatically unless a timer is set.

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", -- cgit v1.2.3-54-g00ecf