Show More
@@ -22,6 +22,7 b' import os' | |||
|
22 | 22 | import signal |
|
23 | 23 | import sys |
|
24 | 24 | import webbrowser |
|
25 | import uuid | |
|
25 | 26 | from getpass import getpass |
|
26 | 27 | |
|
27 | 28 | # System library imports |
@@ -273,10 +274,7 b' class MainWindow(QtGui.QMainWindow):' | |||
|
273 | 274 | # widget that are candidate to be the owner of the kernel does have all the same port of the curent widget |
|
274 | 275 | # And should have a _may_close attribute |
|
275 | 276 | filtred_widget_list = [ widget for widget in widget_list if |
|
276 |
widget.kernel_manager. |
|
|
277 | widget.kernel_manager.sub_address == km.sub_address and | |
|
278 | widget.kernel_manager.stdin_address == km.stdin_address and | |
|
279 | widget.kernel_manager.hb_address == km.hb_address and | |
|
277 | widget.kernel_manager.connection_file == km.connection_file and | |
|
280 | 278 | hasattr(widget,'_may_close') ] |
|
281 | 279 | # the master widget is the one that may close the kernel |
|
282 | 280 | master_widget= [ widget for widget in filtred_widget_list if widget._may_close] |
@@ -308,10 +306,7 b' class MainWindow(QtGui.QMainWindow):' | |||
|
308 | 306 | |
|
309 | 307 | # widget that are candidate not to be the owner of the kernel does have all the same port of the curent widget |
|
310 | 308 | filtered_widget_list = ( widget for widget in widget_list if |
|
311 |
widget.kernel_manager. |
|
|
312 | widget.kernel_manager.sub_address == km.sub_address and | |
|
313 | widget.kernel_manager.stdin_address == km.stdin_address and | |
|
314 | widget.kernel_manager.hb_address == km.hb_address) | |
|
309 | widget.kernel_manager.connection_file == km.connection_file) | |
|
315 | 310 | # Get a list of all widget owning the same kernel and removed it from |
|
316 | 311 | # the previous cadidate. (better using sets ?) |
|
317 | 312 | master_widget_list = self.find_master_tab(tab,as_list=True) |
@@ -877,6 +872,9 b' class IPythonQtConsoleApp(BaseIPythonApplication):' | |||
|
877 | 872 | self.connection_file = os.path.basename(base)+'-ssh'+ext |
|
878 | 873 | self.log.critical("To connect another client via this tunnel, use:") |
|
879 | 874 | self.log.critical("--existing %s" % self.connection_file) |
|
875 | ||
|
876 | def _new_connection_file(self): | |
|
877 | return os.path.join(self.profile_dir.security_dir, 'kernel-%s.json' % uuid.uuid4()) | |
|
880 | 878 | |
|
881 | 879 | def init_kernel_manager(self): |
|
882 | 880 | # Don't let Qt or ZMQ swallow KeyboardInterupts. |
@@ -915,21 +913,19 b' class IPythonQtConsoleApp(BaseIPythonApplication):' | |||
|
915 | 913 | def create_tab_with_new_frontend(self): |
|
916 | 914 | """ Create new tab attached to new kernel, launched on localhost. |
|
917 | 915 | """ |
|
916 | ip = self.ip if self.ip in LOCAL_IPS else LOCALHOST | |
|
918 | 917 | kernel_manager = QtKernelManager( |
|
919 |
|
|
|
920 | sub_address=(LOCALHOST, 0), | |
|
921 |
|
|
|
922 | hb_address=(LOCALHOST, 0), | |
|
923 | config=self.config | |
|
918 | ip=ip, | |
|
919 | connection_file=self._new_connection_file(), | |
|
920 | config=self.config, | |
|
924 | 921 | ) |
|
925 | 922 | # start the kernel |
|
926 |
kwargs = dict( |
|
|
923 | kwargs = dict(ipython=not self.pure) | |
|
927 | 924 | kwargs['extra_arguments'] = self.kernel_argv |
|
928 | 925 | kernel_manager.start_kernel(**kwargs) |
|
929 | 926 | kernel_manager.start_channels() |
|
930 | local_kernel = (not False) or self.ip in LOCAL_IPS | |
|
931 | 927 | widget = self.widget_factory(config=self.config, |
|
932 |
local_kernel= |
|
|
928 | local_kernel=True) | |
|
933 | 929 | widget.kernel_manager = kernel_manager |
|
934 | 930 | widget._existing=False; |
|
935 | 931 | widget._confirm_exit=True; |
@@ -942,16 +938,13 b' class IPythonQtConsoleApp(BaseIPythonApplication):' | |||
|
942 | 938 | current_widget.kernel_manager = current_widget.kernel_manager; |
|
943 | 939 | current_widget_name = self.window.tab_widget.tabText(current_widget_index); |
|
944 | 940 | kernel_manager = QtKernelManager( |
|
945 |
|
|
|
946 | sub_address = current_widget.kernel_manager.sub_address, | |
|
947 | stdin_address = current_widget.kernel_manager.stdin_address, | |
|
948 | hb_address = current_widget.kernel_manager.hb_address, | |
|
949 | config = self.config | |
|
941 | connection_file=current_widget.kernel_manager.connection_file, | |
|
942 | config = self.config, | |
|
950 | 943 | ) |
|
944 | kernel_manager.load_connection_file() | |
|
951 | 945 | kernel_manager.start_channels() |
|
952 | local_kernel = (not self.existing) or self.ip in LOCAL_IPS | |
|
953 | 946 | widget = self.widget_factory(config=self.config, |
|
954 |
|
|
|
947 | local_kernel=False) | |
|
955 | 948 | widget._confirm_exit=True; |
|
956 | 949 | widget._may_close=False; |
|
957 | 950 | widget.kernel_manager = kernel_manager |
General Comments 0
You need to be logged in to leave comments.
Login now