##// END OF EJS Templates
changed close Console behavior to leave Kernel alive
MinRK -
Show More
@@ -31,12 +31,13 b' class MainWindow(QtGui.QMainWindow):'
31 # 'object' interface
31 # 'object' interface
32 #---------------------------------------------------------------------------
32 #---------------------------------------------------------------------------
33
33
34 def __init__(self, frontend, existing=False):
34 def __init__(self, app, frontend, existing=False):
35 """ Create a MainWindow for the specified FrontendWidget.
35 """ Create a MainWindow for the specified FrontendWidget.
36
36
37 If existing is True, then this Window does not own the Kernel.
37 If existing is True, then this Window does not own the Kernel.
38 """
38 """
39 super(MainWindow, self).__init__()
39 super(MainWindow, self).__init__()
40 self._app = app
40 self._frontend = frontend
41 self._frontend = frontend
41 self._existing = existing
42 self._existing = existing
42 self._frontend.exit_requested.connect(self.close)
43 self._frontend.exit_requested.connect(self.close)
@@ -56,7 +57,6 b' class MainWindow(QtGui.QMainWindow):'
56 "Close just this console, or shutdown the kernel and close "+
57 "Close just this console, or shutdown the kernel and close "+
57 "all windows attached to it?",
58 "all windows attached to it?",
58 'Cancel', 'Close Console', 'Close All')
59 'Cancel', 'Close Console', 'Close All')
59 print reply
60 if reply == 2:
60 if reply == 2:
61 kernel_manager.shutdown_kernel()
61 kernel_manager.shutdown_kernel()
62 #kernel_manager.stop_channels()
62 #kernel_manager.stop_channels()
@@ -67,7 +67,8 b' class MainWindow(QtGui.QMainWindow):'
67 event.accept()
67 event.accept()
68 else:
68 else:
69 # only destroy the Window, save the Kernel
69 # only destroy the Window, save the Kernel
70 self.destroy()
70 self._app.setQuitOnLastWindowClosed(False)
71 self.deleteLater()
71 event.ignore()
72 event.ignore()
72 else:
73 else:
73 event.ignore()
74 event.ignore()
@@ -146,7 +147,7 b' def main():'
146 widget.kernel_manager = kernel_manager
147 widget.kernel_manager = kernel_manager
147
148
148 # Create the main window.
149 # Create the main window.
149 window = MainWindow(widget, args.existing)
150 window = MainWindow(app, widget, args.existing)
150 window.setWindowTitle('Python' if args.pure else 'IPython')
151 window.setWindowTitle('Python' if args.pure else 'IPython')
151 window.show()
152 window.show()
152
153
General Comments 0
You need to be logged in to leave comments. Login now