@@ -201,26 +201,44 @@ def disable_focus(self):
201201 def setup_shortcuts (self , disable = False ,):
202202
203203 shortcuts = {
204- self .menubar .play_pause_action : ["Space" , "K" ],
205- self .menubar .forward_action : ["Right" , "L" ],
206- self .menubar .rewind_action : ["Left" , "J" ],
207- self .menubar .replay_action : "Home" ,
208- self .menubar .up_volume_action : "Up" ,
209- self .menubar .down_volume_action : "Down" ,
210- self .menubar .previous_surah_action : "Ctrl+Left" ,
211- self .menubar .next_surah_action : "Ctrl+Right" ,
212- self .menubar .next_reciter_action : "Ctrl+Down" ,
213- self .menubar .previous_reciter_action : "Ctrl+Up" ,
214- self .menubar .stop_action : "S" ,
215- self .menubar .close_window_action : ["Ctrl+W" , "Ctrl+F4" ],
216- self .menubar .close_program_action : "Ctrl+X" ,
217- }
204+ self .menubar .play_pause_action : ["Space" , "K" ],
205+ self .menubar .forward_action : ["Right" , "L" ],
206+ self .menubar .rewind_action : ["Left" , "J" ],
207+ self .menubar .replay_action : ["Home" ], # Wrapped in a list for consistency
208+ self .menubar .up_volume_action : ["Up" ],
209+ self .menubar .down_volume_action : ["Down" ],
210+ self .menubar .previous_surah_action : ["Alt+Left" ],
211+ self .menubar .next_surah_action : ["Alt+Right" ],
212+ self .menubar .next_reciter_action : ["Alt+Down" ],
213+ self .menubar .previous_reciter_action : ["Alt+Up" ],
214+ self .menubar .stop_action : ["S" ],
215+ self .menubar .close_window_action : ["Ctrl+W" , "Ctrl+F4" ],
216+ self .menubar .close_program_action : ["Ctrl+X" ],
217+ }
218+
218219
219220 for widget , key_sequence in shortcuts .items ():
220221 key_sequence = [key_sequence ] if isinstance (key_sequence , str ) else key_sequence
221222 widget .setShortcuts ([QKeySequence (key ) for key in key_sequence ])
222223
223224
225+ # Forward Shortcuts
226+ shift_forward_shortcut = QShortcut (QKeySequence ("Shift+Right" ), self )
227+ shift_forward_shortcut .activated .connect (lambda : self .forward (10 ))
228+ ctrl_forward_shortcut = QShortcut (QKeySequence ("Ctrl+Right" ), self )
229+ ctrl_forward_shortcut .activated .connect (lambda : self .forward (20 ))
230+ shift_ctrl_forward_shortcut = QShortcut (QKeySequence ("Ctrl+Shift+Right" ), self )
231+ shift_ctrl_forward_shortcut .activated .connect (lambda : self .forward (60 ))
232+
233+ # Rewind Shortcuts
234+ shift_rewind_shortcut = QShortcut (QKeySequence ("Shift+Left" ), self )
235+ shift_rewind_shortcut .activated .connect (lambda : self .rewind (10 ))
236+ ctrl_rewind_shortcut = QShortcut (QKeySequence ("Ctrl+Left" ), self )
237+ ctrl_rewind_shortcut .activated .connect (lambda : self .rewind (20 ))
238+ shift_ctrl_rewind_shortcut = QShortcut (QKeySequence ("Ctrl+Shift+Left" ), self )
239+ shift_ctrl_rewind_shortcut .activated .connect (lambda : self .rewind (60 ))
240+
241+
224242
225243 def update_current_reciter (self ):
226244 reciter_id = self .reciter_combo .currentData ()
@@ -263,10 +281,10 @@ def play_current_surah(self):
263281 def stop (self ):
264282 self .player .stop ()
265283
266- def forward (self , step = 10 ):
284+ def forward (self , step = 5 ):
267285 self .player .forward (step )
268286
269- def rewind (self , step = 10 ):
287+ def rewind (self , step = 5 ):
270288 self .player .rewind (step )
271289
272290 def set_position (self , position : int , by_percent : bool = False ) -> None :
@@ -409,6 +427,15 @@ def keyPressEvent(self, event: QKeyEvent):
409427 ord ("V" ): lambda : UniversalSpeech .say (self .surah_combo .currentText ()),
410428 ord ("I" ): lambda : UniversalSpeech .say (F"{ self .surah_combo .currentText ()} , { self .reciter_combo .currentText ()} " ),
411429 Qt .Key .Key_1 : lambda : self .set_position (10 , by_percent = True ),
430+ Qt .Key .Key_2 : lambda : self .set_position (20 , by_percent = True ),
431+ Qt .Key .Key_3 : lambda : self .set_position (30 , by_percent = True ),
432+ Qt .Key .Key_4 : lambda : self .set_position (40 , by_percent = True ),
433+ Qt .Key .Key_5 : lambda : self .set_position (50 , by_percent = True ),
434+ Qt .Key .Key_6 : lambda : self .set_position (60 , by_percent = True ),
435+ Qt .Key .Key_7 : lambda : self .set_position (70 , by_percent = True ),
436+ Qt .Key .Key_8 : lambda : self .set_position (80 , by_percent = True ),
437+ Qt .Key .Key_9 : lambda : self .set_position (90 , by_percent = True ),
438+ Qt .Key .Key_0 : lambda : self .set_position (0 , by_percent = True ),
412439 }
413440
414441 key_native = event .nativeVirtualKey ()
0 commit comments