From 3ae1e04c0a4498cd55d0fcbbd809686037beac33 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 19 Jan 2019 18:30:13 -0800 Subject: [PATCH 1/9] Updated language on key share/receive mode strings to remove the confusing upload and download words --- onionshare_gui/mode/history.py | 32 ++++++++++---------- onionshare_gui/mode/receive_mode/__init__.py | 8 ++--- onionshare_gui/mode/share_mode/__init__.py | 8 ++--- share/locale/en.json | 22 ++++++++------ 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/onionshare_gui/mode/history.py b/onionshare_gui/mode/history.py index e72a3838..3f689bea 100644 --- a/onionshare_gui/mode/history.py +++ b/onionshare_gui/mode/history.py @@ -41,12 +41,12 @@ class HistoryItem(QtWidgets.QWidget): pass -class DownloadHistoryItem(HistoryItem): +class ShareHistoryItem(HistoryItem): """ Download history item, for share mode """ def __init__(self, common, id, total_bytes): - super(DownloadHistoryItem, self).__init__() + super(ShareHistoryItem, self).__init__() self.common = common self.id = id @@ -56,7 +56,7 @@ class DownloadHistoryItem(HistoryItem): self.started_dt = datetime.fromtimestamp(self.started) # Label - self.label = QtWidgets.QLabel(strings._('gui_download_in_progress').format(self.started_dt.strftime("%b %d, %I:%M%p"))) + self.label = QtWidgets.QLabel(strings._('gui_share_mode_transfer_started').format(self.started_dt.strftime("%b %d, %I:%M%p"))) # Progress bar self.progress_bar = QtWidgets.QProgressBar() @@ -110,12 +110,12 @@ class DownloadHistoryItem(HistoryItem): self.started) -class UploadHistoryItemFile(QtWidgets.QWidget): +class ReceiveHistoryItemFile(QtWidgets.QWidget): def __init__(self, common, filename): - super(UploadHistoryItemFile, self).__init__() + super(ReceiveHistoryItemFile, self).__init__() self.common = common - self.common.log('UploadHistoryItemFile', '__init__', 'filename: {}'.format(filename)) + self.common.log('ReceiveHistoryItemFile', '__init__', 'filename: {}'.format(filename)) self.filename = filename self.dir = None @@ -166,10 +166,10 @@ class UploadHistoryItemFile(QtWidgets.QWidget): """ Open the downloads folder, with the file selected, in a cross-platform manner """ - self.common.log('UploadHistoryItemFile', 'open_folder') + self.common.log('ReceiveHistoryItemFile', 'open_folder') if not self.dir: - self.common.log('UploadHistoryItemFile', 'open_folder', "dir has not been set yet, can't open folder") + self.common.log('ReceiveHistoryItemFile', 'open_folder', "dir has not been set yet, can't open folder") return abs_filename = os.path.join(self.dir, self.filename) @@ -184,15 +184,15 @@ class UploadHistoryItemFile(QtWidgets.QWidget): # macOS elif self.common.platform == 'Darwin': - subprocess.call(['open', '-R', abs_filename]) + subprocess.call(['open', '-R', abs_filename]) # Windows elif self.common.platform == 'Windows': subprocess.Popen(['explorer', '/select,{}'.format(abs_filename)]) -class UploadHistoryItem(HistoryItem): +class ReceiveHistoryItem(HistoryItem): def __init__(self, common, id, content_length): - super(UploadHistoryItem, self).__init__() + super(ReceiveHistoryItem, self).__init__() self.common = common self.id = id self.content_length = content_length @@ -259,7 +259,7 @@ class UploadHistoryItem(HistoryItem): for filename in list(data['progress']): # Add a new file if needed if filename not in self.files: - self.files[filename] = UploadHistoryItemFile(self.common, filename) + self.files[filename] = ReceiveHistoryItemFile(self.common, filename) self.files_layout.addWidget(self.files[filename]) # Update the file @@ -280,16 +280,16 @@ class UploadHistoryItem(HistoryItem): self.ended = self.started = datetime.now() if self.started.year == self.ended.year and self.started.month == self.ended.month and self.started.day == self.ended.day: if self.started.hour == self.ended.hour and self.started.minute == self.ended.minute: - text = strings._('gui_upload_finished').format( + text = strings._('gui_receive_mode_transfer_finished').format( self.started.strftime("%b %d, %I:%M%p") ) else: - text = strings._('gui_upload_finished_range').format( + text = strings._('gui_receive_mode_transfer_finished_range').format( self.started.strftime("%b %d, %I:%M%p"), self.ended.strftime("%I:%M%p") ) else: - text = strings._('gui_upload_finished_range').format( + text = strings._('gui_receive_mode_transfer_finished_range').format( self.started.strftime("%b %d, %I:%M%p"), self.ended.strftime("%b %d, %I:%M%p") ) @@ -386,7 +386,7 @@ class History(QtWidgets.QWidget): # Header self.header_label = QtWidgets.QLabel(header_text) self.header_label.setStyleSheet(self.common.css['downloads_uploads_label']) - clear_button = QtWidgets.QPushButton(strings._('gui_clear_history')) + clear_button = QtWidgets.QPushButton(strings._('gui_all_modes_clear_history')) clear_button.setStyleSheet(self.common.css['downloads_uploads_clear']) clear_button.setFlat(True) clear_button.clicked.connect(self.reset) diff --git a/onionshare_gui/mode/receive_mode/__init__.py b/onionshare_gui/mode/receive_mode/__init__.py index c53f1ea1..0cf33557 100644 --- a/onionshare_gui/mode/receive_mode/__init__.py +++ b/onionshare_gui/mode/receive_mode/__init__.py @@ -22,7 +22,7 @@ from PyQt5 import QtCore, QtWidgets, QtGui from onionshare import strings from onionshare.web import Web -from ..history import History, ToggleHistory, UploadHistoryItem +from ..history import History, ToggleHistory, ReceiveHistoryItem from .. import Mode class ReceiveMode(Mode): @@ -50,8 +50,8 @@ class ReceiveMode(Mode): self.history = History( self.common, QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/uploads_transparent.png'))), - strings._('gui_no_uploads'), - strings._('gui_uploads') + strings._('gui_receive_mode_no_files'), + strings._('gui_all_modes_history') ) self.history.hide() @@ -142,7 +142,7 @@ class ReceiveMode(Mode): """ Handle REQUEST_STARTED event. """ - item = UploadHistoryItem(self.common, event["data"]["id"], event["data"]["content_length"]) + item = ReceiveHistoryItem(self.common, event["data"]["id"], event["data"]["content_length"]) self.history.add(event["data"]["id"], item) self.toggle_history.update_indicator(True) self.history.in_progress_count += 1 diff --git a/onionshare_gui/mode/share_mode/__init__.py b/onionshare_gui/mode/share_mode/__init__.py index 0cc00f92..266aaf06 100644 --- a/onionshare_gui/mode/share_mode/__init__.py +++ b/onionshare_gui/mode/share_mode/__init__.py @@ -28,7 +28,7 @@ from onionshare.web import Web from .file_selection import FileSelection from .threads import CompressThread from .. import Mode -from ..history import History, ToggleHistory, DownloadHistoryItem +from ..history import History, ToggleHistory, ShareHistoryItem from ...widgets import Alert @@ -75,8 +75,8 @@ class ShareMode(Mode): self.history = History( self.common, QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/downloads_transparent.png'))), - strings._('gui_no_downloads'), - strings._('gui_downloads') + strings._('gui_share_mode_no_files'), + strings._('gui_all_modes_history') ) self.history.hide() @@ -240,7 +240,7 @@ class ShareMode(Mode): else: filesize = self.web.share_mode.download_filesize - item = DownloadHistoryItem(self.common, event["data"]["id"], filesize) + item = ShareHistoryItem(self.common, event["data"]["id"], filesize) self.history.add(event["data"]["id"], item) self.toggle_history.update_indicator(True) self.history.in_progress_count += 1 diff --git a/share/locale/en.json b/share/locale/en.json index 44eff150..45339333 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -48,8 +48,6 @@ "gui_receive_stop_server_shutdown_timeout_tooltip": "Auto-stop timer ends at {}", "gui_copy_url": "Copy Address", "gui_copy_hidservauth": "Copy HidServAuth", - "gui_downloads": "Download History", - "gui_no_downloads": "No Downloads Yet", "gui_canceled": "Canceled", "gui_copied_url_title": "Copied OnionShare Address", "gui_copied_url": "OnionShare address copied to clipboard", @@ -175,14 +173,18 @@ "systray_page_loaded_title": "OnionShare Page Loaded", "systray_download_page_loaded_message": "A user loaded the download page", "systray_upload_page_loaded_message": "A user loaded the upload page", - "gui_uploads": "Upload History", - "gui_no_uploads": "No Uploads Yet", - "gui_clear_history": "Clear All", - "gui_upload_in_progress": "Upload Started {}", - "gui_upload_finished_range": "Uploaded {} to {}", - "gui_upload_finished": "Uploaded {}", - "gui_download_in_progress": "Download Started {}", "gui_open_folder_error_nautilus": "Cannot open folder because nautilus is not available. The file is here: {}", "gui_settings_language_label": "Preferred language", - "gui_settings_language_changed_notice": "Restart OnionShare for your change in language to take effect." + "gui_settings_language_changed_notice": "Restart OnionShare for your change in language to take effect.", + + "gui_all_modes_history": "History", + "gui_all_modes_clear_history": "Clear All", + + "gui_share_mode_no_files": "No Files Sent Yet", + "gui_share_mode_transfer_started": "Started {}", + + "gui_receive_mode_no_files": "No Files Received Yet", + "gui_receive_mode_transfer_started": "Started {}", + "gui_receive_mode_transfer_finished_range": "Started {}, finished {}", + "gui_receive_mode_transfer_finished": "Finished {}" } From 862a0dc067f38d700ec2339633a0701ac6b271d1 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 19 Jan 2019 19:00:41 -0800 Subject: [PATCH 2/9] Rename images to remove upload/download references, and update more strings --- onionshare_gui/mode/history.py | 60 +++++++++++------- onionshare_gui/mode/receive_mode/__init__.py | 6 +- onionshare_gui/mode/share_mode/__init__.py | 6 +- .../{downloads.png => receive_icon.png} | Bin ...ads_toggle.png => receive_icon_toggle.png} | Bin ...d.png => receive_icon_toggle_selected.png} | Bin ...arent.png => receive_icon_transparent.png} | Bin share/images/{uploads.png => share_icon.png} | Bin ...loads_toggle.png => share_icon_toggle.png} | Bin ...ted.png => share_icon_toggle_selected.png} | Bin ...sparent.png => share_icon_transparent.png} | Bin share/locale/en.json | 17 ++--- 12 files changed, 49 insertions(+), 40 deletions(-) rename share/images/{downloads.png => receive_icon.png} (100%) rename share/images/{downloads_toggle.png => receive_icon_toggle.png} (100%) rename share/images/{downloads_toggle_selected.png => receive_icon_toggle_selected.png} (100%) rename share/images/{downloads_transparent.png => receive_icon_transparent.png} (100%) rename share/images/{uploads.png => share_icon.png} (100%) rename share/images/{uploads_toggle.png => share_icon_toggle.png} (100%) rename share/images/{uploads_toggle_selected.png => share_icon_toggle_selected.png} (100%) rename share/images/{uploads_transparent.png => share_icon_transparent.png} (100%) diff --git a/onionshare_gui/mode/history.py b/onionshare_gui/mode/history.py index 3f689bea..44ee293f 100644 --- a/onionshare_gui/mode/history.py +++ b/onionshare_gui/mode/history.py @@ -40,6 +40,30 @@ class HistoryItem(QtWidgets.QWidget): def cancel(self): pass + def get_finished_label_text(self, started_ts): + """ + When an item finishes, returns a string displaying the start/end datetime range. + started is a datetime object. + """ + started = datetime.fromtimestamp(started_ts) + ended = datetime.now() + if started.year == ended.year and started.month == ended.month and started.day == ended.day: + if started.hour == ended.hour and started.minute == ended.minute: + text = strings._('gui_all_modes_transfer_finished').format( + started.strftime("%b %d, %I:%M%p") + ) + else: + text = strings._('gui_all_modes_transfer_finished_range').format( + started.strftime("%b %d, %I:%M%p"), + ended.strftime("%I:%M%p") + ) + else: + text = strings._('gui_all_modes_transfer_finished_range').format( + started.strftime("%b %d, %I:%M%p"), + ended.strftime("%b %d, %I:%M%p") + ) + return text + class ShareHistoryItem(HistoryItem): """ @@ -56,7 +80,7 @@ class ShareHistoryItem(HistoryItem): self.started_dt = datetime.fromtimestamp(self.started) # Label - self.label = QtWidgets.QLabel(strings._('gui_share_mode_transfer_started').format(self.started_dt.strftime("%b %d, %I:%M%p"))) + self.label = QtWidgets.QLabel(strings._('gui_all_modes_transfer_started').format(self.started_dt.strftime("%b %d, %I:%M%p"))) # Progress bar self.progress_bar = QtWidgets.QProgressBar() @@ -83,18 +107,22 @@ class ShareHistoryItem(HistoryItem): self.progress_bar.setValue(downloaded_bytes) if downloaded_bytes == self.progress_bar.total_bytes: - pb_fmt = strings._('gui_download_upload_progress_complete').format( + pb_fmt = strings._('gui_all_modes_progress_complete').format( self.common.format_seconds(time.time() - self.started)) + + # Change the label + self.label.setText(self.get_finished_label_text(self.started)) + else: elapsed = time.time() - self.started if elapsed < 10: # Wait a couple of seconds for the download rate to stabilize. # This prevents a "Windows copy dialog"-esque experience at # the beginning of the download. - pb_fmt = strings._('gui_download_upload_progress_starting').format( + pb_fmt = strings._('gui_all_modes_progress_starting').format( self.common.human_readable_filesize(downloaded_bytes)) else: - pb_fmt = strings._('gui_download_upload_progress_eta').format( + pb_fmt = strings._('gui_all_modes_progress_eta').format( self.common.human_readable_filesize(downloaded_bytes), self.estimated_time_remaining) @@ -199,7 +227,7 @@ class ReceiveHistoryItem(HistoryItem): self.started = datetime.now() # Label - self.label = QtWidgets.QLabel(strings._('gui_upload_in_progress').format(self.started.strftime("%b %d, %I:%M%p"))) + self.label = QtWidgets.QLabel(strings._('gui_all_modes_transfer_started').format(self.started.strftime("%b %d, %I:%M%p"))) # Progress bar self.progress_bar = QtWidgets.QProgressBar() @@ -244,14 +272,14 @@ class ReceiveHistoryItem(HistoryItem): elapsed = datetime.now() - self.started if elapsed.seconds < 10: - pb_fmt = strings._('gui_download_upload_progress_starting').format( + pb_fmt = strings._('gui_all_modes_progress_starting').format( self.common.human_readable_filesize(total_uploaded_bytes)) else: estimated_time_remaining = self.common.estimated_time_remaining( total_uploaded_bytes, self.content_length, self.started.timestamp()) - pb_fmt = strings._('gui_download_upload_progress_eta').format( + pb_fmt = strings._('gui_all_modes_progress_eta').format( self.common.human_readable_filesize(total_uploaded_bytes), estimated_time_remaining) @@ -277,23 +305,7 @@ class ReceiveHistoryItem(HistoryItem): self.progress_bar.hide() # Change the label - self.ended = self.started = datetime.now() - if self.started.year == self.ended.year and self.started.month == self.ended.month and self.started.day == self.ended.day: - if self.started.hour == self.ended.hour and self.started.minute == self.ended.minute: - text = strings._('gui_receive_mode_transfer_finished').format( - self.started.strftime("%b %d, %I:%M%p") - ) - else: - text = strings._('gui_receive_mode_transfer_finished_range').format( - self.started.strftime("%b %d, %I:%M%p"), - self.ended.strftime("%I:%M%p") - ) - else: - text = strings._('gui_receive_mode_transfer_finished_range').format( - self.started.strftime("%b %d, %I:%M%p"), - self.ended.strftime("%b %d, %I:%M%p") - ) - self.label.setText(text) + self.label.setText(self.get_finished_label_text(self.started)) class HistoryItemList(QtWidgets.QScrollArea): diff --git a/onionshare_gui/mode/receive_mode/__init__.py b/onionshare_gui/mode/receive_mode/__init__.py index 0cf33557..2ebf1feb 100644 --- a/onionshare_gui/mode/receive_mode/__init__.py +++ b/onionshare_gui/mode/receive_mode/__init__.py @@ -49,7 +49,7 @@ class ReceiveMode(Mode): # Upload history self.history = History( self.common, - QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/uploads_transparent.png'))), + QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/receive_icon_transparent.png'))), strings._('gui_receive_mode_no_files'), strings._('gui_all_modes_history') ) @@ -58,8 +58,8 @@ class ReceiveMode(Mode): # Toggle history self.toggle_history = ToggleHistory( self.common, self, self.history, - QtGui.QIcon(self.common.get_resource_path('images/uploads_toggle.png')), - QtGui.QIcon(self.common.get_resource_path('images/uploads_toggle_selected.png')) + QtGui.QIcon(self.common.get_resource_path('images/receive_icon_toggle.png')), + QtGui.QIcon(self.common.get_resource_path('images/receive_icon_toggle_selected.png')) ) # Receive mode warning diff --git a/onionshare_gui/mode/share_mode/__init__.py b/onionshare_gui/mode/share_mode/__init__.py index 266aaf06..f7150c1e 100644 --- a/onionshare_gui/mode/share_mode/__init__.py +++ b/onionshare_gui/mode/share_mode/__init__.py @@ -74,7 +74,7 @@ class ShareMode(Mode): # Download history self.history = History( self.common, - QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/downloads_transparent.png'))), + QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/share_icon_transparent.png'))), strings._('gui_share_mode_no_files'), strings._('gui_all_modes_history') ) @@ -87,8 +87,8 @@ class ShareMode(Mode): # Toggle history self.toggle_history = ToggleHistory( self.common, self, self.history, - QtGui.QIcon(self.common.get_resource_path('images/downloads_toggle.png')), - QtGui.QIcon(self.common.get_resource_path('images/downloads_toggle_selected.png')) + QtGui.QIcon(self.common.get_resource_path('images/share_icon_toggle.png')), + QtGui.QIcon(self.common.get_resource_path('images/share_icon_toggle_selected.png')) ) # Top bar diff --git a/share/images/downloads.png b/share/images/receive_icon.png similarity index 100% rename from share/images/downloads.png rename to share/images/receive_icon.png diff --git a/share/images/downloads_toggle.png b/share/images/receive_icon_toggle.png similarity index 100% rename from share/images/downloads_toggle.png rename to share/images/receive_icon_toggle.png diff --git a/share/images/downloads_toggle_selected.png b/share/images/receive_icon_toggle_selected.png similarity index 100% rename from share/images/downloads_toggle_selected.png rename to share/images/receive_icon_toggle_selected.png diff --git a/share/images/downloads_transparent.png b/share/images/receive_icon_transparent.png similarity index 100% rename from share/images/downloads_transparent.png rename to share/images/receive_icon_transparent.png diff --git a/share/images/uploads.png b/share/images/share_icon.png similarity index 100% rename from share/images/uploads.png rename to share/images/share_icon.png diff --git a/share/images/uploads_toggle.png b/share/images/share_icon_toggle.png similarity index 100% rename from share/images/uploads_toggle.png rename to share/images/share_icon_toggle.png diff --git a/share/images/uploads_toggle_selected.png b/share/images/share_icon_toggle_selected.png similarity index 100% rename from share/images/uploads_toggle_selected.png rename to share/images/share_icon_toggle_selected.png diff --git a/share/images/uploads_transparent.png b/share/images/share_icon_transparent.png similarity index 100% rename from share/images/uploads_transparent.png rename to share/images/share_icon_transparent.png diff --git a/share/locale/en.json b/share/locale/en.json index 45339333..ce3cf87a 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -54,9 +54,6 @@ "gui_copied_hidservauth_title": "Copied HidServAuth", "gui_copied_hidservauth": "HidServAuth line copied to clipboard", "gui_please_wait": "Starting… Click to cancel.", - "gui_download_upload_progress_complete": "%p%, {0:s} elapsed.", - "gui_download_upload_progress_starting": "{0:s}, %p% (calculating)", - "gui_download_upload_progress_eta": "{0:s}, ETA: {1:s}, %p%", "version_string": "OnionShare {0:s} | https://onionshare.org/", "gui_quit_title": "Not so fast", "gui_share_quit_warning": "You're in the process of sending files. Are you sure you want to quit OnionShare?", @@ -179,12 +176,12 @@ "gui_all_modes_history": "History", "gui_all_modes_clear_history": "Clear All", - + "gui_all_modes_transfer_started": "Started {}", + "gui_all_modes_transfer_finished_range": "Transferred {} - {}", + "gui_all_modes_transfer_finished": "Transferred {}", + "gui_all_modes_progress_complete": "%p%, {0:s} elapsed.", + "gui_all_modes_progress_starting": "{0:s}, %p% (calculating)", + "gui_all_modes_progress_eta": "{0:s}, ETA: {1:s}, %p%", "gui_share_mode_no_files": "No Files Sent Yet", - "gui_share_mode_transfer_started": "Started {}", - - "gui_receive_mode_no_files": "No Files Received Yet", - "gui_receive_mode_transfer_started": "Started {}", - "gui_receive_mode_transfer_finished_range": "Started {}, finished {}", - "gui_receive_mode_transfer_finished": "Finished {}" + "gui_receive_mode_no_files": "No Files Received Yet" } From a0c3a276ec4870b083bec829fcafab222ba51e68 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 19 Jan 2019 19:33:36 -0800 Subject: [PATCH 3/9] Fix bug in HistoryItem.get_finished_label_text --- onionshare_gui/mode/history.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/onionshare_gui/mode/history.py b/onionshare_gui/mode/history.py index 44ee293f..bb419ec7 100644 --- a/onionshare_gui/mode/history.py +++ b/onionshare_gui/mode/history.py @@ -40,12 +40,11 @@ class HistoryItem(QtWidgets.QWidget): def cancel(self): pass - def get_finished_label_text(self, started_ts): + def get_finished_label_text(self, started): """ When an item finishes, returns a string displaying the start/end datetime range. started is a datetime object. """ - started = datetime.fromtimestamp(started_ts) ended = datetime.now() if started.year == ended.year and started.month == ended.month and started.day == ended.day: if started.hour == ended.hour and started.minute == ended.minute: @@ -111,7 +110,7 @@ class ShareHistoryItem(HistoryItem): self.common.format_seconds(time.time() - self.started)) # Change the label - self.label.setText(self.get_finished_label_text(self.started)) + self.label.setText(self.get_finished_label_text(self.started_dt)) else: elapsed = time.time() - self.started From 3bbff7e85ab31e8fc593b74ec723b493f0c63936 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 19 Jan 2019 20:43:25 -0800 Subject: [PATCH 4/9] Finish removing web event REQUEST_CLOSE_SERVER, which used to be a receive mode feature to allow the Tor Browser user to close the server, but we removed --- onionshare/web/web.py | 9 ++++----- onionshare_gui/mode/__init__.py | 6 ------ onionshare_gui/mode/receive_mode/__init__.py | 9 +-------- onionshare_gui/mode/share_mode/__init__.py | 2 +- onionshare_gui/onionshare_gui.py | 3 --- 5 files changed, 6 insertions(+), 23 deletions(-) diff --git a/onionshare/web/web.py b/onionshare/web/web.py index 0f156941..df838df7 100644 --- a/onionshare/web/web.py +++ b/onionshare/web/web.py @@ -35,11 +35,10 @@ class Web(object): REQUEST_OTHER = 3 REQUEST_CANCELED = 4 REQUEST_RATE_LIMIT = 5 - REQUEST_CLOSE_SERVER = 6 - REQUEST_UPLOAD_FILE_RENAMED = 7 - REQUEST_UPLOAD_SET_DIR = 8 - REQUEST_UPLOAD_FINISHED = 9 - REQUEST_ERROR_DOWNLOADS_DIR_CANNOT_CREATE = 10 + REQUEST_UPLOAD_FILE_RENAMED = 6 + REQUEST_UPLOAD_SET_DIR = 7 + REQUEST_UPLOAD_FINISHED = 8 + REQUEST_ERROR_DOWNLOADS_DIR_CANNOT_CREATE = 9 def __init__(self, common, is_gui, mode='share'): self.common = common diff --git a/onionshare_gui/mode/__init__.py b/onionshare_gui/mode/__init__.py index 5110289f..edc1777d 100644 --- a/onionshare_gui/mode/__init__.py +++ b/onionshare_gui/mode/__init__.py @@ -312,12 +312,6 @@ class Mode(QtWidgets.QWidget): """ pass - def handle_request_close_server(self, event): - """ - Handle REQUEST_CLOSE_SERVER event. - """ - pass - def handle_request_upload_file_renamed(self, event): """ Handle REQUEST_UPLOAD_FILE_RENAMED event. diff --git a/onionshare_gui/mode/receive_mode/__init__.py b/onionshare_gui/mode/receive_mode/__init__.py index 2ebf1feb..62f96924 100644 --- a/onionshare_gui/mode/receive_mode/__init__.py +++ b/onionshare_gui/mode/receive_mode/__init__.py @@ -103,7 +103,7 @@ class ReceiveMode(Mode): return True # An upload is probably still running - hold off on stopping the share, but block new shares. else: - self.server_status_label.setText(strings._('timeout_upload_still_running')) + self.server_status_label.setText(strings._('gui_receive_mode_timeout_waiting')) self.web.receive_mode.can_upload = False return False @@ -159,13 +159,6 @@ class ReceiveMode(Mode): 'progress': event["data"]["progress"] }) - def handle_request_close_server(self, event): - """ - Handle REQUEST_CLOSE_SERVER event. - """ - self.stop_server() - self.system_tray.showMessage(strings._('systray_close_server_title'), strings._('systray_close_server_message')) - def handle_request_upload_file_renamed(self, event): """ Handle REQUEST_UPLOAD_FILE_RENAMED event. diff --git a/onionshare_gui/mode/share_mode/__init__.py b/onionshare_gui/mode/share_mode/__init__.py index f7150c1e..5dd2315e 100644 --- a/onionshare_gui/mode/share_mode/__init__.py +++ b/onionshare_gui/mode/share_mode/__init__.py @@ -138,7 +138,7 @@ class ShareMode(Mode): return True # A download is probably still running - hold off on stopping the share else: - self.server_status_label.setText(strings._('timeout_download_still_running')) + self.server_status_label.setText(strings._('gui_share_mode_timeout_waiting')) return False def start_server_custom(self): diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index eab3261e..3d5f5f0a 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -384,9 +384,6 @@ class OnionShareGui(QtWidgets.QMainWindow): elif event["type"] == Web.REQUEST_CANCELED: mode.handle_request_canceled(event) - elif event["type"] == Web.REQUEST_CLOSE_SERVER: - mode.handle_request_close_server(event) - elif event["type"] == Web.REQUEST_UPLOAD_FILE_RENAMED: mode.handle_request_upload_file_renamed(event) From b8f0d789545f8bd34b4bb963c2e4eb6d1d1b7aec Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 19 Jan 2019 20:56:09 -0800 Subject: [PATCH 5/9] Change many more strings to stop using 'download'/'upload' language --- onionshare_gui/mode/receive_mode/__init__.py | 4 +- onionshare_gui/mode/share_mode/__init__.py | 8 ++-- share/locale/en.json | 40 +++++++++----------- 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/onionshare_gui/mode/receive_mode/__init__.py b/onionshare_gui/mode/receive_mode/__init__.py index 62f96924..90a1f731 100644 --- a/onionshare_gui/mode/receive_mode/__init__.py +++ b/onionshare_gui/mode/receive_mode/__init__.py @@ -136,7 +136,7 @@ class ReceiveMode(Mode): """ Handle REQUEST_LOAD event. """ - self.system_tray.showMessage(strings._('systray_page_loaded_title'), strings._('systray_upload_page_loaded_message')) + self.system_tray.showMessage(strings._('systray_page_loaded_title'), strings._('systray_page_loaded_message')) def handle_request_started(self, event): """ @@ -148,7 +148,7 @@ class ReceiveMode(Mode): self.history.in_progress_count += 1 self.history.update_in_progress() - self.system_tray.showMessage(strings._('systray_upload_started_title'), strings._('systray_upload_started_message')) + self.system_tray.showMessage(strings._('systray_receive_started_title'), strings._('systray_receive_started_message')) def handle_request_progress(self, event): """ diff --git a/onionshare_gui/mode/share_mode/__init__.py b/onionshare_gui/mode/share_mode/__init__.py index 5dd2315e..d0806cfa 100644 --- a/onionshare_gui/mode/share_mode/__init__.py +++ b/onionshare_gui/mode/share_mode/__init__.py @@ -229,7 +229,7 @@ class ShareMode(Mode): """ Handle REQUEST_LOAD event. """ - self.system_tray.showMessage(strings._('systray_page_loaded_title'), strings._('systray_download_page_loaded_message')) + self.system_tray.showMessage(strings._('systray_page_loaded_title'), strings._('systray_page_loaded_message')) def handle_request_started(self, event): """ @@ -246,7 +246,7 @@ class ShareMode(Mode): self.history.in_progress_count += 1 self.history.update_in_progress() - self.system_tray.showMessage(strings._('systray_download_started_title'), strings._('systray_download_started_message')) + self.system_tray.showMessage(strings._('systray_share_started_title'), strings._('systray_share_started_message')) def handle_request_progress(self, event): """ @@ -256,7 +256,7 @@ class ShareMode(Mode): # Is the download complete? if event["data"]["bytes"] == self.web.share_mode.filesize: - self.system_tray.showMessage(strings._('systray_download_completed_title'), strings._('systray_download_completed_message')) + self.system_tray.showMessage(strings._('systray_share_completed_title'), strings._('systray_share_completed_message')) # Update completed and in progress labels self.history.completed_count += 1 @@ -284,7 +284,7 @@ class ShareMode(Mode): # Update in progress count self.history.in_progress_count -= 1 self.history.update_in_progress() - self.system_tray.showMessage(strings._('systray_download_canceled_title'), strings._('systray_download_canceled_message')) + self.system_tray.showMessage(strings._('systray_share_canceled_title'), strings._('systray_share_canceled_message')) def on_reload_settings(self): """ diff --git a/share/locale/en.json b/share/locale/en.json index ce3cf87a..8bcc738b 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -11,21 +11,10 @@ "no_available_port": "Could not find an available port to start the onion service", "other_page_loaded": "Address loaded", "close_on_timeout": "Stopped because auto-stop timer ran out", - "closing_automatically": "Stopped because download finished", - "timeout_download_still_running": "Waiting for download to complete", - "timeout_upload_still_running": "Waiting for upload to complete", + "closing_automatically": "Stopped because transfer is complete", "large_filesize": "Warning: Sending a large share could take hours", - "systray_menu_exit": "Quit", - "systray_download_started_title": "OnionShare Download Started", - "systray_download_started_message": "A user started downloading your files", - "systray_download_completed_title": "OnionShare Download Finished", - "systray_download_completed_message": "The user finished downloading your files", - "systray_download_canceled_title": "OnionShare Download Canceled", - "systray_download_canceled_message": "The user canceled the download", - "systray_upload_started_title": "OnionShare Upload Started", - "systray_upload_started_message": "A user started uploading files to your computer", "help_local_only": "Don't use Tor (only for development)", - "help_stay_open": "Keep sharing after first download", + "help_stay_open": "Continue sharing after files have been sent", "help_shutdown_timeout": "Stop sharing after a given amount of seconds", "help_stealth": "Use client authorization (advanced)", "help_receive": "Receive shares instead of sending them", @@ -75,7 +64,7 @@ "gui_settings_autoupdate_check_button": "Check for New Version", "gui_settings_general_label": "General settings", "gui_settings_sharing_label": "Sharing settings", - "gui_settings_close_after_first_download_option": "Stop sharing after first download", + "gui_settings_close_after_first_download_option": "Stop sharing after files have been sent", "gui_settings_connection_type_label": "How should OnionShare connect to Tor?", "gui_settings_connection_type_bundled_option": "Use the Tor version built into OnionShare", "gui_settings_connection_type_automatic_option": "Attempt auto-configuration with Tor Browser", @@ -151,8 +140,6 @@ "gui_file_info_single": "{} file, {}", "history_in_progress_tooltip": "{} in progress", "history_completed_tooltip": "{} completed", - "info_in_progress_uploads_tooltip": "{} upload(s) in progress", - "info_completed_uploads_tooltip": "{} upload(s) completed", "error_cannot_create_downloads_dir": "Could not create receive mode folder: {}", "receive_mode_downloads_dir": "Files sent to you appear in this folder: {}", "receive_mode_warning": "Warning: Receive mode lets people upload files to your computer. Some files can potentially take control of your computer if you open them. Only open things from people you trust, or if you know what you are doing.", @@ -165,15 +152,20 @@ "gui_settings_downloads_label": "Save files to", "gui_settings_downloads_button": "Browse", "gui_settings_public_mode_checkbox": "Public mode", - "systray_close_server_title": "OnionShare Server Closed", - "systray_close_server_message": "A user closed the server", - "systray_page_loaded_title": "OnionShare Page Loaded", - "systray_download_page_loaded_message": "A user loaded the download page", - "systray_upload_page_loaded_message": "A user loaded the upload page", "gui_open_folder_error_nautilus": "Cannot open folder because nautilus is not available. The file is here: {}", "gui_settings_language_label": "Preferred language", "gui_settings_language_changed_notice": "Restart OnionShare for your change in language to take effect.", - + "systray_menu_exit": "Quit", + "systray_page_loaded_title": "Page Loaded", + "systray_page_loaded_message": "OnionShare address loaded", + "systray_share_started_title": "Sharing Started", + "systray_share_started_message": "Starting to send files to someone", + "systray_share_completed_title": "Sharing Complete", + "systray_share_completed_message": "Finished sending files", + "systray_share_canceled_title": "Sharing Canceled", + "systray_share_canceled_message": "Someone canceled receiving your files", + "systray_receive_started_title": "Receiving Started", + "systray_receive_started_message": "Someone is sending files to you", "gui_all_modes_history": "History", "gui_all_modes_clear_history": "Clear All", "gui_all_modes_transfer_started": "Started {}", @@ -183,5 +175,7 @@ "gui_all_modes_progress_starting": "{0:s}, %p% (calculating)", "gui_all_modes_progress_eta": "{0:s}, ETA: {1:s}, %p%", "gui_share_mode_no_files": "No Files Sent Yet", - "gui_receive_mode_no_files": "No Files Received Yet" + "gui_share_mode_timeout_waiting": "Waiting to finish sending", + "gui_receive_mode_no_files": "No Files Received Yet", + "gui_receive_mode_timeout_waiting": "Waiting to finish receiving" } From 6e3b103ef51fb5faa891cd90c7ffd8bbfca16d54 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 20 Jan 2019 11:46:20 -0800 Subject: [PATCH 6/9] Rename receive mode "downloads_dir" to the OnionShare "data_dir" --- onionshare/__init__.py | 2 +- onionshare/settings.py | 8 +++---- onionshare/web/receive_mode.py | 6 +++--- onionshare/web/web.py | 2 +- onionshare_gui/onionshare_gui.py | 4 ++-- onionshare_gui/settings_dialog.py | 36 +++++++++++++++---------------- share/locale/en.json | 8 +++---- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/onionshare/__init__.py b/onionshare/__init__.py index 0d064639..2f44c846 100644 --- a/onionshare/__init__.py +++ b/onionshare/__init__.py @@ -175,7 +175,7 @@ def main(cwd=None): print('') if mode == 'receive': - print(strings._('receive_mode_downloads_dir').format(common.settings.get('downloads_dir'))) + print(strings._('receive_mode_data_dir').format(common.settings.get('data_dir'))) print('') print(strings._('receive_mode_warning')) print('') diff --git a/onionshare/settings.py b/onionshare/settings.py index 06235198..1570a150 100644 --- a/onionshare/settings.py +++ b/onionshare/settings.py @@ -100,7 +100,7 @@ class Settings(object): 'public_mode': False, 'slug': '', 'hidservauth_string': '', - 'downloads_dir': self.build_default_downloads_dir(), + 'data_dir': self.build_default_data_dir(), 'locale': None # this gets defined in fill_in_defaults() } self._settings = {} @@ -140,7 +140,7 @@ class Settings(object): """ return os.path.join(self.common.build_data_dir(), 'onionshare.json') - def build_default_downloads_dir(self): + def build_default_data_dir(self): """ Returns the path of the default Downloads directory for receive mode. """ @@ -174,9 +174,9 @@ class Settings(object): except: pass - # Make sure downloads_dir exists + # Make sure data_dir exists try: - os.makedirs(self.get('downloads_dir'), exist_ok=True) + os.makedirs(self.get('data_dir'), exist_ok=True) except: pass diff --git a/onionshare/web/receive_mode.py b/onionshare/web/receive_mode.py index 6985f38a..2b4e8faf 100644 --- a/onionshare/web/receive_mode.py +++ b/onionshare/web/receive_mode.py @@ -64,15 +64,15 @@ class ReceiveModeWeb(object): now = datetime.now() date_dir = now.strftime("%Y-%m-%d") time_dir = now.strftime("%H.%M.%S") - receive_mode_dir = os.path.join(self.common.settings.get('downloads_dir'), date_dir, time_dir) + receive_mode_dir = os.path.join(self.common.settings.get('data_dir'), date_dir, time_dir) valid = True try: os.makedirs(receive_mode_dir, 0o700) except PermissionError: - self.web.add_request(self.web.REQUEST_ERROR_DOWNLOADS_DIR_CANNOT_CREATE, request.path, { + self.web.add_request(self.web.REQUEST_ERROR_DATA_DIR_CANNOT_CREATE, request.path, { "receive_mode_dir": receive_mode_dir }) - print(strings._('error_cannot_create_downloads_dir').format(receive_mode_dir)) + print(strings._('error_cannot_create_data_dir').format(receive_mode_dir)) valid = False if not valid: flash('Error uploading, please inform the OnionShare user', 'error') diff --git a/onionshare/web/web.py b/onionshare/web/web.py index df838df7..c0e9d6b6 100644 --- a/onionshare/web/web.py +++ b/onionshare/web/web.py @@ -38,7 +38,7 @@ class Web(object): REQUEST_UPLOAD_FILE_RENAMED = 6 REQUEST_UPLOAD_SET_DIR = 7 REQUEST_UPLOAD_FINISHED = 8 - REQUEST_ERROR_DOWNLOADS_DIR_CANNOT_CREATE = 9 + REQUEST_ERROR_DATA_DIR_CANNOT_CREATE = 9 def __init__(self, common, is_gui, mode='share'): self.common = common diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 3d5f5f0a..710a1d84 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -393,8 +393,8 @@ class OnionShareGui(QtWidgets.QMainWindow): elif event["type"] == Web.REQUEST_UPLOAD_FINISHED: mode.handle_request_upload_finished(event) - if event["type"] == Web.REQUEST_ERROR_DOWNLOADS_DIR_CANNOT_CREATE: - Alert(self.common, strings._('error_cannot_create_downloads_dir').format(event["data"]["receive_mode_dir"])) + if event["type"] == Web.REQUEST_ERROR_DATA_DIR_CANNOT_CREATE: + Alert(self.common, strings._('error_cannot_create_data_dir').format(event["data"]["receive_mode_dir"])) if event["type"] == Web.REQUEST_OTHER: if event["path"] != '/favicon.ico' and event["path"] != "/{}/shutdown".format(mode.web.shutdown_slug): diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py index b933c30f..aa94b551 100644 --- a/onionshare_gui/settings_dialog.py +++ b/onionshare_gui/settings_dialog.py @@ -187,16 +187,16 @@ class SettingsDialog(QtWidgets.QDialog): sharing_group = QtWidgets.QGroupBox(strings._("gui_settings_sharing_label")) sharing_group.setLayout(sharing_group_layout) - # Downloads dir - downloads_label = QtWidgets.QLabel(strings._('gui_settings_downloads_label')); - self.downloads_dir_lineedit = QtWidgets.QLineEdit() - self.downloads_dir_lineedit.setReadOnly(True) - downloads_button = QtWidgets.QPushButton(strings._('gui_settings_downloads_button')) - downloads_button.clicked.connect(self.downloads_button_clicked) + # OnionShare data dir + data_dir_label = QtWidgets.QLabel(strings._('gui_settings_data_dir_label')); + self.data_dir_lineedit = QtWidgets.QLineEdit() + self.data_dir_lineedit.setReadOnly(True) + data_dir_button = QtWidgets.QPushButton(strings._('gui_settings_data_dir_browse_button')) + data_dir_button.clicked.connect(self.data_dir_button_clicked) downloads_layout = QtWidgets.QHBoxLayout() - downloads_layout.addWidget(downloads_label) - downloads_layout.addWidget(self.downloads_dir_lineedit) - downloads_layout.addWidget(downloads_button) + downloads_layout.addWidget(data_dir_label) + downloads_layout.addWidget(self.data_dir_lineedit) + downloads_layout.addWidget(data_dir_button) # Receiving options layout receiving_group_layout = QtWidgets.QVBoxLayout() @@ -508,8 +508,8 @@ class SettingsDialog(QtWidgets.QDialog): if use_legacy_v2_onions or save_private_key: self.use_legacy_v2_onions_checkbox.setCheckState(QtCore.Qt.Checked) - downloads_dir = self.old_settings.get('downloads_dir') - self.downloads_dir_lineedit.setText(downloads_dir) + data_dir = self.old_settings.get('data_dir') + self.data_dir_lineedit.setText(data_dir) public_mode = self.old_settings.get('public_mode') if public_mode: @@ -747,17 +747,17 @@ class SettingsDialog(QtWidgets.QDialog): if not self.save_private_key_checkbox.isChecked(): self.use_legacy_v2_onions_checkbox.setEnabled(True) - def downloads_button_clicked(self): + def data_dir_button_clicked(self): """ - Browse for a new downloads directory + Browse for a new OnionShare data directory """ - downloads_dir = self.downloads_dir_lineedit.text() + data_dir = self.data_dir_lineedit.text() selected_dir = QtWidgets.QFileDialog.getExistingDirectory(self, - strings._('gui_settings_downloads_label'), downloads_dir) + strings._('gui_settings_data_dir_label'), data_dir) if selected_dir: - self.common.log('SettingsDialog', 'downloads_button_clicked', 'selected dir: {}'.format(selected_dir)) - self.downloads_dir_lineedit.setText(selected_dir) + self.common.log('SettingsDialog', 'data_dir_button_clicked', 'selected dir: {}'.format(selected_dir)) + self.data_dir_lineedit.setText(selected_dir) def test_tor_clicked(self): """ @@ -981,7 +981,7 @@ class SettingsDialog(QtWidgets.QDialog): # Also unset the HidServAuth if we are removing our reusable private key settings.set('hidservauth_string', '') - settings.set('downloads_dir', self.downloads_dir_lineedit.text()) + settings.set('data_dir', self.data_dir_lineedit.text()) settings.set('public_mode', self.public_mode_checkbox.isChecked()) settings.set('use_stealth', self.stealth_checkbox.isChecked()) # Always unset the HidServAuth if Stealth mode is unset diff --git a/share/locale/en.json b/share/locale/en.json index 8bcc738b..a3307e49 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -140,8 +140,8 @@ "gui_file_info_single": "{} file, {}", "history_in_progress_tooltip": "{} in progress", "history_completed_tooltip": "{} completed", - "error_cannot_create_downloads_dir": "Could not create receive mode folder: {}", - "receive_mode_downloads_dir": "Files sent to you appear in this folder: {}", + "error_cannot_create_data_dir": "Could not create OnionShare data folder: {}", + "receive_mode_data_dir": "Files sent to you appear in this folder: {}", "receive_mode_warning": "Warning: Receive mode lets people upload files to your computer. Some files can potentially take control of your computer if you open them. Only open things from people you trust, or if you know what you are doing.", "gui_receive_mode_warning": "Receive mode lets people upload files to your computer.

