Show More
@@ -109,7 +109,7 b' def start_event_loop_wx(app=None):' | |||||
109 | # Qt |
|
109 | # Qt | |
110 | #----------------------------------------------------------------------------- |
|
110 | #----------------------------------------------------------------------------- | |
111 |
|
111 | |||
112 | def get_app_qt(*args, **kwargs): |
|
112 | def get_app_qt4(*args, **kwargs): | |
113 | """Create a new Qt app or return an existing one.""" |
|
113 | """Create a new Qt app or return an existing one.""" | |
114 | from IPython.external.qt_for_kernel import QtGui |
|
114 | from IPython.external.qt_for_kernel import QtGui | |
115 | app = QtGui.QApplication.instance() |
|
115 | app = QtGui.QApplication.instance() | |
@@ -119,7 +119,7 b' def get_app_qt(*args, **kwargs):' | |||||
119 | app = QtGui.QApplication(*args, **kwargs) |
|
119 | app = QtGui.QApplication(*args, **kwargs) | |
120 | return app |
|
120 | return app | |
121 |
|
121 | |||
122 | def is_event_loop_running_qt(app=None): |
|
122 | def is_event_loop_running_qt4(app=None): | |
123 | """Is the qt event loop running.""" |
|
123 | """Is the qt event loop running.""" | |
124 | # New way: check attribute on shell instance |
|
124 | # New way: check attribute on shell instance | |
125 | ip = get_ipython() |
|
125 | ip = get_ipython() | |
@@ -128,18 +128,18 b' def is_event_loop_running_qt(app=None):' | |||||
128 |
|
128 | |||
129 | # Old way: check attribute on QApplication singleton |
|
129 | # Old way: check attribute on QApplication singleton | |
130 | if app is None: |
|
130 | if app is None: | |
131 | app = get_app_qt(['']) |
|
131 | app = get_app_qt4(['']) | |
132 | if hasattr(app, '_in_event_loop'): |
|
132 | if hasattr(app, '_in_event_loop'): | |
133 | return app._in_event_loop |
|
133 | return app._in_event_loop | |
134 | else: |
|
134 | else: | |
135 | # Does qt provide a other way to detect this? |
|
135 | # Does qt provide a other way to detect this? | |
136 | return False |
|
136 | return False | |
137 |
|
137 | |||
138 | def start_event_loop_qt(app=None): |
|
138 | def start_event_loop_qt4(app=None): | |
139 | """Start the qt event loop in a consistent manner.""" |
|
139 | """Start the qt event loop in a consistent manner.""" | |
140 | if app is None: |
|
140 | if app is None: | |
141 | app = get_app_qt(['']) |
|
141 | app = get_app_qt(['']) | |
142 | if not is_event_loop_running_qt(app): |
|
142 | if not is_event_loop_running_qt4(app): | |
143 | app._in_event_loop = True |
|
143 | app._in_event_loop = True | |
144 | app.exec_() |
|
144 | app.exec_() | |
145 | app._in_event_loop = False |
|
145 | app._in_event_loop = False |
General Comments 0
You need to be logged in to leave comments.
Login now