本文整理汇总了Python中leap.bitmask.config.leapsettings.LeapSettings.set_remember方法的典型用法代码示例。如果您正苦于以下问题:Python LeapSettings.set_remember方法的具体用法?Python LeapSettings.set_remember怎么用?Python LeapSettings.set_remember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leap.bitmask.config.leapsettings.LeapSettings
的用法示例。
在下文中一共展示了LeapSettings.set_remember方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LoginWidget
# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import set_remember [as 别名]
class LoginWidget(QtGui.QWidget, SignalTracker):
"""
Login widget that emits signals to display the wizard or to
perform login.
"""
login_start = QtCore.Signal()
login_finished = QtCore.Signal()
login_offline_finished = QtCore.Signal()
login_failed = QtCore.Signal()
logged_out = QtCore.Signal()
MAX_STATUS_WIDTH = 40
# Keyring
KEYRING_KEY = "bitmask"
def __init__(self, backend, signaler, parent=None):
"""
Constructs the LoginWidget.
:param backend: Backend being used
:type backend: Backend
:param signaler: Object in charge of handling communication
back to the frontend
:type signaler: Signaler
:param parent: The parent widget for this widget
:type parent: QWidget or None
"""
QtGui.QWidget.__init__(self, parent)
SignalTracker.__init__(self)
self.ui = Ui_LoginWidget()
self.ui.setupUi(self)
self.ui.chkRemember.stateChanged.connect(self._remember_state_changed)
self.ui.chkRemember.setEnabled(has_keyring())
self.ui.lnUser.textChanged.connect(self._credentials_changed)
self.ui.lnPassword.textChanged.connect(self._credentials_changed)
self.ui.btnLogin.clicked.connect(self._do_login)
self.ui.btnLogout.clicked.connect(self.do_logout)
self.ui.lnUser.setValidator(
QtGui.QRegExpValidator(QtCore.QRegExp(USERNAME_REGEX), self))
self.ui.clblErrorMsg.hide()
self.ui.clblErrorMsg.clicked.connect(self.ui.clblErrorMsg.hide)
self.ui.lnUser.textEdited.connect(self.ui.clblErrorMsg.hide)
self.ui.lnPassword.textEdited.connect(self.ui.clblErrorMsg.hide)
self._settings = LeapSettings()
self._backend = backend
self._leap_signaler = signaler
# the selected provider that we'll use to login
self._provider = None
self._state = LoginState()
self._set_logged_out()
def _remember_state_changed(self, state):
"""
Save the remember state in the LeapSettings.
:param state: the current state of the check box.
:type state: int
"""
# The possible state values of the checkbox (from QtCore.Qt.CheckState)
# are: Checked, Unchecked and PartiallyChecked
self._settings.set_remember(state == QtCore.Qt.Checked)
def _credentials_changed(self, text):
"""
TRIGGER:
self.ui.lnUser.textChanged
self.ui.lnPassword.textChanged
Update the 'enabled' status of the login button depending if we have
all the fields needed set.
"""
enabled = self._provider and self.get_user() and self.get_password()
enabled = bool(enabled) # provider can be None
self.ui.btnLogin.setEnabled(enabled)
def wait_for_login(self, wait):
"""
Set the wait flag to True/False so the next time that a login action is
requested it will wait or not.
If we set the wait to True and we have paused a login request before,
this will trigger a login action.
:param wait: whether we should wait or not on the next login request.
:type wait: bool
"""
self._state.wait_to_login = wait
#.........这里部分代码省略.........