word hints should be generated on first call
This commit is contained in:
parent
49e6b656f6
commit
3be81ba62a
@ -138,9 +138,6 @@ class HintManager(QObject):
|
||||
Target.spawn: "Spawn command via hint",
|
||||
}
|
||||
|
||||
with open(os.path.join(standarddir.config(), "hints")) as hintfile:
|
||||
HINT_WORDS = [hint.rstrip() for hint in hintfile]
|
||||
|
||||
mouse_event = pyqtSignal('QMouseEvent')
|
||||
start_hinting = pyqtSignal(usertypes.ClickTarget)
|
||||
stop_hinting = pyqtSignal()
|
||||
@ -155,6 +152,12 @@ class HintManager(QObject):
|
||||
window=win_id)
|
||||
mode_manager.left.connect(self.on_mode_left)
|
||||
|
||||
def _get_word_hints(self, words=[]):
|
||||
if not words:
|
||||
with open(os.path.join(standarddir.config(), "hints")) as hintfile:
|
||||
words.extend(hint.rstrip() for hint in hintfile)
|
||||
return words
|
||||
|
||||
def _get_text(self):
|
||||
"""Get a hint text based on the current context."""
|
||||
text = self.HINT_TEXTS[self._context.target]
|
||||
@ -204,7 +207,7 @@ class HintManager(QObject):
|
||||
A list of hint strings, in the same order as the elements.
|
||||
"""
|
||||
if config.get('hints', 'mode') == 'words':
|
||||
return HINT_WORDS[:len(elems)]
|
||||
return self._get_word_hints()[:len(elems)]
|
||||
if config.get('hints', 'mode') == 'number':
|
||||
chars = '0123456789'
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user