def main(): sw = StackWindow("Show Exception Stack", 600, 400) handler = sw Thread.setDefaultUncaughtExceptionHandler(handler) System.setOut(sw.printStream) System.setErr(sw.printStream) swing.UIManager.setLookAndFeel( swing.UIManager.getSystemLookAndFeelClassName()) frm = FrmMain(current_folder) frm.visible = True editor_app = frm plotjy.jyplot.figure_parent = editor_app.getFigureDock() #print plotjy.jyplot.figure_parent interp = frm.getConsoleDockable().getInterpreter() interp.getSystemState().path = sys.path interp.exec('import plotjy')
def setDefaultExceptionHandler(func): """ Sets the default handler for uncaught exceptions for all threads. A value of ``None`` removes the default handler. The handler is called with two arguments: the java.lang.Thread object and the exception instance. """ if func is None: handler = None else: argspec = inspect.getargspec(func) min_args = 3 if isinstance(func, MethodType) else 2 if len(argspec.args) < min_args and not argspec.varargs: raise TypeError('The handler must accept at least two positional arguments') handler = PythonUncaughtExceptionHandler(func) Thread.setDefaultUncaughtExceptionHandler(handler)
def setDefaultExceptionHandler(func): """ Sets the default handler for uncaught exceptions for all threads. A value of ``None`` removes the default handler. The handler is called with two arguments: the java.lang.Thread object and the exception instance. """ if func is None: handler = None else: argspec = inspect.getargspec(func) min_args = 3 if isinstance(func, MethodType) else 2 if len(argspec.args) < min_args and not argspec.varargs: raise TypeError( 'The handler must accept at least two positional arguments') handler = PythonUncaughtExceptionHandler(func) Thread.setDefaultUncaughtExceptionHandler(handler)