Fix close automatically

This commit is contained in:
Lazlo Westerhof 2014-08-22 23:07:39 +02:00
parent 60d97cfa5e
commit 1366d45e65
2 changed files with 9 additions and 5 deletions

View File

@ -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():

View File

@ -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))