From 862a0dc067f38d700ec2339633a0701ac6b271d1 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 19 Jan 2019 19:00:41 -0800 Subject: 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 +-- share/images/downloads.png | Bin 2120 -> 0 bytes share/images/downloads_toggle.png | Bin 380 -> 0 bytes share/images/downloads_toggle_selected.png | Bin 468 -> 0 bytes share/images/downloads_transparent.png | Bin 2138 -> 0 bytes share/images/receive_icon.png | Bin 0 -> 2120 bytes share/images/receive_icon_toggle.png | Bin 0 -> 380 bytes share/images/receive_icon_toggle_selected.png | Bin 0 -> 468 bytes share/images/receive_icon_transparent.png | Bin 0 -> 2138 bytes share/images/share_icon.png | Bin 0 -> 2076 bytes share/images/share_icon_toggle.png | Bin 0 -> 389 bytes share/images/share_icon_toggle_selected.png | Bin 0 -> 473 bytes share/images/share_icon_transparent.png | Bin 0 -> 2096 bytes share/images/uploads.png | Bin 2076 -> 0 bytes share/images/uploads_toggle.png | Bin 389 -> 0 bytes share/images/uploads_toggle_selected.png | Bin 473 -> 0 bytes share/images/uploads_transparent.png | Bin 2096 -> 0 bytes share/locale/en.json | 17 +++----- 20 files changed, 49 insertions(+), 40 deletions(-) delete mode 100644 share/images/downloads.png delete mode 100644 share/images/downloads_toggle.png delete mode 100644 share/images/downloads_toggle_selected.png delete mode 100644 share/images/downloads_transparent.png create mode 100644 share/images/receive_icon.png create mode 100644 share/images/receive_icon_toggle.png create mode 100644 share/images/receive_icon_toggle_selected.png create mode 100644 share/images/receive_icon_transparent.png create mode 100644 share/images/share_icon.png create mode 100644 share/images/share_icon_toggle.png create mode 100644 share/images/share_icon_toggle_selected.png create mode 100644 share/images/share_icon_transparent.png delete mode 100644 share/images/uploads.png delete mode 100644 share/images/uploads_toggle.png delete mode 100644 share/images/uploads_toggle_selected.png delete mode 100644 share/images/uploads_transparent.png 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/downloads.png deleted file mode 100644 index ad879b6e..00000000 Binary files a/share/images/downloads.png and /dev/null differ diff --git a/share/images/downloads_toggle.png b/share/images/downloads_toggle.png deleted file mode 100644 index 846ececb..00000000 Binary files a/share/images/downloads_toggle.png and /dev/null differ diff --git a/share/images/downloads_toggle_selected.png b/share/images/downloads_toggle_selected.png deleted file mode 100644 index 127ce208..00000000 Binary files a/share/images/downloads_toggle_selected.png and /dev/null differ diff --git a/share/images/downloads_transparent.png b/share/images/downloads_transparent.png deleted file mode 100644 index 99207097..00000000 Binary files a/share/images/downloads_transparent.png and /dev/null differ diff --git a/share/images/receive_icon.png b/share/images/receive_icon.png new file mode 100644 index 00000000..ad879b6e Binary files /dev/null and b/share/images/receive_icon.png differ diff --git a/share/images/receive_icon_toggle.png b/share/images/receive_icon_toggle.png new file mode 100644 index 00000000..846ececb Binary files /dev/null and b/share/images/receive_icon_toggle.png differ diff --git a/share/images/receive_icon_toggle_selected.png b/share/images/receive_icon_toggle_selected.png new file mode 100644 index 00000000..127ce208 Binary files /dev/null and b/share/images/receive_icon_toggle_selected.png differ diff --git a/share/images/receive_icon_transparent.png b/share/images/receive_icon_transparent.png new file mode 100644 index 00000000..99207097 Binary files /dev/null and b/share/images/receive_icon_transparent.png differ diff --git a/share/images/share_icon.png b/share/images/share_icon.png new file mode 100644 index 00000000..cd9bd98e Binary files /dev/null and b/share/images/share_icon.png differ diff --git a/share/images/share_icon_toggle.png b/share/images/share_icon_toggle.png new file mode 100644 index 00000000..87303c9f Binary files /dev/null and b/share/images/share_icon_toggle.png differ diff --git a/share/images/share_icon_toggle_selected.png b/share/images/share_icon_toggle_selected.png new file mode 100644 index 00000000..0ba52cff Binary files /dev/null and b/share/images/share_icon_toggle_selected.png differ diff --git a/share/images/share_icon_transparent.png b/share/images/share_icon_transparent.png new file mode 100644 index 00000000..3648c3fb Binary files /dev/null and b/share/images/share_icon_transparent.png differ diff --git a/share/images/uploads.png b/share/images/uploads.png deleted file mode 100644 index cd9bd98e..00000000 Binary files a/share/images/uploads.png and /dev/null differ diff --git a/share/images/uploads_toggle.png b/share/images/uploads_toggle.png deleted file mode 100644 index 87303c9f..00000000 Binary files a/share/images/uploads_toggle.png and /dev/null differ diff --git a/share/images/uploads_toggle_selected.png b/share/images/uploads_toggle_selected.png deleted file mode 100644 index 0ba52cff..00000000 Binary files a/share/images/uploads_toggle_selected.png and /dev/null differ diff --git a/share/images/uploads_transparent.png b/share/images/uploads_transparent.png deleted file mode 100644 index 3648c3fb..00000000 Binary files a/share/images/uploads_transparent.png and /dev/null differ 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" } -- cgit v1.2.3-54-g00ecf