[Pkg-anonymity-tools] [onionshare] 08/140: Fix close automatically

Ulrike Uhlig u-guest at moszumanska.debian.org
Mon Sep 29 20:33:42 UTC 2014


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch master
in repository onionshare.

commit 1366d45e65a44b62c0df2db1683fb4ae01508acb
Author: Lazlo Westerhof <github at lazlo.me>
Date:   Fri Aug 22 23:07:39 2014 +0200

    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 71e198a..9d9c2f3 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 a37865d..8a743a0 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))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/onionshare.git



More information about the Pkg-anonymity-tools mailing list