From afc9568f30b45a838192f1654f06485c38fb28b7 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Sun, 11 Feb 2018 17:16:52 +1100 Subject: [PATCH] Adjust width of window to fit status bar messages, unwrapped, to avoid squishing widgets. Add pluralisation of filemanager total file(s) Use 'timer expired' rather than 'timeout reached' --- onionshare_gui/file_selection.py | 5 ++++- onionshare_gui/onionshare_gui.py | 12 ++++++------ onionshare_gui/server_status.py | 1 + share/locale/en.json | 5 +++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py index b097e501..ba3df69d 100644 --- a/onionshare_gui/file_selection.py +++ b/onionshare_gui/file_selection.py @@ -310,7 +310,10 @@ class FileSelection(QtWidgets.QVBoxLayout): total_size_bytes += item.size_bytes total_size_readable = common.human_readable_filesize(total_size_bytes) - self.info_label.setText(strings._('gui_file_info', True).format(file_count, total_size_readable)) + if file_count > 1: + self.info_label.setText(strings._('gui_file_info', True).format(file_count, total_size_readable)) + else: + self.info_label.setText(strings._('gui_file_info_single', True).format(file_count, total_size_readable)) self.info_label.show() # All buttons should be hidden if the server is on diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 946000e9..f52281de 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -56,7 +56,7 @@ class OnionShareGui(QtWidgets.QMainWindow): self.setWindowTitle('OnionShare') self.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png'))) - self.setMinimumWidth(350) + self.setMinimumWidth(430) # Load settings self.config = config @@ -152,7 +152,6 @@ class OnionShareGui(QtWidgets.QMainWindow): self._zip_progress_bar = None # Status bar, sharing messages self.server_share_status_label = QtWidgets.QLabel('') - self.server_share_status_label.setWordWrap(True) self.server_share_status_label.setStyleSheet('QLabel { font-style: italic; color: #666666; padding: 2px; }') self.status_bar.insertWidget(0, self.server_share_status_label) @@ -198,15 +197,15 @@ class OnionShareGui(QtWidgets.QMainWindow): self.check_for_updates() def update_primary_action(self): - # Resize window - self.adjustSize() - # Show or hide primary action layout if self.file_selection.file_list.count() > 0: self.primary_action.show() else: self.primary_action.hide() + # Resize window + self.adjustSize() + def update_server_status_indicator(self): common.log('OnionShareGui', 'update_server_status_indicator') @@ -450,9 +449,10 @@ class OnionShareGui(QtWidgets.QMainWindow): # Remove ephemeral service, but don't disconnect from Tor self.onion.cleanup(stop_tor=False) self.filesize_warning.hide() - self.stop_server_finished.emit() + self.file_selection.file_list.adjustSize() self.set_server_active(False) + self.stop_server_finished.emit() def check_for_updates(self): """ diff --git a/onionshare_gui/server_status.py b/onionshare_gui/server_status.py index 5b6fdd52..c292d207 100644 --- a/onionshare_gui/server_status.py +++ b/onionshare_gui/server_status.py @@ -81,6 +81,7 @@ class ServerStatus(QtWidgets.QWidget): self.url.setFont(url_font) self.url.setWordWrap(True) self.url.setMinimumHeight(60) + self.url.setMinimumSize(self.url.sizeHint()) self.url.setStyleSheet('QLabel { background-color: #ffffff; color: #000000; padding: 10px; border: 1px solid #666666; }') url_buttons_style = 'QPushButton { color: #3f7fcf; }' diff --git a/share/locale/en.json b/share/locale/en.json index aed92e06..3e3d06c3 100644 --- a/share/locale/en.json +++ b/share/locale/en.json @@ -13,7 +13,7 @@ "no_available_port": "Could not start the Onion service as there was no available port.", "download_page_loaded": "Download page loaded", "other_page_loaded": "Address loaded", - "close_on_timeout": "Stopped because timeout was reached", + "close_on_timeout": "Stopped because timer expired", "closing_automatically": "Stopped because download finished", "timeout_download_still_running": "Waiting for download to complete", "large_filesize": "Warning: Sending large files could take hours", @@ -141,5 +141,6 @@ "gui_status_indicator_stopped": "Ready to Share", "gui_status_indicator_working": "Starting...", "gui_status_indicator_started": "Sharing", - "gui_file_info": "{} Files, {}" + "gui_file_info": "{} Files, {}", + "gui_file_info_single": "{} File, {}" }