From f1495308347411907bb264af8076350b2d9134f2 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Wed, 25 Apr 2018 08:49:43 -0700 Subject: [PATCH] Move more logic from OnionShareGui into ShareMode, when reloading settings --- onionshare_gui/onionshare_gui.py | 6 +----- onionshare_gui/share_mode/__init__.py | 9 +++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 43204122..0dd880a9 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -314,11 +314,7 @@ class OnionShareGui(QtWidgets.QMainWindow): if self.onion.is_authenticated(): if not self.timer.isActive(): self.timer.start(500) - # If there were some files listed for sharing, we should be ok to - # re-enable the 'Start Sharing' button now. - if self.server_status.file_selection.get_num_files() > 0: - self.primary_action.show() - self.info_widget.show() + self.share_mode.on_reload_settings() self.status_bar.clearMessage() # If we switched off the shutdown timeout setting, ensure the widget is hidden. diff --git a/onionshare_gui/share_mode/__init__.py b/onionshare_gui/share_mode/__init__.py index 8ce9d2a9..39550cee 100644 --- a/onionshare_gui/share_mode/__init__.py +++ b/onionshare_gui/share_mode/__init__.py @@ -243,6 +243,15 @@ class ShareMode(QtWidgets.QWidget): self.update_downloads_in_progress(self.downloads_in_progress) self.system_tray.showMessage(strings._('systray_download_canceled_title', True), strings._('systray_download_canceled_message', True)) + def on_reload_settings(self): + """ + If there were some files listed for sharing, we should be ok to re-enable + the 'Start Sharing' button now. + """ + if self.server_status.file_selection.get_num_files() > 0: + self.primary_action.show() + self.info_widget.show() + def update_primary_action(self): # Show or hide primary action layout file_count = self.file_selection.file_list.count()