Enable GUI event loop integration, taking pylab into account.
(self)
| 276 | raise NotImplementedError("Override in subclasses") |
| 277 | |
| 278 | def init_gui_pylab(self): |
| 279 | """Enable GUI event loop integration, taking pylab into account.""" |
| 280 | enable = False |
| 281 | shell = self.shell |
| 282 | if self.pylab: |
| 283 | enable = lambda key: shell.enable_pylab(key, import_all=self.pylab_import_all) |
| 284 | key = self.pylab |
| 285 | elif self.matplotlib: |
| 286 | enable = shell.enable_matplotlib |
| 287 | key = self.matplotlib |
| 288 | elif self.gui: |
| 289 | enable = shell.enable_gui |
| 290 | key = self.gui |
| 291 | |
| 292 | if not enable: |
| 293 | return |
| 294 | |
| 295 | try: |
| 296 | r = enable(key) |
| 297 | except ImportError: |
| 298 | self.log.warning("Eventloop or matplotlib integration failed. Is matplotlib installed?") |
| 299 | self.shell.showtraceback() |
| 300 | return |
| 301 | except Exception: |
| 302 | self.log.warning("GUI event loop or pylab initialization failed") |
| 303 | self.shell.showtraceback() |
| 304 | return |
| 305 | |
| 306 | if isinstance(r, tuple): |
| 307 | gui, backend = r[:2] |
| 308 | self.log.info("Enabling GUI event loop integration, " |
| 309 | "eventloop=%s, matplotlib=%s", gui, backend) |
| 310 | if key == "auto": |
| 311 | print("Using matplotlib backend: %s" % backend) |
| 312 | else: |
| 313 | gui = r |
| 314 | self.log.info("Enabling GUI event loop integration, " |
| 315 | "eventloop=%s", gui) |
| 316 | |
| 317 | def init_extensions(self): |
| 318 | """Load all IPython extensions in IPythonApp.extensions. |
no test coverage detected