From 7ad2cd49366d56d68295706fd712ca66b5c10c5d Mon Sep 17 00:00:00 2001 From: Alice Nyaa <62451415+Minnowo@users.noreply.github.com> Date: Sun, 7 Jan 2024 16:08:10 -0500 Subject: [PATCH] Added ctrl+p/n to act as up/down arrow in listbox (#1503) --- hydrus/client/gui/lists/ClientGUIListBoxes.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hydrus/client/gui/lists/ClientGUIListBoxes.py b/hydrus/client/gui/lists/ClientGUIListBoxes.py index 6b492c18..bcf8fdce 100644 --- a/hydrus/client/gui/lists/ClientGUIListBoxes.py +++ b/hydrus/client/gui/lists/ClientGUIListBoxes.py @@ -2005,10 +2005,24 @@ class ListBox( QW.QScrollArea ): elif self._last_hit_logical_index is not None: - if key_code in ( QC.Qt.Key_Up, ): + if ctrl and key_code in ( ord( 'P' ), ord( 'p' ) ): + + # remove ctrl key to make it act exactly like the up arrow + ctrl = False hit_logical_index = ( self._last_hit_logical_index - 1 ) % len( self._ordered_terms ) + + elif ctrl and key_code in ( ord( 'N' ), ord( 'n' ) ): + # remove ctrl key to make it act exactly like the down arrow + ctrl = False + + hit_logical_index = ( self._last_hit_logical_index + 1 ) % len( self._ordered_terms ) + + elif key_code in ( QC.Qt.Key_Up, ): + + hit_logical_index = ( self._last_hit_logical_index - 1 ) % len( self._ordered_terms ) + elif key_code in ( QC.Qt.Key_Down, ): hit_logical_index = ( self._last_hit_logical_index + 1 ) % len( self._ordered_terms )