当前位置: 首页>>代码示例>>Python>>正文


Python Settings.getSettingNameForUsingUploaderPassword方法代码示例

本文整理汇总了Python中Settings.Settings.getSettingNameForUsingUploaderPassword方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.getSettingNameForUsingUploaderPassword方法的具体用法?Python Settings.getSettingNameForUsingUploaderPassword怎么用?Python Settings.getSettingNameForUsingUploaderPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Settings.Settings的用法示例。


在下文中一共展示了Settings.getSettingNameForUsingUploaderPassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Settings_GTK

# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import getSettingNameForUsingUploaderPassword [as 别名]

#.........这里部分代码省略.........
        #store refrences to generated fields, to allow easy acces to them latter
        #key is plugin name, value is list containg usernameEntry, 
        #passwordEntry and in use checkbutton (in that order)
        self.__accounts = {}
        #first row is header
        table.resize(len(PLUGINS_WITH_PASSWORDS)+1,4)
        row = 1
        for plugin in PLUGINS_WITH_PASSWORDS:
            nameLabel = gtk.Label(plugin.NAME)
            table.attach(nameLabel, 0, 1, row, row+1)
            nameLabel.show()

            usernameEntry = gtk.Entry()
            table.attach(usernameEntry, 1, 2, row, row+1)
            usernameEntry.show()

            passwordEntry = gtk.Entry()
            passwordEntry.set_visibility(False)
            table.attach(passwordEntry, 2, 3, row, row+1)
            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("")
开发者ID:curtisstpierre,项目名称:seng310,代码行数:70,代码来源:Settings_GTK.py


注:本文中的Settings.Settings.getSettingNameForUsingUploaderPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。