1616from core_functions .tafaseer import TafaseerManager , Category
1717from utils .universal_speech import UniversalSpeech
1818from utils .const import albayan_documents_dir
19+ from utils .audio_player import SoundEffectPlayer
1920
2021
2122class TafaseerDialog (QDialog ):
@@ -28,6 +29,8 @@ def __init__(self, parent, title, ayah_info, default_category):
2829 self .resize (500 , 400 )
2930 self .tafaseer_manager = TafaseerManager ()
3031 self .tafaseer_manager .set (Category .get_category_by_arabic_name (self .default_category ))
32+ self .effects_manager = SoundEffectPlayer ("Audio/sounds" )
33+ self .effects_manager .play ("open" )
3134
3235
3336 self .layout = QVBoxLayout (self )
@@ -56,7 +59,7 @@ def __init__(self, parent, title, ayah_info, default_category):
5659
5760 self .close_button = QPushButton ("إغلاق" )
5861 self .close_button .setShortcut (QKeySequence ("Ctrl+W" ))
59- self .close_button .clicked .connect (self .close )
62+ self .close_button .clicked .connect (self .reject )
6063 self .button_layout .addWidget (self .close_button )
6164
6265 self .layout .addLayout (self .button_layout )
@@ -90,13 +93,14 @@ def handle_category_selection(self):
9093 self .tafaseer_manager .set (Category .get_category_by_arabic_name (selected_category ))
9194 self .text_edit .setText (self .tafaseer_manager .get_tafaseer (self .ayah_info [0 ], self .ayah_info [1 ]))
9295 self .text_edit .setFocus ()
96+ self .effects_manager .play ("change" )
9397
9498 def copy_content (self ):
9599 copied_content = self .text_edit .toPlainText ()
96100 clipboard = QApplication .clipboard ()
97101 clipboard .setText (copied_content )
98102 UniversalSpeech .say ("تم نسخ التفسير." )
99-
103+ self . effects_manager . play ( "copy" )
100104 def save_content (self ):
101105
102106 file_name = os .path .join (albayan_documents_dir , self .windowTitle ())
@@ -108,3 +112,7 @@ def save_content(self):
108112 if file_path :
109113 with open (file_path , "w" ) as file :
110114 file .write (self .text_edit .toPlainText ())
115+
116+ def reject (self ):
117+ self .effects_manager .play ("clos" )
118+ super (). reject ()
0 commit comments