本文整理汇总了Python中gi.repository.GnomeKeyring.item_set_info_sync方法的典型用法代码示例。如果您正苦于以下问题:Python GnomeKeyring.item_set_info_sync方法的具体用法?Python GnomeKeyring.item_set_info_sync怎么用?Python GnomeKeyring.item_set_info_sync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GnomeKeyring
的用法示例。
在下文中一共展示了GnomeKeyring.item_set_info_sync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from gi.repository import GnomeKeyring [as 别名]
# 或者: from gi.repository.GnomeKeyring import item_set_info_sync [as 别名]
def save(self, username, password):
encoded_credentials = self._encode_credentials(username, password)
item_id = self._find_keyring_item_id()
if not item_id:
item_id = self._create_keyring_item_info(encoded_credentials)
else:
item_info = self._get_keyring_item_info(item_id)
item_info.set_secret(encoded_credentials)
GnomeKeyring.item_set_info_sync(
GnomeCredentialStore.KEYRING_NAME,
item_id,
item_info)
logger.debug("Successfully saved new credentials to item_id: %s" % item_id)
return True
示例2: close_button_pressed
# 需要导入模块: from gi.repository import GnomeKeyring [as 别名]
# 或者: from gi.repository.GnomeKeyring import item_set_info_sync [as 别名]
def close_button_pressed(self, dialog, response):
if response != Gtk.ResponseType.CLOSE:
return
username = self.__builder.get_object("username").get_text()
password = self.__builder.get_object("password").get_text()
# TODO: Verify Account
if self.__keyring_data['item']:
self.__keyring_data['item'].set_secret('\n'.join((username, password)))
GnomeKeyring.item_set_info_sync(None, self.__keyring_data['id'], self.__keyring_data['item'])
enable_icon = self.__builder.get_object("enable_icon")
enabled =enable_icon.get_active()
self.gconf.set_bool(GCONF_KEYS['icon'], enabled)
print("Setting to ")
print(enabled)
dialog.hide()
if self.callback:
#gconf transaction is asynch
self.callback(enabled)