@@ -211,7 +211,7 @@ def setup_shortcuts(self, disable=False,):
211211 self .menubar .next_surah_action : ["Alt+Right" ],
212212 self .menubar .next_reciter_action : ["Alt+Down" ],
213213 self .menubar .previous_reciter_action : ["Alt+Up" ],
214- self .menubar .stop_action : ["S" ],
214+ self .menubar .stop_action : ["S" , "Ctrl+Space" ],
215215 self .menubar .close_window_action : ["Ctrl+W" , "Ctrl+F4" ],
216216 self .menubar .close_program_action : ["Ctrl+X" ],
217217 }
@@ -222,21 +222,21 @@ def setup_shortcuts(self, disable=False,):
222222 widget .setShortcuts ([QKeySequence (key ) for key in key_sequence ])
223223
224224
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 ))
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))
232232
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 ))
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))
240240
241241
242242
@@ -412,10 +412,32 @@ def OnFilteredItemsUpdated(self, widget: QComboBox, items: List[Item], selected_
412412 UniversalSpeech .say (f"{ widget .currentText ()} { widget .currentIndex () + 1 } من { widget .count ()} " , False )
413413
414414 def keyPressEvent (self , event : QKeyEvent ):
415-
416415 if self .filter_manager .handle_key_press (event ):
417416 return
418417
418+ if event .key () == Qt .Key_Left :
419+ if event .modifiers () & (Qt .ControlModifier | Qt .ShiftModifier ):
420+ self .rewind (60 )
421+ elif event .modifiers () & Qt .ShiftModifier :
422+ self .rewind (10 )
423+ elif event .modifiers () & Qt .ControlModifier :
424+ self .rewind (20 )
425+
426+ elif event .key () == Qt .Key_Right :
427+ if event .modifiers () & (Qt .ControlModifier | Qt .ShiftModifier ):
428+ self .forward (60 )
429+ elif event .modifiers () & Qt .ShiftModifier :
430+ self .forward (10 )
431+ elif event .modifiers () & Qt .ControlModifier :
432+ self .forward (20 )
433+
434+ else :
435+ super ().keyPressEvent (event )
436+
437+
438+
439+
440+
419441 if event .modifiers () & (Qt .ControlModifier | Qt .ShiftModifier | Qt .AltModifier ):
420442 return
421443
@@ -436,6 +458,10 @@ def keyPressEvent(self, event: QKeyEvent):
436458 Qt .Key .Key_8 : lambda : self .set_position (80 , by_percent = True ),
437459 Qt .Key .Key_9 : lambda : self .set_position (90 , by_percent = True ),
438460 Qt .Key .Key_0 : lambda : self .set_position (0 , by_percent = True ),
461+ Qt .Key_MediaTogglePlayPause : lambda : self .toggle_play_pause (),
462+ Qt .Key_MediaStop : lambda : self .stop (),
463+ Qt .Key_MediaPrevious : lambda : self .previous_surah (),
464+ Qt .Key_MediaNext : lambda : self .next_surah (),
439465 }
440466
441467 key_native = event .nativeVirtualKey ()
0 commit comments