From 1366d45e65a44b62c0df2db1683fb4ae01508acb Mon Sep 17 00:00:00 2001 From: Lazlo Westerhof Date: Fri, 22 Aug 2014 23:07:39 +0200 Subject: [PATCH] Fix close automatically --- onionshare/onionshare.py | 3 +++ onionshare_gui/onionshare_gui.py | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index 71e198a9..9d9c2f31 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -52,6 +52,9 @@ def set_stay_open(new_stay_open): global stay_open stay_open = new_stay_open +def get_stay_open(): + stay_open = new_stay_open + app = Flask(__name__) def debug_mode(): diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index a37865d9..8a743a00 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -127,7 +127,7 @@ class OnionShareGui(QtGui.QWidget): # close automatically checkbox self.closeAutomatically = QtGui.QCheckBox(self.widget) self.closeAutomatically.setCheckState(QtCore.Qt.Checked) - if onionshare.stay_open: + if onionshare.get_stay_open(): self.closeAutomatically.setCheckState(QtCore.Qt.Unchecked) self.closeAutomatically.setStyleSheet("font-size: 12px") @@ -218,7 +218,7 @@ class OnionShareGui(QtGui.QWidget): if event["data"]["bytes"] == onionshare.filesize: self.update_log(event, translated("download_finished")) # close on finish? - if not onionshare.stay_open: + if not onionshare.get_stay_open(): time.sleep(1) def close_countdown(i): if i > 0: @@ -275,7 +275,8 @@ class OnionShareGui(QtGui.QWidget): def stay_open_changed(self, state): if state > 0: onionshare.set_stay_open(False) - onionshare.set_stay_open(True) + else: + onionshare.set_stay_open(True) return def alert(msg, icon=QtGui.QMessageBox.NoIcon): @@ -326,11 +327,11 @@ def main(): stay_open = bool(args.stay_open) debug = bool(args.debug) + onionshare.set_stay_open(stay_open) + if debug: onionshare.debug_mode() - onionshare.set_stay_open(stay_open) - # create the onionshare icon global window_icon, onionshare_gui_dir window_icon = QtGui.QIcon("{0}/static/logo.png".format(onionshare_gui_dir))