48 PyROOT::TPyROOTApplication::TPyROOTApplication(
49 const
char* acn,
int* argc,
char** argv,
Bool_t ) :
71 ProcessLine(
"((TGWin32 *)gVirtualX)->SetUserThreadId(0);",
kTRUE);
79 Gl_histinit( (
char*)
"-" );
82 SetReturnFromRun(
kTRUE );
93 PyObject* argl = PySys_GetObject( const_cast< char* >(
"argv" ) );
96 if ( argl && 0 < PyList_Size( argl ) ) argc = (int)PyList_GET_SIZE( argl );
97 char** argv =
new char*[ argc ];
98 for (
int i = 1; i < argc; ++i ) {
100 if ( strcmp( argi,
"-" ) == 0 || strcmp( argi,
"--" ) == 0 ) {
107 #if PY_VERSION_HEX < 0x03000000
108 if ( Py_GetProgramName() && strlen( Py_GetProgramName() ) != 0 )
109 argv[ 0 ] = Py_GetProgramName();
111 argv[ 0 ] = (
char*)
"python";
114 argv[ 0 ] = (
char*)
"python";
136 #if PY_VERSION_HEX < 0x03000000
ErrorHandlerFunc_t SetErrorHandler(ErrorHandlerFunc_t newhandler)
Set an errorhandler function. Returns the old handler.
R__EXTERN TStyle * gStyle
R__EXTERN TApplication * gApplication
#define PyROOT_PyUnicode_AsString
static Bool_t InitROOTGlobals()
Setup the basic ROOT globals gBenchmark, gStyle, gProgname, if not already set.
TStyle objects may be created to define special styles.
void ErrMsgHandler(int level, Bool_t abort, const char *location, const char *msg)
Translate ROOT error/warning to python.
R__EXTERN const char * gProgName
R__EXTERN TSystem * gSystem
R__EXTERN TBenchmark * gBenchmark
static Bool_t InitROOTMessageCallback()
Install ROOT message handler which will turn ROOT error message into python exceptions.
This class is a ROOT utility to help benchmarking applications.
TPyROOTApplication(const char *acn, Int_t *argc, char **argv, Bool_t bLoadLibs=kTRUE)
ClassImp(PyROOT::TPyROOTApplication) PyROOT
virtual void SetProgname(const char *name)
Set the application name (from command line, argv[0]) and copy it in gProgName.
void(* ErrorHandlerFunc_t)(int level, Bool_t abort, const char *location, const char *msg)
static Bool_t CreatePyROOTApplication(Bool_t bLoadLibs=kTRUE)
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...