예제 #1
0
    def initialize_completer(self):
        if self.seed_type != 'slip39':
            bip39_english_list = Mnemonic('en').wordlist
            old_list = old_mnemonic.wordlist
            only_old_list = set(old_list) - set(bip39_english_list)
            self.wordlist = list(bip39_english_list) + list(
                only_old_list)  # concat both lists
            self.wordlist.sort()

            class CompleterDelegate(QStyledItemDelegate):
                def initStyleOption(self, option, index):
                    super().initStyleOption(option, index)
                    # Some people complained that due to merging the two word lists,
                    # it is difficult to restore from a metal backup, as they planned
                    # to rely on the "4 letter prefixes are unique in bip39 word list" property.
                    # So we color words that are only in old list.
                    if option.text in only_old_list:
                        # yellow bg looks ~ok on both light/dark theme, regardless if (un)selected
                        option.backgroundBrush = ColorScheme.YELLOW.as_color(
                            background=True)

            delegate = CompleterDelegate(self.seed_e)
        else:
            self.wordlist = list(slip39.get_wordlist())
            delegate = None

        self.completer = QCompleter(self.wordlist)
        if delegate:
            self.completer.popup().setItemDelegate(delegate)
        self.seed_e.set_completer(self.completer)
예제 #2
0
 def initialize_completer(self):
     english_list = Mnemonic('en').wordlist
     old_list = electrum_dash.old_mnemonic.words
     self.wordlist = english_list + list(set(old_list) - set(english_list)) #concat both lists
     self.wordlist.sort()
     self.completer = QCompleter(self.wordlist)
     self.seed_e.set_completer(self.completer)
예제 #3
0
 def __init__(self, wizard, **kwargs):
     super(RestoreSeedDialog, self).__init__(wizard, **kwargs)
     self._test = kwargs['test']
     from electrum_dash.mnemonic import Mnemonic
     from electrum_dash.old_mnemonic import words as old_wordlist
     self.words = set(Mnemonic('en').wordlist).union(set(old_wordlist))
     self.ids.text_input_seed.text = test_seed if is_test else ''
     self.message = _('Please type your seed phrase using the virtual keyboard.')
     self.title = _('Enter Seed')
     self.ext = False
예제 #4
0
 def make_seed(self):
     return Mnemonic('english').make_seed(num_bits=256, prefix=SEED_PREFIX)