Prefer looping over flags over exhaustive listing

This commit is contained in:
RumovZ 2021-05-19 19:26:39 +02:00
parent b5fa7923e6
commit f960299345

View File

@ -450,7 +450,7 @@ class Reviewer:
def _shortcutKeys( def _shortcutKeys(
self, self,
) -> List[Union[Tuple[str, Callable], Tuple[Qt.Key, Callable]]]: ) -> Sequence[Union[Tuple[str, Callable], Tuple[Qt.Key, Callable]]]:
return [ return [
("e", self.mw.onEditCurrent), ("e", self.mw.onEditCurrent),
(" ", self.onEnterKey), (" ", self.onEnterKey),
@ -459,10 +459,10 @@ class Reviewer:
("m", self.showContextMenu), ("m", self.showContextMenu),
("r", self.replayAudio), ("r", self.replayAudio),
(Qt.Key_F5, self.replayAudio), (Qt.Key_F5, self.replayAudio),
("Ctrl+1", lambda: self.set_flag_on_current_card(1)), *(
("Ctrl+2", lambda: self.set_flag_on_current_card(2)), (f"Ctrl+{flag.index}", self.set_flag_func(flag.index))
("Ctrl+3", lambda: self.set_flag_on_current_card(3)), for flag in load_flags(self.mw.col)
("Ctrl+4", lambda: self.set_flag_on_current_card(4)), ),
("*", self.toggle_mark_on_current_note), ("*", self.toggle_mark_on_current_note),
("=", self.bury_current_note), ("=", self.bury_current_note),
("-", self.bury_current_card), ("-", self.bury_current_card),