Krita Source Code Documentation
Loading...
Searching...
No Matches
krita.excepthook Namespace Reference

Classes

class  ExceptHookDialog
 

Functions

 install ()
 
 on_error (exc_type, exc_obj, exc_tb)
 
 show_current_error (title=None)
 
 uninstall ()
 

Variables

 app = QApplication(sys.argv)
 
int fail = 1 / 0
 
int fail2 = 1 / 0
 

Detailed Description

Exception hook
If some unexpected error occurs it can be shown in a nice looking dialog.
Especially useful is the traceback view.

Things to extend: Clicking on the filename should open an editor.
Things to consider: Mail exceptions, copy to clipboard or send to bug tracker.

Function Documentation

◆ install()

krita.excepthook.install ( )

Definition at line 46 of file excepthook.py.

46def install():
47 "activates the error handler"
48 sys.excepthook = on_error
49
50

◆ on_error()

krita.excepthook.on_error ( exc_type,
exc_obj,
exc_tb )
This is the callback function for sys.excepthook

Definition at line 27 of file excepthook.py.

27def on_error(exc_type, exc_obj, exc_tb):
28 """
29 This is the callback function for sys.excepthook
30 """
31 dlg = ExceptHookDialog(exc_type, exc_obj, exc_tb)
32 dlg.show()
33 dlg.exec()
34
35

◆ show_current_error()

krita.excepthook.show_current_error ( title = None)
Call this function to show the current error.
It can be used inside an except-block.

Definition at line 36 of file excepthook.py.

36def show_current_error(title=None):
37 """
38 Call this function to show the current error.
39 It can be used inside an except-block.
40 """
41 dlg = ExceptHookDialog(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2], title)
42 dlg.show()
43 dlg.exec()
44
45

◆ uninstall()

krita.excepthook.uninstall ( )

Definition at line 51 of file excepthook.py.

51def uninstall():
52 "removes the error handler"
53 sys.excepthook = sys.__excepthook__
54

Variable Documentation

◆ app

krita.excepthook.app = QApplication(sys.argv)

Definition at line 79 of file excepthook.py.

◆ fail

int krita.excepthook.fail = 1 / 0

Definition at line 83 of file excepthook.py.

◆ fail2

int krita.excepthook.fail2 = 1 / 0

Definition at line 87 of file excepthook.py.