##// END OF EJS Templates
more IPShellQt* cleanup
darren.dale -
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 2756 2007-09-10 18:25:30Z darren.dale $"""
7 $Id: Shell.py 2758 2007-09-10 20:56:27Z 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>
@@ -885,32 +885,6 b' class IPShellQt(IPThread):'
885
885
886 import qt
886 import qt
887
887
888 self.qApp = qt.qApp
889
890 class DummyQApp:
891 def __init__(self, *args):
892 self.qApp = qt.qApp
893
894 def exec_loop(*args, **kwargs):
895 pass
896
897 def __getattr__(self, name):
898 return getattr(self.qApp, name)
899
900 class DummyQApplication:
901 def __init__(self):
902 self.QApplication = qt.QApplication
903
904 def __call__(*args, **kwargs):
905 # mask until module NoneType errors can be fixed
906 # return DummyQApp()
907 return qt.qApp
908
909 def __getattr__( self, name ):
910 return getattr(self.QApplication, name)
911
912 qt.QApplication = DummyQApplication()
913
914 # Allows us to use both Tk and QT.
888 # Allows us to use both Tk and QT.
915 self.tk = get_tk()
889 self.tk = get_tk()
916
890
@@ -935,9 +909,7 b' class IPShellQt(IPThread):'
935 self._banner = banner
909 self._banner = banner
936
910
937 if qt.QApplication.startingUp():
911 if qt.QApplication.startingUp():
938 self.qApp = qt.QApplication.QApplication(sys.argv)
912 self.qApp = qt.QApplication(sys.argv)
939 # mask until module NoneType errors can be fixed
940 # qt.qApp = qt.QApplication()
941
913
942 self.timer = qt.QTimer()
914 self.timer = qt.QTimer()
943 qt.QObject.connect(self.timer,
915 qt.QObject.connect(self.timer,
@@ -948,7 +920,7 b' class IPShellQt(IPThread):'
948 self.timer.start(self.TIMEOUT, True)
920 self.timer.start(self.TIMEOUT, True)
949 while True:
921 while True:
950 if self.IP._kill: break
922 if self.IP._kill: break
951 self.qApp.exec_loop()
923 qt.qApp.exec_loop()
952 self.join()
924 self.join()
953
925
954 def on_timer(self):
926 def on_timer(self):
@@ -957,7 +929,6 b' class IPShellQt(IPThread):'
957 self.timer.start(self.TIMEOUT, True)
929 self.timer.start(self.TIMEOUT, True)
958 return result
930 return result
959
931
960
961 class IPShellQt4(IPThread):
932 class IPShellQt4(IPThread):
962 """Run a Qt event loop in a separate thread.
933 """Run a Qt event loop in a separate thread.
963
934
@@ -972,32 +943,6 b' class IPShellQt4(IPThread):'
972
943
973 from PyQt4 import QtCore, QtGui
944 from PyQt4 import QtCore, QtGui
974
945
975 self.qApp = QtGui.qApp
976
977 class DummyQApp:
978 def __init__(self, *args):
979 self.qApp = QtGui.qApp
980
981 def exec_(*args, **kwargs):
982 pass
983
984 def __getattr__(self, name):
985 return getattr(self.qApp, name)
986
987 class DummyQApplication:
988 def __init__(self, *args):
989 self.QApplication = QtGui.QApplication
990
991 def __call__(*args, **kwargs):
992 # mask until module NoneType errors can be fixed
993 # return DummyQApp()
994 return QtGui.qApp
995
996 def __getattr__(self, name):
997 return getattr(self.QApplication, name)
998
999 QtGui.QApplication = DummyQApplication()
1000
1001 # Allows us to use both Tk and QT.
946 # Allows us to use both Tk and QT.
1002 self.tk = get_tk()
947 self.tk = get_tk()
1003
948
@@ -1022,9 +967,7 b' class IPShellQt4(IPThread):'
1022 self._banner = banner
967 self._banner = banner
1023
968
1024 if QtGui.QApplication.startingUp():
969 if QtGui.QApplication.startingUp():
1025 self.qApp = QtGui.QApplication.QApplication(sys.argv)
970 self.qApp = QtGui.QApplication(sys.argv)
1026 # mask until module NoneType errors can be fixed
1027 # QtGui.qApp = QtGui.QApplication()
1028
971
1029 self.timer = QtCore.QTimer()
972 self.timer = QtCore.QTimer()
1030 QtCore.QObject.connect(self.timer,
973 QtCore.QObject.connect(self.timer,
@@ -1034,8 +977,8 b' class IPShellQt4(IPThread):'
1034 self.start()
977 self.start()
1035 self.timer.start(self.TIMEOUT)
978 self.timer.start(self.TIMEOUT)
1036 while True:
979 while True:
1037 self.qApp.exec_()
1038 if self.IP._kill: break
980 if self.IP._kill: break
981 QtGui.qApp.exec_()
1039 self.join()
982 self.join()
1040
983
1041 def on_timer(self):
984 def on_timer(self):
General Comments 0
You need to be logged in to leave comments. Login now