add dictionary config value and fix wrong variable
This commit is contained in:
parent
351420310d
commit
38803375f5
@ -25,6 +25,7 @@ import functools
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
|
||||
from PyQt5.QtCore import (pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl,
|
||||
QTimer)
|
||||
@ -159,7 +160,7 @@ class HintManager(QObject):
|
||||
|
||||
def _initialize_word_hints(self):
|
||||
if not self._words:
|
||||
with open("/usr/share/dict/words") as wordfile:
|
||||
with open(config.get("hints", "dictionary")) as wordfile:
|
||||
alphabet = set(string.ascii_lowercase)
|
||||
hints = set()
|
||||
lines = (line.rstrip().lower() for line in wordfile)
|
||||
@ -280,7 +281,7 @@ class HintManager(QObject):
|
||||
new = filter(bool, new)
|
||||
new = filter(lambda h: len(h) > 4, new)
|
||||
new = filter(lambda h: not any_prefix(h, existing), new)
|
||||
return next(hint, None) # either the first good, or None
|
||||
return next(new, None) # either the first good, or None
|
||||
|
||||
hints = []
|
||||
used_hints = set()
|
||||
|
@ -863,7 +863,8 @@ def data(readonly=False):
|
||||
valid_values=typ.ValidValues(
|
||||
('number', "Use numeric hints."),
|
||||
('letter', "Use the chars in the hints -> "
|
||||
"chars setting.")
|
||||
"chars setting."),
|
||||
('word', "Use hints words based on the html elements and the extra words."),
|
||||
)), 'letter'),
|
||||
"Mode to use for hints."),
|
||||
|
||||
@ -888,6 +889,10 @@ def data(readonly=False):
|
||||
SettingValue(typ.Bool(), 'false'),
|
||||
"Make chars in hint strings uppercase."),
|
||||
|
||||
('dictionary',
|
||||
SettingValue(typ.File(), '/usr/share/dict/words'),
|
||||
"The dictionary file to be used by the word hints."),
|
||||
|
||||
('auto-follow',
|
||||
SettingValue(typ.Bool(), 'true'),
|
||||
"Whether to auto-follow a hint if there's only one left."),
|
||||
|
Loading…
Reference in New Issue
Block a user