DEPRECATED since IPython 5.0 Enable event loop integration with GLUT. Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of
(self, app=None)
| 522 | @inputhook_manager.register('glut') |
| 523 | class GlutInputHook(InputHookBase): |
| 524 | def enable(self, app=None): |
| 525 | """DEPRECATED since IPython 5.0 |
| 526 | |
| 527 | Enable event loop integration with GLUT. |
| 528 | |
| 529 | Parameters |
| 530 | ---------- |
| 531 | |
| 532 | app : ignored |
| 533 | Ignored, it's only a placeholder to keep the call signature of all |
| 534 | gui activation methods consistent, which simplifies the logic of |
| 535 | supporting magics. |
| 536 | |
| 537 | Notes |
| 538 | ----- |
| 539 | |
| 540 | This methods sets the PyOS_InputHook for GLUT, which allows the GLUT to |
| 541 | integrate with terminal based applications like IPython. Due to GLUT |
| 542 | limitations, it is currently not possible to start the event loop |
| 543 | without first creating a window. You should thus not create another |
| 544 | window but use instead the created one. See 'gui-glut.py' in the |
| 545 | docs/examples/lib directory. |
| 546 | |
| 547 | The default screen mode is set to: |
| 548 | glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH |
| 549 | """ |
| 550 | warn("This function is deprecated since IPython 5.0 and will be removed in future versions.", |
| 551 | DeprecationWarning, stacklevel=2) |
| 552 | |
| 553 | import OpenGL.GLUT as glut |
| 554 | from IPython.lib.inputhookglut import glut_display_mode, \ |
| 555 | glut_close, glut_display, \ |
| 556 | glut_idle, inputhook_glut |
| 557 | |
| 558 | if GUI_GLUT not in self.manager.apps: |
| 559 | glut.glutInit( sys.argv ) |
| 560 | glut.glutInitDisplayMode( glut_display_mode ) |
| 561 | # This is specific to freeglut |
| 562 | if bool(glut.glutSetOption): |
| 563 | glut.glutSetOption( glut.GLUT_ACTION_ON_WINDOW_CLOSE, |
| 564 | glut.GLUT_ACTION_GLUTMAINLOOP_RETURNS ) |
| 565 | glut.glutCreateWindow( sys.argv[0] ) |
| 566 | glut.glutReshapeWindow( 1, 1 ) |
| 567 | glut.glutHideWindow( ) |
| 568 | glut.glutWMCloseFunc( glut_close ) |
| 569 | glut.glutDisplayFunc( glut_display ) |
| 570 | glut.glutIdleFunc( glut_idle ) |
| 571 | else: |
| 572 | glut.glutWMCloseFunc( glut_close ) |
| 573 | glut.glutDisplayFunc( glut_display ) |
| 574 | glut.glutIdleFunc( glut_idle) |
| 575 | self.manager.set_inputhook( inputhook_glut ) |
| 576 | |
| 577 | |
| 578 | def disable(self): |
nothing calls this directly
no test coverage detected