本文整理汇总了Python中Settings.Settings.getCredentials方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.getCredentials方法的具体用法?Python Settings.getCredentials怎么用?Python Settings.getCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings.Settings
的用法示例。
在下文中一共展示了Settings.getCredentials方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Settings_GTK
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import getCredentials [as 别名]
#.........这里部分代码省略.........
passwordEntry.show()
checkbutton = gtk.CheckButton()
checkbutton.connect("toggled", self._uploaderCheckbuttonToggled, plugin.NAME)
table.attach(checkbutton, 3, 4, row, row+1)
# if password is required do not allow user to uncheck it
checkbutton.set_sensitive(not plugin.PASSWORD_REQUIRED)
checkbutton.show()
account = [usernameEntry, passwordEntry, checkbutton]
self.__accounts[plugin.NAME] = account
row += 1
def _uploaderCheckbuttonToggled(self, widget, pluginName):
areCredentialsUsedSettingName = self._settings_class.getSettingNameForUsingUploaderPassword(pluginName)
self._settings_dict[areCredentialsUsedSettingName] = widget.get_active()
def __initUploaderComboboxSelectedValue(self, fileType, uploaders, combobox):
if not uploaders:
return # nothing to select from(combobox is empty)
selectedUploader = self._settings_dict["preferredUploaders"][fileType]
if selectedUploader in uploaders:
selectedUploaderIndex = uploaders.index(selectedUploader)
else:
#uploader have not been found: try to select default one
selectedUploaderIndex = 0
self._settings_dict["preferredUploaders"][fileType] = uploaders[selectedUploaderIndex]
combobox.set_active(selectedUploaderIndex)
def __setCredentialsToWidgets(self, areCredentialsUsedSettingName, checkbuttonCredentialsUsedWidget,
credentialsName, nameWidget, passWidget, checkbutton_sensitive = True):
"""areCredentialsUsedSettingName - setting name with value indicating if this credentials are used
checkbuttonCredentialsUsedWidgetName - checkbutton that should show if credentials are used
getCredentialsFunction - function that will return credentials
nameWidgetName - widget that should be populated with credential name
passWidgetName - widget that should be populated with credential password
"""
credentials = self._settings_class.getCredentials(credentialsName)
if credentials:
user, password = credentials
nameWidget.set_text(user)
passWidget.set_text(password)
del user
del password
else:
nameWidget.set_text("")
passWidget.set_text("")
checkbuttonCredentialsUsedWidget.set_active(self._settings_dict[areCredentialsUsedSettingName])
def __setCredentialsForProxy(self):
"""loads stored proxy credentials"""
self.__setCredentialsToWidgets("useProxy",
self.__wTree.get_widget("checkbuttonUseProxy"),
"proxy",
self.__wTree.get_widget("entryProxyUserName"),
self.__wTree.get_widget("entryProxyPassword"))
def __setCredentialsForUploaders(self):
"""loads stored accounts credentials"""
for name, accountWidgets in self.__accounts.items():
self.__setCredentialsToWidgets(
self._settings_class.getSettingNameForUsingUploaderPassword(name),
accountWidgets[2],
name,
accountWidgets[0],