Changeset 08bf1a42b169043a053781d2d139c0022fc65330


Ignore:
Timestamp:
09/21/11 22:29:31 (8 months ago)
Author:
Luper Rouch <luper.rouch@…>
Children:
5a26cd79d820f0f17613b4556127836ff6cb0c2d
Parents:
769c378f66d18dc35bcdc76339da83552f6404a4
git-committer:
Luper Rouch <luper.rouch@…> (09/21/11 22:29:31)
Message:

tracebacks from other threads are now handled correcly by the bug report dialog

Location:
pyflu/pyflu
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pyflu/pyflu/__init__.py

    r2ea9020 r08bf1a4  
    55 
    66def version(): 
    7     return "0.9.1" 
     7    return "0.9.2" 
    88 
  • pyflu/pyflu/qt/bug_report/__init__.py

    r613c5fb r08bf1a4  
    11import sys 
     2import thread 
     3from PyQt4.QtCore import QObject, pyqtSignal, Qt 
    24from pyflu.qt.bug_report.dialog import BugReportDialog 
    35from pyflu.qt.bug_report.tb import install_ext_editor_url_handler 
     
    68 
    79bug_report_dlg = None 
     10tb_sender = None 
     11 
     12 
     13class TracebackSender(QObject): 
     14    """ 
     15    An intermediary to send tracebacks from other threads. 
     16    """ 
     17 
     18    traceback_sent = pyqtSignal(object, object, object, object) 
    819 
    920 
    1021def excepthook(type, value, tb): 
    11     bug_report_dlg.show() 
    12     bug_report_dlg.add_tb(type, value, tb) 
     22    thread_id = thread.get_ident() 
     23    tb_sender.traceback_sent.emit(thread_id, type, value, tb) 
    1324 
    1425 
     
    2132    errors (for example just after the QApplication has been created). 
    2233    """ 
    23     global bug_report_dlg 
     34    global bug_report_dlg, tb_sender 
    2435    settings.BUG_REPORT_EMAIL = bug_report_email 
    2536    bug_report_dlg = BugReportDialog(parent) 
     37    tb_sender = TracebackSender() 
     38    tb_sender.traceback_sent.connect(bug_report_dlg.add_tb,  
     39            Qt.QueuedConnection) 
    2640    sys.excepthook = excepthook 
    2741    install_ext_editor_url_handler() 
  • pyflu/pyflu/qt/bug_report/dialog.py

    r5d9b893 r08bf1a4  
    3535        self.traceback_text.clear() 
    3636 
    37     def add_tb(self, type, value, tb): 
    38         thread_id = thread.get_ident() 
     37    def add_tb(self, thread_id, type, value, tb): 
     38        if not self.isVisible(): 
     39            self.show() 
    3940        if thread_id == self.main_thread_id and self.main_traceback is None: 
    4041            self.main_traceback = (type, value, tb) 
Note: See TracChangeset for help on using the changeset viewer.