Example #1
0
 def reset(self):
     out = None
     if self.cell != "":
         if self.runAsDecl:
             utils.declareCppCode(self.cell)
             self.runAsDecl = False
         elif self.runAsAclic:
             utils.invokeAclic(self.cell)
             self.runAsAclic = False
         elif self.runAsBash:
             cellNoEndNewLine = self.cell[:-1]
             out = utils._checkOutput(cellNoEndNewLine,"Error running shell command")
             if out: sys.stdout.write(out)
             self.runAsBash = False
         else:
             utils.processCppCode(self.cell)
         self.cell = ""
     if self.mustSwitchToPython:
         ip = get_ipython()
         unload_ipython_extension(ip)
         self.mustSwitchToPython = False
         cppcompleter.unload_ipython_extension(ip)
         # Change highlight mode
         display.display_javascript(utils.jsDefaultHighlight.format(mimeType = utils.ipyMIME), raw=True)
         print "Notebook is in Python mode"
Example #2
0
 def reset(self):
     out = None
     if self.cell != "":
         if self.runAsDecl:
             utils.declareCppCode(self.cell)
             self.runAsDecl = False
         elif self.runAsAclic:
             utils.invokeAclic(self.cell)
             self.runAsAclic = False
         elif self.runAsBash:
             cellNoEndNewLine = self.cell[:-1]
             out = utils._checkOutput(cellNoEndNewLine,
                                      "Error running shell command")
             if out: sys.stdout.write(out)
             self.runAsBash = False
         else:
             utils.processCppCode(self.cell)
         self.cell = ""
     if self.mustSwitchToPython:
         ip = get_ipython()
         unload_ipython_extension(ip)
         self.mustSwitchToPython = False
         cppcompleter.unload_ipython_extension(ip)
         # Change highlight mode
         display.display_javascript(
             utils.jsDefaultHighlight.format(mimeType=utils.ipyMIME),
             raw=True)
         print "Notebook is in Python mode"
Example #3
0
 def activate(self):
     self.active = True
     if self.firstActivation:
         utils.declareCppCode('#include "dlfcn.h"')
         dlOpenRint = 'dlopen("libRint.so",RTLD_NOW);'
         utils.processCppCode(dlOpenRint)
         utils.declareCppCode(_TTabComHookCode)
         self.hook = ROOT._TTabComHook
         self.firstActivation = False
Example #4
0
 def activate(self):
     self.active = True
     if self.firstActivation:
         utils.declareCppCode('#include "dlfcn.h"')
         dlOpenRint = 'dlopen("libRint.so",RTLD_NOW);'
         utils.processCppCode(dlOpenRint)
         utils.declareCppCode(_TTabComHookCode)
         self.hook = ROOT._TTabComHook
         self.firstActivation = False
Example #5
0
 def cpp(self, line, cell):
     """Executes the content of the cell as C++ code."""
     args = parse_argstring(self.cpp, line)
     if args.aclic:
         utils.invokeAclic(cell)
     elif args.declare:
         utils.declareCppCode(cell)
     else:
         utils.processCppCode(cell)
Example #6
0
 def cpp(self, line, cell):
     '''Executes the content of the cell as C++ code.'''
     args = parse_argstring(self.cpp, line)
     if args.aclic:
         utils.invokeAclic(cell)
     elif args.declare:
         utils.declareCppCode(cell)
     else:
         utils.processCppCode(cell)
Example #7
0
 def reset(self):
     if self.cell != "":
         if self.mustDeclare:
             utils.declareCppCode(self.cell)
             self.mustDeclare = False
         else:
             utils.processCppCode(self.cell)
         self.cell = ""
     if self.mustSwitchToPython:
         ip = get_ipython()
         unload_ipython_extension(ip)
         self.mustSwitchToPython = False
         cppcompleter.unload_ipython_extension(ip)
         # Change highlight mode
         display.display_javascript(utils.jsDefaultHighlight.format(mimeType = utils.ipyMIME), raw=True)
         print "Notebook is in Python mode"
Example #8
0
 def reset(self):
     if self.cell != "":
         if self.mustDeclare:
             utils.declareCppCode(self.cell)
             self.mustDeclare = False
         else:
             cell = self.cell
             code = commentRemover(self.cell)
             utils.processCppCode(code)
         self.cell = ""
     if self.mustSwitchToPython:
         unload_ipython_extension(get_ipython())
         self.mustSwitchToPython = False
         cppcompleter.unload_ipython_extension(get_ipython())
         # Change highlight mode
         display.display_javascript(
             utils.jsDefaultHighlight.format(mimeType=utils.ipyMIME),
             raw=True)
         print "Notebook is in Python mode"
Example #9
0
 def cpp(self, line, cell=None):
     """Inject into root."""
     if cell:
         utils.processCppCode(cell)
Example #10
0
 def cpp(self, line, cell=None):
     """Inject into root."""
     if cell:
         utils.processCppCode(cell)
Example #11
0
 def cpp(self, line, cell=None):
     """Inject into root."""
     if cell is None: # this is a line magic
         utils.processCppCode(line)
     else:
         utils.processCppCode(cell)