onionshare/onionshare_gui/options.py

31 lines
937 B
Python
Raw Normal View History

2014-08-27 19:46:19 -04:00
from PyQt4 import QtCore, QtGui
import common
from onionshare import strings, helpers
class Options(QtGui.QHBoxLayout):
def __init__(self, web):
2014-08-27 19:46:19 -04:00
super(Options, self).__init__()
self.addSpacing(10)
self.web = web
2014-08-27 19:46:19 -04:00
# close automatically
self.close_automatically = QtGui.QCheckBox()
if self.web.stay_open:
self.close_automatically.setCheckState(QtCore.Qt.Unchecked)
else:
self.close_automatically.setCheckState(QtCore.Qt.Checked)
2014-08-27 19:46:19 -04:00
self.close_automatically.setText(strings._("close_on_finish"))
self.connect(self.close_automatically, QtCore.SIGNAL('stateChanged(int)'), self.stay_open_changed)
2014-08-27 19:46:19 -04:00
# add the widgets
self.addWidget(self.close_automatically)
def stay_open_changed(self, state):
if state > 0:
self.web.set_stay_open(False)
else:
self.web.set_stay_open(True)