當前位置: 首頁>>代碼示例>>Python>>正文


Python LeapSettings.is_pinned_provider方法代碼示例

本文整理匯總了Python中leap.bitmask.config.leapsettings.LeapSettings.is_pinned_provider方法的典型用法代碼示例。如果您正苦於以下問題:Python LeapSettings.is_pinned_provider方法的具體用法?Python LeapSettings.is_pinned_provider怎麽用?Python LeapSettings.is_pinned_provider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在leap.bitmask.config.leapsettings.LeapSettings的用法示例。


在下文中一共展示了LeapSettings.is_pinned_provider方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _load_configured_providers

# 需要導入模塊: from leap.bitmask.config.leapsettings import LeapSettings [as 別名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import is_pinned_provider [as 別名]
    def _load_configured_providers(self):
        """
        Loads the configured providers into the wizard providers combo box.
        """
        ls = LeapSettings()
        providers = ls.get_configured_providers()
        if not providers:
            self.ui.rbExistingProvider.setEnabled(False)
            self.ui.label_8.setEnabled(False)  # 'https://' label
            self.ui.cbProviders.setEnabled(False)
            return

        pinned = []
        user_added = []

        # separate pinned providers from user added ones
        for p in providers:
            if ls.is_pinned_provider(p):
                pinned.append(p)
            else:
                user_added.append(p)

        if user_added:
            self.ui.cbProviders.addItems(user_added)

        if user_added and pinned:
            self.ui.cbProviders.addItem('---')

        if pinned:
            random.shuffle(pinned)  # don't prioritize alphabetically
            self.ui.cbProviders.addItems(pinned)

        # We have configured providers, so by default we select the
        # 'Use existing provider' option.
        self.ui.rbExistingProvider.setChecked(True)
開發者ID:irregulator,項目名稱:bitmask_client,代碼行數:37,代碼來源:wizard.py


注:本文中的leap.bitmask.config.leapsettings.LeapSettings.is_pinned_provider方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。