diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-02 16:41:23 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-10-03 10:14:50 -0300 |
commit | 40161f730310d18756123e53ea29f724eea59730 (patch) | |
tree | c21bbe1e7c781579065eba82e86f4d7875034ad7 /src/leap/bitmask/gui | |
parent | d4192fce8317372869005ce2b5c455d10763e058 (diff) |
Separate pre-seeded providers from user added ones
Diffstat (limited to 'src/leap/bitmask/gui')
-rw-r--r-- | src/leap/bitmask/gui/wizard.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index 7cff742e..219270c7 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -20,6 +20,7 @@ First run wizard import os import logging import json +import random from functools import partial @@ -146,10 +147,33 @@ class Wizard(QtGui.QWizard): self.ui.label_12.setVisible(False) self.ui.lblProviderPolicy.setVisible(False) - # Load configured providers into wizard + self._load_configured_providers() + + def _load_configured_providers(self): + """ + Loads the configured providers into the wizard providers combo box. + """ ls = LeapSettings() providers = ls.get_configured_providers() - self.ui.cbProviders.addItems(providers) + 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) def get_domain(self): return self._domain |