Skip to content

Commit

Permalink
Used exception_handler with showing info, tafaseer, search and quick_…
Browse files Browse the repository at this point in the history
…access dialog.
  • Loading branch information
MahmoudAtef999 committed Dec 10, 2024
1 parent e6e7180 commit 65be69d
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions ui/quran_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,18 @@ 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

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()
Expand All @@ -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()
Expand Down Expand Up @@ -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 = "الأسباب"
Expand All @@ -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()
Expand Down

0 comments on commit 65be69d

Please sign in to comment.