File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1782,11 +1782,25 @@ def in_qtconsole():
1782
1782
"""
1783
1783
try :
1784
1784
ip = get_ipython ()
1785
- if ip .config ['KernelApp' ]['parent_appname' ] == 'ipython-qtconsole' :
1785
+ front_end = (ip .config .get ('KernelApp' ,{}).get ('parent_appname' ,"" ) or
1786
+ ip .config .get ('IPKernelApp' ,{}).get ('parent_appname' ,"" ))
1787
+ if 'qtconsole' in front_end .lower ():
1786
1788
return True
1787
1789
except :
1788
1790
return False
1789
1791
1792
+ def in_ipnb_frontend ():
1793
+ """
1794
+ check if we're inside an an IPython zmq frontend
1795
+ """
1796
+ try :
1797
+ ip = get_ipython ()
1798
+ return 'zmq' in str (type (ip )).lower ()
1799
+ except :
1800
+ pass
1801
+
1802
+ return False
1803
+
1790
1804
# Unicode consolidation
1791
1805
# ---------------------
1792
1806
#
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def get_terminal_size():
22
22
Detect terminal size and return tuple = (width, height).
23
23
24
24
Only to be used when running in a terminal. Note that the IPython notebook,
25
- IPython qtconsole , or IDLE do not run in a terminal,
25
+ IPython zmq frontends , or IDLE do not run in a terminal,
26
26
"""
27
27
import platform
28
28
current_os = platform .system ()
You can’t perform that action at this time.
0 commit comments