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


Python LeapSettings.get_configured_providers方法代码示例

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


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

示例1: LeapSettingsTest

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [as 别名]
class LeapSettingsTest(BaseLeapTest):
    """Tests for LeapSettings"""

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_get_configured_providers(self):
        """
        Test that the config file IS NOT stored under the CWD.
        """
        self._leapsettings = LeapSettings()
        with mock.patch('os.listdir') as os_listdir:
            # use this method only to spy where LeapSettings is looking for
            self._leapsettings.get_configured_providers()
            args, kwargs = os_listdir.call_args
            config_dir = args[0]
            self.assertFalse(config_dir.startswith(os.getcwd()))
            self.assertFalse(config_dir.endswith('config'))

    def test_get_configured_providers_in_bundle(self):
        """
        Test that the config file IS stored under the CWD.
        """
        self._leapsettings = LeapSettings(standalone=True)
        with mock.patch('os.listdir') as os_listdir:
            # use this method only to spy where LeapSettings is looking for
            self._leapsettings.get_configured_providers()
            args, kwargs = os_listdir.call_args
            config_dir = args[0]
            self.assertTrue(config_dir.startswith(os.getcwd()))
            self.assertFalse(config_dir.endswith('config'))
开发者ID:KwadroNaut,项目名称:bitmask_client,代码行数:36,代码来源:test_leapsettings.py

示例2: _load_configured_providers

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [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

示例3: _load_configured_providers_with_pinned

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [as 别名]
    def _load_configured_providers_with_pinned(self, pinned):
        """
        Once we have the pinned providers from the backend, we
        continue setting everything up

        :param pinned: list of pinned providers
        :type pinned: list of str
        """
        ls = LeapSettings()
        providers = ls.get_configured_providers()
        if not providers and not pinned:
            self.ui.rbExistingProvider.setEnabled(False)
            self.ui.label_8.setEnabled(False)  # 'https://' label
            self.ui.cbProviders.setEnabled(False)
            return

        user_added = []

        # separate pinned providers from user added ones
        for p in providers:
            if p not in pinned:
                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)

        # We need to set it as complete explicitly
        self.page(self.INTRO_PAGE).set_completed()
开发者ID:meskio,项目名称:bitmask_client,代码行数:41,代码来源:wizard.py

示例4: PreferencesWindow

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [as 别名]
class PreferencesWindow(QtGui.QDialog):
    """
    Window that displays the preferences.
    """
    def __init__(self, parent, srp_auth):
        """
        :param parent: parent object of the PreferencesWindow.
        :parent type: QWidget
        :param srp_auth: SRPAuth object configured in the main app.
        :type srp_auth: SRPAuth
        """
        QtGui.QDialog.__init__(self, parent)
        self.AUTOMATIC_GATEWAY_LABEL = self.tr("Automatic")

        self._srp_auth = srp_auth
        self._settings = LeapSettings()
        self._soledad = None

        # Load UI
        self.ui = Ui_Preferences()
        self.ui.setupUi(self)
        self.ui.lblPasswordChangeStatus.setVisible(False)
        self.ui.lblProvidersServicesStatus.setVisible(False)
        self.ui.lblProvidersGatewayStatus.setVisible(False)

        self._selected_services = set()

        # Connections
        self.ui.pbChangePassword.clicked.connect(self._change_password)
        self.ui.cbProvidersServices.currentIndexChanged[unicode].connect(
            self._populate_services)
        self.ui.cbProvidersGateway.currentIndexChanged[unicode].connect(
            self._populate_gateways)

        self.ui.cbGateways.currentIndexChanged[unicode].connect(
            lambda x: self.ui.lblProvidersGatewayStatus.setVisible(False))

        if not self._settings.get_configured_providers():
            self.ui.gbEnabledServices.setEnabled(False)
        else:
            self._add_configured_providers()

    def set_soledad_ready(self, soledad):
        """
        SLOT
        TRIGGERS:
            parent.soledad_ready

        It sets the soledad object as ready to use.

        :param soledad: Soledad object configured in the main app.
        :type soledad: Soledad
        """
        self._soledad = soledad
        self.ui.gbPasswordChange.setEnabled(True)

    def _set_password_change_status(self, status, error=False, success=False):
        """
        Sets the status label for the password change.

        :param status: status message to display, can be HTML
        :type status: str
        """
        if error:
            status = "<font color='red'><b>%s</b></font>" % (status,)
        elif success:
            status = "<font color='green'><b>%s</b></font>" % (status,)

        self.ui.lblPasswordChangeStatus.setVisible(True)
        self.ui.lblPasswordChangeStatus.setText(status)

    def _set_changing_password(self, disable):
        """
        Enables or disables the widgets in the password change group box.

        :param disable: True if the widgets should be disabled and
                        it displays the status label that shows that is
                        changing the password.
                        False if they should be enabled.
        :type disable: bool
        """
        if disable:
            self._set_password_change_status(self.tr("Changing password..."))

        self.ui.leCurrentPassword.setEnabled(not disable)
        self.ui.leNewPassword.setEnabled(not disable)
        self.ui.leNewPassword2.setEnabled(not disable)
        self.ui.pbChangePassword.setEnabled(not disable)

    def _change_password(self):
        """
        SLOT
        TRIGGERS:
            self.ui.pbChangePassword.clicked

        Changes the user's password if the inputboxes are correctly filled.
        """
        username = self._srp_auth.get_username()
        current_password = self.ui.leCurrentPassword.text()
        new_password = self.ui.leNewPassword.text()