Some files can potentially take control of your computer if you open them. Only open things from people you trust, or if you know what you are doing.", "receive_mode_upload_starting": "Upload of total size {} is starting", @@ -149,8 +149,8 @@ "gui_mode_share_button": "Share Files", "gui_mode_receive_button": "Receive Files", "gui_settings_receiving_label": "Receiving settings", - "gui_settings_downloads_label": "Save files to", - "gui_settings_downloads_button": "Browse", + "gui_settings_data_dir_label": "Save files to", + "gui_settings_data_dir_browse_button": "Browse", "gui_settings_public_mode_checkbox": "Public mode", "gui_open_folder_error_nautilus": "Cannot open folder because nautilus is not available. The file is here: {}", "gui_settings_language_label": "Preferred language", From 53ec2176c1efe3faaf8b0eaf774ce756f33ed8a7 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 20 Jan 2019 12:01:51 -0800 Subject: [PATCH 7/9] Fix tests to use data_dir setting instead of downloads_dir --- tests/GuiBaseTest.py | 50 +++++++++++++++---------------- tests/GuiReceiveTest.py | 2 +- tests/SettingsGuiBaseTest.py | 4 +-- tests/TorGuiBaseTest.py | 2 +- tests/test_onionshare_settings.py | 2 +- 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/tests/GuiBaseTest.py b/tests/GuiBaseTest.py index c557fc15..e4b3d4c9 100644 --- a/tests/GuiBaseTest.py +++ b/tests/GuiBaseTest.py @@ -39,7 +39,7 @@ class GuiBaseTest(object): strings.load_strings(common) # Get all of the settings in test_settings - test_settings['downloads_dir'] = '/tmp/OnionShare' + test_settings['data_dir'] = '/tmp/OnionShare' for key, val in common.settings.default_settings.items(): if key not in test_settings: test_settings[key] = val @@ -70,17 +70,17 @@ class GuiBaseTest(object): except: pass - + def gui_loaded(self): '''Test that the GUI actually is shown''' self.assertTrue(self.gui.show) - + def windowTitle_seen(self): '''Test that the window title is OnionShare''' self.assertEqual(self.gui.windowTitle(), 'OnionShare') - + def settings_button_is_visible(self): '''Test that the settings button is visible''' self.assertTrue(self.gui.settings_button.isVisible()) @@ -90,12 +90,12 @@ class GuiBaseTest(object): '''Test that the settings button is hidden when the server starts''' self.assertFalse(self.gui.settings_button.isVisible()) - + def server_status_bar_is_visible(self): '''Test that the status bar is visible''' self.assertTrue(self.gui.status_bar.isVisible()) - + def click_mode(self, mode): '''Test that we can switch Mode by clicking the button''' if type(mode) == ReceiveMode: @@ -105,14 +105,14 @@ class GuiBaseTest(object): QtTest.QTest.mouseClick(self.gui.share_mode_button, QtCore.Qt.LeftButton) self.assertTrue(self.gui.mode, self.gui.MODE_SHARE) - + def click_toggle_history(self, mode): '''Test that we can toggle Download or Upload history by clicking the toggle button''' currently_visible = mode.history.isVisible() QtTest.QTest.mouseClick(mode.toggle_history, QtCore.Qt.LeftButton) self.assertEqual(mode.history.isVisible(), not currently_visible) - + def history_indicator(self, mode, public_mode): '''Test that we can make sure the history is toggled off, do an action, and the indiciator works''' # Make sure history is toggled off @@ -150,43 +150,43 @@ class GuiBaseTest(object): QtTest.QTest.mouseClick(mode.toggle_history, QtCore.Qt.LeftButton) self.assertFalse(mode.toggle_history.indicator_label.isVisible()) - + def history_is_not_visible(self, mode): '''Test that the History section is not visible''' self.assertFalse(mode.history.isVisible()) - + def history_is_visible(self, mode): '''Test that the History section is visible''' self.assertTrue(mode.history.isVisible()) - + def server_working_on_start_button_pressed(self, mode): '''Test we can start the service''' # Should be in SERVER_WORKING state QtTest.QTest.mouseClick(mode.server_status.server_button, QtCore.Qt.LeftButton) self.assertEqual(mode.server_status.status, 1) - + def server_status_indicator_says_starting(self, mode): '''Test that the Server Status indicator shows we are Starting''' self.assertEqual(mode.server_status_label.text(), strings._('gui_status_indicator_share_working')) - + def server_is_started(self, mode, startup_time=2000): '''Test that the server has started''' QtTest.QTest.qWait(startup_time) # Should now be in SERVER_STARTED state self.assertEqual(mode.server_status.status, 2) - + def web_server_is_running(self): '''Test that the web server has started''' sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.assertEqual(sock.connect_ex(('127.0.0.1',self.gui.app.port)), 0) - + def have_a_slug(self, mode, public_mode): '''Test that we have a valid slug''' if not public_mode: @@ -194,12 +194,12 @@ class GuiBaseTest(object): else: self.assertIsNone(mode.server_status.web.slug, r'(\w+)-(\w+)') - + def url_description_shown(self, mode): '''Test that the URL label is showing''' self.assertTrue(mode.server_status.url_description.isVisible()) - + def have_copy_url_button(self, mode, public_mode): '''Test that the Copy URL button is shown and that the clipboard is correct''' self.assertTrue(mode.server_status.copy_url_button.isVisible()) @@ -211,7 +211,7 @@ class GuiBaseTest(object): else: self.assertEqual(clipboard.text(), 'http://127.0.0.1:{}/{}'.format(self.gui.app.port, mode.server_status.web.slug)) - + def server_status_indicator_says_started(self, mode): '''Test that the Server Status indicator shows we are started''' if type(mode) == ReceiveMode: @@ -219,7 +219,7 @@ class GuiBaseTest(object): if type(mode) == ShareMode: self.assertEqual(mode.server_status_label.text(), strings._('gui_status_indicator_share_started')) - + def web_page(self, mode, string, public_mode): '''Test that the web page contains a string''' s = socks.socksocket() @@ -248,25 +248,25 @@ class GuiBaseTest(object): self.assertTrue(string in f.read()) f.close() - + def history_widgets_present(self, mode): '''Test that the relevant widgets are present in the history view after activity has taken place''' self.assertFalse(mode.history.empty.isVisible()) self.assertTrue(mode.history.not_empty.isVisible()) - + def counter_incremented(self, mode, count): '''Test that the counter has incremented''' self.assertEqual(mode.history.completed_count, count) - + def server_is_stopped(self, mode, stay_open): '''Test that the server stops when we click Stop''' if type(mode) == ReceiveMode or (type(mode) == ShareMode and stay_open): QtTest.QTest.mouseClick(mode.server_status.server_button, QtCore.Qt.LeftButton) self.assertEqual(mode.server_status.status, 0) - + def web_server_is_stopped(self): '''Test that the web server also stopped''' QtTest.QTest.qWait(2000) @@ -275,7 +275,7 @@ class GuiBaseTest(object): # We should be closed by now. Fail if not! self.assertNotEqual(sock.connect_ex(('127.0.0.1',self.gui.app.port)), 0) - + def server_status_indicator_says_closed(self, mode, stay_open): '''Test that the Server Status indicator shows we closed''' if type(mode) == ReceiveMode: @@ -319,5 +319,3 @@ class GuiBaseTest(object): self.windowTitle_seen() self.settings_button_is_visible() self.server_status_bar_is_visible() - - diff --git a/tests/GuiReceiveTest.py b/tests/GuiReceiveTest.py index eaed8343..a23a4bc6 100644 --- a/tests/GuiReceiveTest.py +++ b/tests/GuiReceiveTest.py @@ -21,7 +21,7 @@ class GuiReceiveTest(GuiBaseTest): for i in range(10): date_dir = now.strftime("%Y-%m-%d") time_dir = now.strftime("%H.%M.%S") - receive_mode_dir = os.path.join(self.gui.common.settings.get('downloads_dir'), date_dir, time_dir) + receive_mode_dir = os.path.join(self.gui.common.settings.get('data_dir'), date_dir, time_dir) expected_filename = os.path.join(receive_mode_dir, expected_basename) if os.path.exists(expected_filename): exists = True diff --git a/tests/SettingsGuiBaseTest.py b/tests/SettingsGuiBaseTest.py index 47d698f3..71244e0f 100644 --- a/tests/SettingsGuiBaseTest.py +++ b/tests/SettingsGuiBaseTest.py @@ -148,7 +148,7 @@ class SettingsGuiBaseTest(object): self.assertFalse(self.gui.close_after_first_download_checkbox.isChecked()) # receive mode - self.gui.downloads_dir_lineedit.setText('/tmp/OnionShareSettingsTest') + self.gui.data_dir_lineedit.setText('/tmp/OnionShareSettingsTest') # bundled mode is enabled @@ -234,7 +234,7 @@ class SettingsGuiBaseTest(object): self.assertFalse(data["save_private_key"]) self.assertFalse(data["use_stealth"]) - self.assertEqual(data["downloads_dir"], "/tmp/OnionShareSettingsTest") + self.assertEqual(data["data_dir"], "/tmp/OnionShareSettingsTest") self.assertFalse(data["close_after_first_download"]) self.assertEqual(data["connection_type"], "bundled") self.assertFalse(data["tor_bridges_use_obfs4"]) diff --git a/tests/TorGuiBaseTest.py b/tests/TorGuiBaseTest.py index 9a0bda3e..e437ac93 100644 --- a/tests/TorGuiBaseTest.py +++ b/tests/TorGuiBaseTest.py @@ -39,7 +39,7 @@ class TorGuiBaseTest(GuiBaseTest): # Get all of the settings in test_settings test_settings['connection_type'] = 'automatic' - test_settings['downloads_dir'] = '/tmp/OnionShare' + test_settings['data_dir'] = '/tmp/OnionShare' for key, val in common.settings.default_settings.items(): if key not in test_settings: test_settings[key] = val diff --git a/tests/test_onionshare_settings.py b/tests/test_onionshare_settings.py index d67621c4..f4be2930 100644 --- a/tests/test_onionshare_settings.py +++ b/tests/test_onionshare_settings.py @@ -64,7 +64,7 @@ class TestSettings: 'private_key': '', 'slug': '', 'hidservauth_string': '', - 'downloads_dir': os.path.expanduser('~/OnionShare'), + 'data_dir': os.path.expanduser('~/OnionShare'), 'public_mode': False } for key in settings_obj._settings: From 1a0dbc9d19dd0287c2e896bcace0341ec9aa1a25 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 20 Jan 2019 15:32:09 -0800 Subject: [PATCH 8/9] Remove un-used images --- share/images/receive_icon.png | Bin 2120 -> 0 bytes share/images/share_icon.png | Bin 2076 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 share/images/receive_icon.png delete mode 100644 share/images/share_icon.png diff --git a/share/images/receive_icon.png b/share/images/receive_icon.png deleted file mode 100644 index ad879b6e0f80dbfa3c82459e645d52f1412caf3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2120 zcmV-O2)Fl%P)T2h~YL zK~#9!?VVp}Th|@OKf01F)%Kl{W9HOJRQTP1#AYs39JVKz!snZXaxM?&=_zZ zm;n9(M1XPN0T5L+_1{iigUbPE+kqf(0B{3dgGJ5)kAe4qAyrd9S#tmtS!o4!0mp#~ zi_Oger+~1ksaIAlKt)!3qDkJg0a`YgJAjC)sWVm>kSv1tCU6(H;~+eQ?K{9-QK!=O zK+(U2fhtN<)4(n>`$?CH@a~Ecbu}oeYU;O30-z!*2Z7T-EvrjY!0W1}{@zF-ZiDcC z3-kj%R-b%;67UA?%4XiEQ1HP|n z>SQ4&d5SP}--OviDQbhbHlOJpC|ujWhT)}74I6=&s;NoSny?}(U)j}cTYuI{*Bf2b zt*--Ma(t4Dzq-hkKVGq|Ijfqw(X>%mbh6*Gqvi+SI!I?0UO3pkBtdgr}eWlgz5a*zgIPkQcwXNS+Z^|(y>vT~7#oX4`>6x$E zXUZ`qt5&ecAD~!Ov3+46nM|5;j0M^(nB?t&VJB*tm`|8;j719P1yC$JI*1z?)@8IdwBFK=J6YqRc0!Dg>()9=OX) zE1i9veE8oF7ym+oA^Z(~%dgJg;3qT~T4uYmuhVQZyV3zXZdU32m;34J>st0%TX!3S z*9Y19!dA=RZGB-YgVzUX>uy{2c~@T-{g?aAGFaA57#X0w zr`>dT?LF-bj0{j)pMLVRt$CZ7o>;LESTA^B(5#YEJug+B3J<}zgY=y0F%4eNsUCuF z2k}&R4Areb1(yOmU}v!EcDvbqXg9q>y@t!`9qMKGq20LMZfw>80FQXZY?*bJ%ldbY zBuS!WUkdXwJRz-E^sD?b7LluRZ~yOS4gU0}m^3VVEV|6li!>ty6QIqPxSq=q)B(fCYb zLFM23=RHEtn?6hZsf7M^sHx2$^n8eiUp_48oW^Gwsqxq3Jg&xHQ!u=TUp}+~9>97D zXtSc^;Il!-J|8RSoP2I#p*MQ$^D%>Bn9?#_g-O9h-CAzIvNuFCMef z#1;vVt+a5m<0Rqt!?v#DC6h_Q?}s_ranfp24IZGe8xs1)Jx8?=E9NVkV!V9x7YTjWqvJXgJd^i>b(>1KXzKI8ZEbMtg>>2@66l92C#1Vqu_3wB(wi5MO0I*5K2UGZJ?vnUjY_Pn;I*a0IWqf~$q;At)W^(0Bc)iehvNox4{^)te{yw&91L-sjG7mnv&K4W4*Ft)eVsuW` z)T4#~3W(Q$rvEc|qpGGh=bSI+Tbi9oCrUthC!Hv#Jy|Jh(w;1VIkSc#&Z?SP(3bdO zCasO=X_D4lvlZ8d)c|9ne;8e31I9-5Y{3P|&^v8wB*e)Xs$`8hjaZJvBOe94fv?0o zakb?ToC1!hnmS;lka7x8gEDR9Q&eaNrM(n34eT%ro~a&~;*D>jC$A`#{0m>BFNXG; yU2r)Occ}tQfmu!kZz9a{j}e#%bJhPG#{U3#k;&MKJ6Qq%0000Iz^0 diff --git a/share/images/share_icon.png b/share/images/share_icon.png deleted file mode 100644 index cd9bd98e08d2bfe84a98e6d165134146d8946191..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2076 zcmV+%2;=vOP)yV@BZ#NKO7WMvPa$l)B_Iy+W{Z&7*Gw=0ABUh2rv!Y z0saSsf!n}cU{WaJt77%RQ3PmD0*8S^fD>@(EOH)L0{#Jngd+a4=>WeTPgBup0?2+B-ko?pFXt`kS1j0fQb7oW^nFQ|?a1;2vi11MB{v5cew#nWW zsLpT0z!vPOSs-BKJn1kH-c5By-3Xc#ig?5p0A-K-JK!9!m5rq+@Ul?E-}MyY)Cun| zz-hqE#*-V6eJQ{r6R~tS3q?F+qy>%ueydvl`oCYN{)yEt<>bU9Fa7K#DgoBe2XD34Du8~q@7gU;b&^9?wYWFhi^Gw7P$UuwnzlAsX^Dq(Ios=5 z;5n;W*&1qH7aoAa;h;6tY9+vPnk>-DciZ-!b{d{;DCn8-e~r`e%Z{SIJ3DejRX(+% zW#`AvQ}=kCre~+FPZ8W5vx14Pu_*Rf|m+?{la#uOQw}P~sZ7~zzgDRt}08Lvs zT0^buJF*XFnbWl1Im?{vJF?GgH)ju&oqSF%<%CFb&!oz z!_y6%A3JYG(QT^$s*bavGrJZaFOf(Xa*qYRV!6s}#R3l-S$gMZodx@N(_c(;KXQNF z`|d~XGyTPM!McEKu)IM5UkkyS3jdQf&Xx`5pZ8*yK(0D=Z ztbMeW11Am`3Gfhrq;4^Drcc6Jb@0T&g5X{G@CqHxg$D&Xnmf4i;gy0Q7SgtSR%6*C z?wZ{?{DNQb*ULv`<(NcIzOH1^3_v?a} z3bDVtpQWXxVl4CztN=6$-o-N)b6#IuSS0jHh_1FS!+O!x)z)D{ibXWe9R$x)TXNv$%A{g(A@WPhTLPJ1|*WF9&Mp} zx9%BokA#RZrGZyuOjKJ)QCHag$7_qTgF`07EbwpRf#b9;u1f4W#ycp2iQ zvqBM-%K-ldJYRB=3)0&{5x-w{szN0m>n<4S3PH*SOW7mGDDK%_Tf)oYcP^l@^;!+Sfw8I8U|i9qGETYoBhx4$KUM7TkXZQ#RUmiTD0cFkF(4P4w#>vCvqpk z=;cv9e*5FRo$x$9u&wM?U3Hfc!`M^hq2a=OU4Q68nNjo> zw=#UwhcF})H0V;(i%s~O{kDMzP~on?-|VO9#U`x_Mpj1Y0K>qydK%k!q_G$uxz~^4 zND_@l8ubiYR5szP0M*nWx_04g@z^!rMDDib8Rh9rPoJ{JRD>cnkyJkbOQR?mXS$Dfa-~yNiDVXb@vgE$885M9*@)4t$9bpWVT#0S!a9oY*@6= zntI>pW%TkWvALLS;Kk-*j9wn4_l;gHk4JOmm{~7p!pnueCo3}wZ@%y*Q`e?8tRtO) zLH5OGy{FYf$D1L&i5C4;DB=ZO09A;V9{IP4@;dTw+oTgkmf=Y!N@-8@T3`yyxlIgl zUMQlV#5-DET5CwAN!oP7R_z;R1B|Hi!{{bkFdjm~Mk`(WBsPhQv#zU>)92Jvb2t|6 z_qlwx)c3@VmP0TK92biCqn<)aDL{3~u*j#{pq Date: Sun, 20 Jan 2019 15:33:33 -0800 Subject: [PATCH 9/9] In SettingsDialog, rename downloads_layout to data_dir_layout --- onionshare_gui/settings_dialog.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py index aa94b551..1fe6dc53 100644 --- a/onionshare_gui/settings_dialog.py +++ b/onionshare_gui/settings_dialog.py @@ -193,14 +193,14 @@ class SettingsDialog(QtWidgets.QDialog): self.data_dir_lineedit.setReadOnly(True) data_dir_button = QtWidgets.QPushButton(strings._('gui_settings_data_dir_browse_button')) data_dir_button.clicked.connect(self.data_dir_button_clicked) - downloads_layout = QtWidgets.QHBoxLayout() - downloads_layout.addWidget(data_dir_label) - downloads_layout.addWidget(self.data_dir_lineedit) - downloads_layout.addWidget(data_dir_button) + data_dir_layout = QtWidgets.QHBoxLayout() + data_dir_layout.addWidget(data_dir_label) + data_dir_layout.addWidget(self.data_dir_lineedit) + data_dir_layout.addWidget(data_dir_button) # Receiving options layout receiving_group_layout = QtWidgets.QVBoxLayout() - receiving_group_layout.addLayout(downloads_layout) + receiving_group_layout.addLayout(data_dir_layout) receiving_group = QtWidgets.QGroupBox(strings._("gui_settings_receiving_label")) receiving_group.setLayout(receiving_group_layout)