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