本文整理汇总了Python中leap.bitmask.config.leapsettings.LeapSettings.set_pixelmail_enabled方法的典型用法代码示例。如果您正苦于以下问题:Python LeapSettings.set_pixelmail_enabled方法的具体用法?Python LeapSettings.set_pixelmail_enabled怎么用?Python LeapSettings.set_pixelmail_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leap.bitmask.config.leapsettings.LeapSettings
的用法示例。
在下文中一共展示了LeapSettings.set_pixelmail_enabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PreferencesEmailPage
# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import set_pixelmail_enabled [as 别名]
#.........这里部分代码省略.........
self.ui.imap_host_edit.setText("127.0.0.1")
self.ui.smtp_port_edit.setText(str(smtp_port))
self.ui.smtp_host_edit.setText("127.0.0.1")
self.ui.username_edit.setText(self.account.address)
self.ui.password_edit.setText(
self.app.service_tokens.get('mail_auth', ''))
self.app.backend.keymanager_list_keys()
self.app.backend.keymanager_get_key_details(
username=self.account.address)
def _key_details(self, details):
"""
Trigger by signal: keymanager_key_details
Set the current user's key details into the gui.
"""
self.ui.fingerprint_edit.setPlainText(
self._format_fingerprint(details["fingerprint"]))
self.ui.expiration_edit.setText(details["expiry_date"])
self.ui.uid_edit.setText(" ".join(details["uids"]))
self.ui.public_key_edit.setPlainText(details["key_data"])
def _format_fingerprint(self, fingerprint):
"""
formats an openpgp fingerprint in a manner similar to what gpg
produces, wrapped to two lines.
"""
fp = fingerprint.upper()
fp_list = [fp[i:i + 4] for i in range(0, len(fp), 4)]
fp_wrapped = " ".join(fp_list[0:5]) + "\n" + " ".join(fp_list[5:10])
return fp_wrapped
def _export_keys(self):
"""
Exports the user's key pair.
"""
file_name, filtr = QtGui.QFileDialog.getSaveFileName(
self, self.tr("Save private key file"),
filter="*.pem",
options=QtGui.QFileDialog.DontUseNativeDialog)
if file_name:
if not file_name.endswith('.pem'):
file_name += '.pem'
self.app.backend.keymanager_export_keys(
username=self.account.address,
filename=file_name)
else:
logger.debug('Export canceled by the user.')
def _keymanager_export_ok(self):
"""
TRIGGERS:
Signaler.keymanager_export_ok
Notify the user that the key export went OK.
"""
QtGui.QMessageBox.information(
self, self.tr("Export Successful"),
self.tr("The key pair was exported successfully.\n"
"Please, store your private key in a safe place."))
def _keymanager_export_error(self):
"""
TRIGGERS:
Signaler.keymanager_export_error
Notify the user that the key export didn't go well.
"""
QtGui.QMessageBox.critical(
self, self.tr("Input/Output error"),
self.tr("There was an error accessing the file.\n"
"Export canceled."))
def _import_keys(self):
"""
not yet supported
"""
def _keymanager_keys_list(self, keys):
"""
TRIGGERS:
Signaler.keymanager_keys_list
Load the keys given as parameter in the table.
:param keys: the list of keys to load.
:type keys: list
"""
for key in keys:
row = self.ui.keys_table.rowCount()
self.ui.keys_table.insertRow(row)
self.ui.keys_table.setItem(
row, 0, QtGui.QTableWidgetItem(" ".join(key["uids"])))
self.ui.keys_table.setItem(
row, 1, QtGui.QTableWidgetItem(key["fingerprint"]))
def _toggle_webmail(self, state):
value = True if state == QtCore.Qt.Checked else False
self.settings.set_pixelmail_enabled(value)