<div class="gmail_quote">Team,<br>
<br></div><div class="gmail_quote">Wish to have your feedback on the
design aspect of the ticket 2063 (Sugar should bring up an alert when an
unhandled Python exception occurs) - please find the git diff attached
below. This is an attempt to display an alert when an unhandled Python
exception occurs in the journal. Unfortunately, when the exception takes
place in journalactivity.py , I am neither unable to notice the Journal
Icon (it disappears), </div><div class="im">
<div class="gmail_quote"><br><br>
<br>
diff --git a/journalactivity.py b/journalactivity.py<br>
index 44cc018..36a2e2e 100644<br>
--- a/journalactivity.py<br>
+++ b/journalactivity.py<br>
@@ -358,8 +358,20 @@ class JournalActivity(Window):<br>
self.show_main_view()<br>
self.search_grab_focus()<br>
<br>
+ def uncaught_exception_alert(self):<br>
+ alert = ErrorAlert(title="Operation could not be performed", msg="Please check the logviewer activity for details ")<br>
+ alert.connect('response', self.__alert_response_cb)<br>
+ self.add_alert(alert)<br>
+ alert.show()<br>
+<br>
_journal = None<br>
<br>
+def _alert_excepthook(exc_type, exc_value, traceback):<br>
+ logging.exception('Unhandled Python exception: %s', repr((exc_type, exc_value, traceback)))<br>
+ _journal.uncaught_exception_alert() <br>
+<br>
+sys.excepthook = _alert_excepthook<br>
+<br>
def get_journal():<br>
global _journal<br>
if _journal is None:<br>
-- <br>
1.7.0.4</div><div class="gmail_quote"><br></div></div><div class="gmail_quote"><br>
I wish to request you to please review the code and suggest desired changes, if any.<br>
<br>
Moreover, I have two important questions regarding the bug.<br>
<br>
1. To catch all unhandled python exceptions in sugar, where exactly
should we be looking forward to be the venue for adding the
functionality?<div class="im"><br>
Adding it in journalactivity.py doesn't seem to serve all purposes.
It has to be added somewhere which is being used all the time.<br>
<br></div>
2. Wish if you could recommend on the GUI feature that could be used for displaying the alert message to the user.<br>
<br>Looking forward to for your valuable suggestions,<div class="im"><br>
<br>
Regards,<br><font color="#888888">
<br>
Mukul Gupta<br>
Research Engineer,SEETA
</font></div></div><br><br><div class="gmail_quote">On Tue, Oct 12, 2010 at 12:45 AM, Mukul Gupta <span dir="ltr"><<a href="mailto:mukul@seeta.in">mukul@seeta.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote">Team,<br><br></div><div class="gmail_quote">I
had a discussion with Aleksey this morning at IRC on the feedback
recommended yesterday. Thank you Daniel and Tomeu. Appreciate your ideas
and pointers. </div>
<div class="gmail_quote"><br></div><div class="gmail_quote">We
brainstormed on how the implementation of this functionality could be
done, and found that whenever any uncaught exception is raised, the
interpreter calls the sys.excepthook(type,value,traceback). </div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Wish to have
the feedback on whether excepthook implementation would be helpful to
our use-case both short-term and long-term. Also, it would be wonderful
if feedback could be shared on its implementation in the context of
Sugar, or otherwise.</div>
<br>Looking forward to hearing from you.<br><br>Regards,<br><font color="#888888"><font color="#888888"><br>Mukul Gupta</font>
</font></blockquote></div><br>