本文整理汇总了Python中qtconsole.inprocess.QtInProcessKernelManager.is_alive方法的典型用法代码示例。如果您正苦于以下问题:Python QtInProcessKernelManager.is_alive方法的具体用法?Python QtInProcessKernelManager.is_alive怎么用?Python QtInProcessKernelManager.is_alive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtconsole.inprocess.QtInProcessKernelManager
的用法示例。
在下文中一共展示了QtInProcessKernelManager.is_alive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ManagerGui
# 需要导入模块: from qtconsole.inprocess import QtInProcessKernelManager [as 别名]
# 或者: from qtconsole.inprocess.QtInProcessKernelManager import is_alive [as 别名]
#.........这里部分代码省略.........
""" Forward log entry to log widget and show an error popup if it is
an error message.
@param dict entry: Log entry
"""
self._mw.logwidget.addEntry(entry)
if entry['level'] == 'error' or entry['level'] == 'critical':
self.errorDialog.show(entry)
def startIPython(self):
""" Create an IPython kernel manager and kernel.
Add modules to its namespace.
"""
# make sure we only log errors and above from ipython
logging.getLogger('ipykernel').setLevel(logging.WARNING)
self.log.debug('IPy activation in thread {0}'.format(
QtCore.QThread.currentThreadId()))
self.kernel_manager = QtInProcessKernelManager()
self.kernel_manager.start_kernel()
self.kernel = self.kernel_manager.kernel
self.namespace = self.kernel.shell.user_ns
self.namespace.update({
'np': np,
'config': self._manager.tree['defined'],
'manager': self._manager
})
if _has_pyqtgraph:
self.namespace['pg'] = pg
self.updateIPythonModuleList()
self.kernel.gui = 'qt4'
self.log.info('IPython has kernel {0}'.format(
self.kernel_manager.has_kernel))
self.log.info('IPython kernel alive {0}'.format(
self.kernel_manager.is_alive()))
self._manager.sigModulesChanged.connect(self.updateIPythonModuleList)
def startIPythonWidget(self):
""" Create an IPython console widget and connect it to an IPython
kernel.
"""
if (_has_pyqtgraph):
banner_modules = 'The numpy and pyqtgraph modules have already ' \
'been imported as ''np'' and ''pg''.'
else:
banner_modules = 'The numpy module has already been imported ' \
'as ''np''.'
banner = """
This is an interactive IPython console. {0}
Configuration is in 'config', the manager is 'manager' and all loaded modules are in this namespace with their configured name.
View the current namespace with dir().
Go, play.
""".format(banner_modules)
self._mw.consolewidget.banner = banner
# font size
self.consoleSetFontSize(self.consoleFontSize)
# settings
self._csd = ConsoleSettingsDialog()
self._csd.accepted.connect(self.consoleApplySettings)
self._csd.rejected.connect(self.consoleKeepSettings)
self._csd.buttonBox.button(
QtWidgets.QDialogButtonBox.Apply).clicked.connect(
self.consoleApplySettings)
self._mw.actionConsoleSettings.triggered.connect(self._csd.exec_)
self.consoleKeepSettings()
self._mw.consolewidget.kernel_manager = self.kernel_manager