Show More
@@ -4,7 +4,7 b'' | |||||
4 | All the matplotlib support code was co-developed with John Hunter, |
|
4 | All the matplotlib support code was co-developed with John Hunter, | |
5 | matplotlib's author. |
|
5 | matplotlib's author. | |
6 |
|
6 | |||
7 |
$Id: Shell.py 27 |
|
7 | $Id: Shell.py 2760 2007-09-11 17:30:32Z darren.dale $""" | |
8 |
|
8 | |||
9 | #***************************************************************************** |
|
9 | #***************************************************************************** | |
10 | # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> |
|
10 | # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> | |
@@ -46,7 +46,6 b' from IPython.ipmaker import make_IPython' | |||||
46 | from IPython.Magic import Magic |
|
46 | from IPython.Magic import Magic | |
47 | from IPython.ipstruct import Struct |
|
47 | from IPython.ipstruct import Struct | |
48 |
|
48 | |||
49 |
|
||||
50 | # Globals |
|
49 | # Globals | |
51 | # global flag to pass around information about Ctrl-C without exceptions |
|
50 | # global flag to pass around information about Ctrl-C without exceptions | |
52 | KBINT = False |
|
51 | KBINT = False | |
@@ -885,6 +884,14 b' class IPShellQt(IPThread):' | |||||
885 |
|
884 | |||
886 | import qt |
|
885 | import qt | |
887 |
|
886 | |||
|
887 | def dummy_mainloop(*args, **kwargs): | |||
|
888 | pass | |||
|
889 | ||||
|
890 | self.exec_loop = qt.qApp.exec_loop | |||
|
891 | ||||
|
892 | qt.qApp.exec_loop = dummy_mainloop | |||
|
893 | qt.QApplication.exec_loop = dummy_mainloop | |||
|
894 | ||||
888 | # Allows us to use both Tk and QT. |
|
895 | # Allows us to use both Tk and QT. | |
889 | self.tk = get_tk() |
|
896 | self.tk = get_tk() | |
890 |
|
897 | |||
@@ -909,7 +916,7 b' class IPShellQt(IPThread):' | |||||
909 | self._banner = banner |
|
916 | self._banner = banner | |
910 |
|
917 | |||
911 | if qt.QApplication.startingUp(): |
|
918 | if qt.QApplication.startingUp(): | |
912 |
|
|
919 | a = qt.QApplication(sys.argv) | |
913 |
|
920 | |||
914 | self.timer = qt.QTimer() |
|
921 | self.timer = qt.QTimer() | |
915 | qt.QObject.connect(self.timer, |
|
922 | qt.QObject.connect(self.timer, | |
@@ -920,7 +927,7 b' class IPShellQt(IPThread):' | |||||
920 | self.timer.start(self.TIMEOUT, True) |
|
927 | self.timer.start(self.TIMEOUT, True) | |
921 | while True: |
|
928 | while True: | |
922 | if self.IP._kill: break |
|
929 | if self.IP._kill: break | |
923 |
|
|
930 | self.exec_loop() | |
924 | self.join() |
|
931 | self.join() | |
925 |
|
932 | |||
926 | def on_timer(self): |
|
933 | def on_timer(self): | |
@@ -929,6 +936,7 b' class IPShellQt(IPThread):' | |||||
929 | self.timer.start(self.TIMEOUT, True) |
|
936 | self.timer.start(self.TIMEOUT, True) | |
930 | return result |
|
937 | return result | |
931 |
|
938 | |||
|
939 | ||||
932 | class IPShellQt4(IPThread): |
|
940 | class IPShellQt4(IPThread): | |
933 | """Run a Qt event loop in a separate thread. |
|
941 | """Run a Qt event loop in a separate thread. | |
934 |
|
942 | |||
@@ -943,6 +951,15 b' class IPShellQt4(IPThread):' | |||||
943 |
|
951 | |||
944 | from PyQt4 import QtCore, QtGui |
|
952 | from PyQt4 import QtCore, QtGui | |
945 |
|
953 | |||
|
954 | def dummy_mainloop(*args, **kwargs): | |||
|
955 | pass | |||
|
956 | ||||
|
957 | self.exec_ = QtGui.qApp.exec_ | |||
|
958 | ||||
|
959 | QtGui.qApp.exec_ = dummy_mainloop | |||
|
960 | QtGui.QApplication.exec_ = dummy_mainloop | |||
|
961 | QtCore.QCoreApplication.exec_ = dummy_mainloop | |||
|
962 | ||||
946 | # Allows us to use both Tk and QT. |
|
963 | # Allows us to use both Tk and QT. | |
947 | self.tk = get_tk() |
|
964 | self.tk = get_tk() | |
948 |
|
965 | |||
@@ -967,7 +984,7 b' class IPShellQt4(IPThread):' | |||||
967 | self._banner = banner |
|
984 | self._banner = banner | |
968 |
|
985 | |||
969 | if QtGui.QApplication.startingUp(): |
|
986 | if QtGui.QApplication.startingUp(): | |
970 |
|
|
987 | a = QtGui.QApplication(sys.argv) | |
971 |
|
988 | |||
972 | self.timer = QtCore.QTimer() |
|
989 | self.timer = QtCore.QTimer() | |
973 | QtCore.QObject.connect(self.timer, |
|
990 | QtCore.QObject.connect(self.timer, | |
@@ -978,7 +995,7 b' class IPShellQt4(IPThread):' | |||||
978 | self.timer.start(self.TIMEOUT) |
|
995 | self.timer.start(self.TIMEOUT) | |
979 | while True: |
|
996 | while True: | |
980 | if self.IP._kill: break |
|
997 | if self.IP._kill: break | |
981 |
|
|
998 | self.exec_() | |
982 | self.join() |
|
999 | self.join() | |
983 |
|
1000 | |||
984 | def on_timer(self): |
|
1001 | def on_timer(self): |
General Comments 0
You need to be logged in to leave comments.
Login now