#.........这里部分代码省略.........
开发者ID:micah,项目名称:bitmask_client,代码行数:103,代码来源:preferenceswindow.py

示例5: PreferencesWindow

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [as 别名]
class PreferencesWindow(QtGui.QDialog):
    """
    Window that displays the preferences.
    """
    preferences_saved = QtCore.Signal()

    def __init__(self, parent, username, domain, backend, soledad_started, mx,
                 leap_signaler):
        """
        :param parent: parent object of the PreferencesWindow.
        :parent type: QWidget
        :param username: the user set in the login widget
        :type username: unicode
        :param domain: the selected domain in the login widget
        :type domain: unicode
        :param backend: Backend being used
        :type backend: Backend
        :param soledad_started: whether soledad has started or not
        :type soledad_started: bool
        :param mx: whether the current provider provides mx or not.
        :type mx: bool
        """
        QtGui.QDialog.__init__(self, parent)
        self.AUTOMATIC_GATEWAY_LABEL = self.tr("Automatic")

        self._username = username
        self._domain = domain
        self._leap_signaler = leap_signaler
        self._backend = backend
        self._soledad_started = soledad_started
        self._mx_provided = mx

        self._settings = LeapSettings()
        self._backend_connect()

        # Load UI
        self.ui = Ui_Preferences()
        self.ui.setupUi(self)
        self.ui.lblPasswordChangeStatus.setVisible(False)
        self.ui.lblProvidersServicesStatus.setVisible(False)

        self._selected_services = set()

        # Connections
        self.ui.pbChangePassword.clicked.connect(self._change_password)
        self.ui.cbProvidersServices.currentIndexChanged[unicode].connect(
            self._populate_services)

        if not self._settings.get_configured_providers():
            self.ui.gbEnabledServices.setEnabled(False)
        else:
            self._add_configured_providers()

        if self._username is None:
            self._not_logged_in()
        else:
            self.ui.gbPasswordChange.setEnabled(True)
            if self._mx_provided:
                self._provides_mx()

        self._select_provider_by_name(domain)

    def _not_logged_in(self):
        """
        Actions to perform if the user is not logged in.
        """
        msg = self.tr(
            "In order to change your password you need to be logged in.")
        self._set_password_change_status(msg)
        self.ui.gbPasswordChange.setEnabled(False)

    def _provides_mx(self):
        """
        Actions to perform if the provider provides MX.
        """
        pw_enabled = True
        enabled_services = self._settings.get_enabled_services(self._domain)
        mx_name = get_service_display_name(MX_SERVICE)

        if MX_SERVICE not in enabled_services:
            msg = self.tr("You need to enable {0} in order to change "
                          "the password.".format(mx_name))
            self._set_password_change_status(msg, error=True)
            pw_enabled = False
        else:
            # check if Soledad is bootstrapped
            if not self._soledad_started:
                msg = self.tr(
                    "You need to wait until {0} is ready in "
                    "order to change the password.".format(mx_name))
                self._set_password_change_status(msg)
                pw_enabled = False

        self.ui.gbPasswordChange.setEnabled(pw_enabled)

    @QtCore.Slot()
    def set_soledad_ready(self):
        """
        TRIGGERS:
            parent.soledad_ready
#.........这里部分代码省略.........
开发者ID:bwagnerr,项目名称:bitmask_client,代码行数:103,代码来源:preferenceswindow.py

示例6: EIPPreferencesWindow

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [as 别名]
class EIPPreferencesWindow(QtGui.QDialog):
    """
    Window that displays the EIP preferences.
    """
    def __init__(self, parent):
        """
        :param parent: parent object of the EIPPreferencesWindow.
        :parent type: QWidget
        """
        QtGui.QDialog.__init__(self, parent)
        self.AUTOMATIC_GATEWAY_LABEL = self.tr("Automatic")

        self._settings = LeapSettings()

        # Load UI
        self.ui = Ui_EIPPreferences()
        self.ui.setupUi(self)
        self.ui.lblProvidersGatewayStatus.setVisible(False)
        self.ui.lblAutoStartEIPStatus.setVisible(False)

        # Connections
        self.ui.cbProvidersGateway.currentIndexChanged[unicode].connect(
            self._populate_gateways)

        self.ui.cbGateways.currentIndexChanged[unicode].connect(
            lambda x: self.ui.lblProvidersGatewayStatus.setVisible(False))

        self.ui.cbProvidersEIP.currentIndexChanged[unicode].connect(
            lambda x: self.ui.lblAutoStartEIPStatus.setVisible(False))

        self.ui.cbAutoStartEIP.toggled.connect(
            lambda x: self.ui.lblAutoStartEIPStatus.setVisible(False))

        self.ui.pbSaveAutoStartEIP.clicked.connect(self._save_auto_start_eip)

        self._add_configured_providers()

        # Load auto start EIP settings
        self.ui.cbAutoStartEIP.setChecked(self._settings.get_autostart_eip())
        default_provider = self._settings.get_defaultprovider()
        idx = self.ui.cbProvidersEIP.findText(default_provider)
        self.ui.cbProvidersEIP.setCurrentIndex(idx)

    def _save_auto_start_eip(self):
        """
        SLOT
        TRIGGER:
            self.ui.cbAutoStartEIP.toggled

        Saves the automatic start of EIP user preference.
        """
        default_provider = self.ui.cbProvidersEIP.currentText()
        enabled = self.ui.cbAutoStartEIP.isChecked()

        self._settings.set_autostart_eip(enabled)
        self._settings.set_defaultprovider(default_provider)

        self.ui.lblAutoStartEIPStatus.show()
        logger.debug('Auto start EIP saved: {0} {1}.'.format(
            default_provider, enabled))

    def _set_providers_gateway_status(self, status, success=False,
                                      error=False):
        """
        Sets the status label for the gateway change.

        :param status: status message to display, can be HTML
        :type status: str
        :param success: is set to True if we should display the
                        message as green
        :type success: bool
        :param error: is set to True if we should display the
                        message as red
        :type error: bool
        """
        if success:
            status = "<font color='green'><b>%s</b></font>" % (status,)
        elif error:
            status = "<font color='red'><b>%s</b></font>" % (status,)

        self.ui.lblProvidersGatewayStatus.setVisible(True)
        self.ui.lblProvidersGatewayStatus.setText(status)

    def _add_configured_providers(self):
        """
        Add the client's configured providers to the providers combo boxes.
        """
        self.ui.cbProvidersGateway.clear()
        self.ui.cbProvidersEIP.clear()
        providers = self._settings.get_configured_providers()
        if not providers:
            self.ui.gbAutomaticEIP.setEnabled(False)
            self.ui.gbGatewaySelector.setEnabled(False)
            return

        for provider in providers:
            self.ui.cbProvidersGateway.addItem(provider)
            self.ui.cbProvidersEIP.addItem(provider)

    def _save_selected_gateway(self, provider):
#.........这里部分代码省略.........
开发者ID:bneg,项目名称:bitmask_client,代码行数:103,代码来源:eip_preferenceswindow.py

示例7: EIPPreferencesWindow

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [as 别名]
class EIPPreferencesWindow(QtGui.QDialog):
    """
    Window that displays the EIP preferences.
    """
    def __init__(self, parent, domain, backend, leap_signaler):
        """
        :param parent: parent object of the EIPPreferencesWindow.
        :type parent: QWidget
        :param domain: the selected by default domain.
        :type domain: unicode
        :param backend: Backend being used
        :type backend: Backend
        """
        QtGui.QDialog.__init__(self, parent)
        self.AUTOMATIC_GATEWAY_LABEL = self.tr("Automatic")

        self._settings = LeapSettings()
        self._leap_signaler = leap_signaler
        self._backend = backend

        # Load UI
        self.ui = Ui_EIPPreferences()
        self.ui.setupUi(self)
        self.ui.lblProvidersGatewayStatus.setVisible(False)

        # Connections
        self.ui.cbProvidersGateway.currentIndexChanged[int].connect(
            self._populate_gateways)

        self.ui.cbGateways.currentIndexChanged[unicode].connect(
            lambda x: self.ui.lblProvidersGatewayStatus.setVisible(False))

        self._selected_domain = domain
        self._configured_providers = []

        self._backend_connect()
        self._add_configured_providers()

    def _set_providers_gateway_status(self, status, success=False,
                                      error=False):
        """
        Sets the status label for the gateway change.

        :param status: status message to display, can be HTML
        :type status: str
        :param success: is set to True if we should display the
                        message as green
        :type success: bool
        :param error: is set to True if we should display the
                        message as red
        :type error: bool
        """
        if success:
            status = "<font color='green'><b>%s</b></font>" % (status,)
        elif error:
            status = "<font color='red'><b>%s</b></font>" % (status,)

        self.ui.lblProvidersGatewayStatus.setVisible(True)
        self.ui.lblProvidersGatewayStatus.setText(status)

    def _add_configured_providers(self):
        """
        Add the client's configured providers to the providers combo boxes.
        """
        providers = self._settings.get_configured_providers()
        if not providers:
            return

        self._backend.eip_get_initialized_providers(domains=providers)

    @QtCore.Slot(list)
    def _load_providers_in_combo(self, providers):
        """
        TRIGGERS:
            Signaler.eip_get_initialized_providers

        Add the client's configured providers to the providers combo boxes.

        :param providers: the list of providers to add and whether each one is
                          initialized or not.
        :type providers: list of tuples (str, bool)
        """
        self.ui.cbProvidersGateway.clear()
        if not providers:
            self.ui.gbGatewaySelector.setEnabled(False)
            return

        # block signals so the currentIndexChanged slot doesn't get triggered
        self.ui.cbProvidersGateway.blockSignals(True)
        for provider, is_initialized in providers:
            label = provider
            if not is_initialized:
                label += self.tr(" (uninitialized)")
            self.ui.cbProvidersGateway.addItem(label, userData=provider)
        self.ui.cbProvidersGateway.blockSignals(False)

        # Select provider by name
        domain = self._selected_domain
        if domain is not None:
            provider_index = self.ui.cbProvidersGateway.findText(
#.........这里部分代码省略.........
开发者ID:laborautonomo,项目名称:bitmask_client,代码行数:103,代码来源:eip_preferenceswindow.py

示例8: PreferencesWindow

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [as 别名]
class PreferencesWindow(QtGui.QDialog):
    """
    Window that displays the preferences.
    """
    def __init__(self, parent, srp_auth, provider_config, soledad, domain):
        """
        :param parent: parent object of the PreferencesWindow.
        :parent type: QWidget
        :param srp_auth: SRPAuth object configured in the main app.
        :type srp_auth: SRPAuth
        :param provider_config: ProviderConfig object.
        :type provider_config: ProviderConfig
        :param soledad: Soledad instance
        :type soledad: Soledad
        :param domain: the selected domain in the login widget
        :type domain: unicode
        """
        QtGui.QDialog.__init__(self, parent)
        self.AUTOMATIC_GATEWAY_LABEL = self.tr("Automatic")

        self._srp_auth = srp_auth
        self._settings = LeapSettings()
        self._soledad = soledad

        # Load UI
        self.ui = Ui_Preferences()
        self.ui.setupUi(self)
        self.ui.lblPasswordChangeStatus.setVisible(False)
        self.ui.lblProvidersServicesStatus.setVisible(False)

        self._selected_services = set()

        # Connections
        self.ui.pbChangePassword.clicked.connect(self._change_password)
        self.ui.cbProvidersServices.currentIndexChanged[unicode].connect(
            self._populate_services)

        if not self._settings.get_configured_providers():
            self.ui.gbEnabledServices.setEnabled(False)
        else:
            self._add_configured_providers()

        pw_enabled = False

        # check if the user is logged in
        if srp_auth is not None and srp_auth.get_token() is not None:
            # check if provider has 'mx' ...
            if provider_config.provides_mx():
                enabled_services = self._settings.get_enabled_services(domain)
                mx_name = get_service_display_name(MX_SERVICE)

                # ... and if the user have it enabled
                if MX_SERVICE not in enabled_services:
                    msg = self.tr("You need to enable {0} in order to change "
                                  "the password.".format(mx_name))
                    self._set_password_change_status(msg, error=True)
                else:
                    if sameProxiedObjects(self._soledad, None):
                        msg = self.tr(
                            "You need to wait until {0} is ready in "
                            "order to change the password.".format(mx_name))
                        self._set_password_change_status(msg)
                    else:
                        # Soledad is bootstrapped
                        pw_enabled = True
            else:
                pw_enabled = True
        else:
            msg = self.tr(
                "In order to change your password you need to be logged in.")
            self._set_password_change_status(msg)

        self._select_provider_by_name(domain)

        self.ui.gbPasswordChange.setEnabled(pw_enabled)

    def set_soledad_ready(self):
        """
        SLOT
        TRIGGERS:
            parent.soledad_ready

        It notifies when the soledad object as ready to use.
        """
        self.ui.lblPasswordChangeStatus.setVisible(False)
        self.ui.gbPasswordChange.setEnabled(True)

    def _set_password_change_status(self, status, error=False, success=False):
        """
        Sets the status label for the password change.

        :param status: status message to display, can be HTML
        :type status: str
        """
        if error:
            status = "<font color='red'><b>%s</b></font>" % (status,)
        elif success:
            status = "<font color='green'><b>%s</b></font>" % (status,)

        if not self.ui.gbPasswordChange.isEnabled():
#.........这里部分代码省略.........
开发者ID:abhikandoi2000,项目名称:bitmask_client,代码行数:103,代码来源:preferenceswindow.py

示例9: EIPPreferencesWindow

# 需要导入模块: from leap.bitmask.config.leapsettings import LeapSettings [as 别名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import get_configured_providers [as 别名]
class EIPPreferencesWindow(QtGui.QDialog):
    """
    Window that displays the EIP preferences.
    """
    def __init__(self, parent, domain):
        """
        :param parent: parent object of the EIPPreferencesWindow.
        :type parent: QWidget
        :param domain: the selected by default domain.
        :type domain: unicode
        """
        QtGui.QDialog.__init__(self, parent)
        self.AUTOMATIC_GATEWAY_LABEL = self.tr("Automatic")

        self._settings = LeapSettings()

        # Load UI
        self.ui = Ui_EIPPreferences()
        self.ui.setupUi(self)
        self.ui.lblProvidersGatewayStatus.setVisible(False)

        # Connections
        self.ui.cbProvidersGateway.currentIndexChanged[int].connect(
            self._populate_gateways)

        self.ui.cbGateways.currentIndexChanged[unicode].connect(
            lambda x: self.ui.lblProvidersGatewayStatus.setVisible(False))

        self._add_configured_providers(domain)

    def _set_providers_gateway_status(self, status, success=False,
                                      error=False):
        """
        Sets the status label for the gateway change.

        :param status: status message to display, can be HTML
        :type status: str
        :param success: is set to True if we should display the
                        message as green
        :type success: bool
        :param error: is set to True if we should display the
                        message as red
        :type error: bool
        """
        if success:
            status = "<font color='green'><b>%s</b></font>" % (status,)
        elif error:
            status = "<font color='red'><b>%s</b></font>" % (status,)

        self.ui.lblProvidersGatewayStatus.setVisible(True)
        self.ui.lblProvidersGatewayStatus.setText(status)

    def _add_configured_providers(self, domain=None):
        """
        Add the client's configured providers to the providers combo boxes.

        :param domain: the domain to be selected by default.
        :type domain: unicode
        """
        self.ui.cbProvidersGateway.clear()
        providers = self._settings.get_configured_providers()
        if not providers:
            self.ui.gbGatewaySelector.setEnabled(False)
            return

        for provider in providers:
            label = provider
            eip_config_path = get_eipconfig_path(provider, relative=False)
            if not os.path.isfile(eip_config_path):
                label = provider + self.tr(" (uninitialized)")
            self.ui.cbProvidersGateway.addItem(label, userData=provider)

        # Select provider by name
        if domain is not None:
            provider_index = self.ui.cbProvidersGateway.findText(
                domain, QtCore.Qt.MatchStartsWith)
            self.ui.cbProvidersGateway.setCurrentIndex(provider_index)

    def _save_selected_gateway(self, provider):
        """
        SLOT
        TRIGGERS:
            self.ui.pbSaveGateway.clicked

        Saves the new gateway setting to the configuration file.

        :param provider: the provider config that we need to save.
        :type provider: str
        """
        gateway = self.ui.cbGateways.currentText()

        if gateway == self.AUTOMATIC_GATEWAY_LABEL:
            gateway = self._settings.GATEWAY_AUTOMATIC
        else:
            idx = self.ui.cbGateways.currentIndex()
            gateway = self.ui.cbGateways.itemData(idx)

        self._settings.set_selected_gateway(provider, gateway)

        msg = self.tr(
#.........这里部分代码省略.........
开发者ID:irregulator,项目名称:bitmask_client,代码行数:103,代码来源:eip_preferenceswindow.py


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