From 65be69dc67fa29b394555a8d878388b86695025c Mon Sep 17 00:00:00 2001 From: mahmoud atef <109464635+MahmoudAtefFarook@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:43:43 +0200 Subject: [PATCH] Used exception_handler with showing info, tafaseer, search and quick_access dialog. --- ui/quran_interface.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ui/quran_interface.py b/ui/quran_interface.py index e63c2a7..e8773da 100644 --- a/ui/quran_interface.py +++ b/ui/quran_interface.py @@ -213,8 +213,9 @@ def set_text_ctrl_label(self): self.menu_bar.previous_action.setEnabled(back_status) self.toolbar.navigation.reset_position() self.toolbar.set_buttons_status() - - def OnQuickAccess(self): + + @exception_handler(ui_element=QMessageBox) + def OnQuickAccess(self, event): dialog = QuickAccess(self, "الوصول السريع") if not dialog.exec(): return @@ -222,7 +223,8 @@ def OnQuickAccess(self): self.set_text_ctrl_label() self.quran_view.setFocus() - def OnSearch(self): + @exception_handler(ui_element=QMessageBox) + def OnSearch(self, event): search_dialog = SearchDialog(self, "بحث") if search_dialog.exec(): self.set_text_ctrl_label() @@ -235,6 +237,7 @@ def get_current_ayah_info(self) -> list: return ayah_info + @exception_handler(ui_element=QMessageBox) def OnInterpretation(self): selected_category = self.sender().text() @@ -295,15 +298,16 @@ def on_copy_verse(self): UniversalSpeech.say("تم نسخ الآية.") Globals.effects_manager.play("copy") - - def OnSyntax(self): + @exception_handler(ui_element=QMessageBox) + def OnSyntax(self, event): aya_info = self.get_current_ayah_info() title = "إعراب آية رقم {} من {}".format(aya_info[3], aya_info[2]) label = "الإعراب" text = E3rab(aya_info[0], aya_info[1]).text InfoDialog(self, title, label, text).exec() - def OnVerseReasons(self): + @exception_handler(ui_element=QMessageBox) + def OnVerseReasons(self, event): aya_info = self.get_current_ayah_info() title = "أسباب نزول آية رقم {} من {}".format(aya_info[3], aya_info[2]) label = "الأسباب" @@ -314,14 +318,16 @@ def OnVerseReasons(self): else: QMessageBox.information(self, "لا يتوفر معلومات للآية", "للأسف لا يتوفر في الوقت الحالي معلومات لهذه الآية.") - def OnAyahInfo(self): + @exception_handler(ui_element=QMessageBox) + def OnAyahInfo(self, event): aya_info = self.get_current_ayah_info() title = "معلومات آية رقم {} من {}".format(aya_info[3], aya_info[2]) label = "معلومات الآية:" text = AyaInfo(aya_info[1]).text InfoDialog(self, title, label, text, is_html_content=True).exec() - - def OnSaveBookmark(self): + + @exception_handler(ui_element=QMessageBox) + def OnSaveBookmark(self, event): bookmark_manager= BookmarkManager() aya_info = self.get_current_ayah_info()