Handle invalid hinting modes/targets
This commit is contained in:
parent
ae0966a384
commit
615a2e0bb5
@ -334,10 +334,14 @@ class HintManager(QObject):
|
|||||||
Emit:
|
Emit:
|
||||||
hint_strings_updated: Emitted to update keypraser.
|
hint_strings_updated: Emitted to update keypraser.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
elems = frame.findAllElements(webelem.SELECTORS[mode])
|
||||||
|
except KeyError:
|
||||||
|
message.error("Hinting mode '{}' does not exist!".format(mode))
|
||||||
|
return
|
||||||
self._target = target
|
self._target = target
|
||||||
self._baseurl = baseurl
|
self._baseurl = baseurl
|
||||||
self._frame = frame
|
self._frame = frame
|
||||||
elems = frame.findAllElements(webelem.SELECTORS[mode])
|
|
||||||
filterfunc = webelem.FILTERS.get(mode, lambda e: True)
|
filterfunc = webelem.FILTERS.get(mode, lambda e: True)
|
||||||
visible_elems = []
|
visible_elems = []
|
||||||
for e in elems:
|
for e in elems:
|
||||||
@ -357,7 +361,11 @@ class HintManager(QObject):
|
|||||||
'cmd_bgtab': "Set hint in commandline as background tab...",
|
'cmd_bgtab': "Set hint in commandline as background tab...",
|
||||||
'rapid': "Follow hint (rapid mode)...",
|
'rapid': "Follow hint (rapid mode)...",
|
||||||
}
|
}
|
||||||
message.text(texts[target])
|
try:
|
||||||
|
message.text(texts[target])
|
||||||
|
except KeyError:
|
||||||
|
message.error("Hinting target '{}' does not exist!".format(target))
|
||||||
|
return
|
||||||
strings = self._hint_strings(visible_elems)
|
strings = self._hint_strings(visible_elems)
|
||||||
for e, string in zip(visible_elems, strings):
|
for e, string in zip(visible_elems, strings):
|
||||||
label = self._draw_label(e, string)
|
label = self._draw_label(e, string)
|
||||||
|
Loading…
Reference in New Issue
Block a user