Exemple #1
0
    def configure_shellwidget(self, give_focus=True):
        """Configure shellwidget after kernel is started"""
        if give_focus:
            self.get_control().setFocus()

        # Set exit callback
        self.shellwidget.set_exit_callback()

        # To save history
        self.shellwidget.executing.connect(self.add_to_history)

        # For Mayavi to run correctly
        self.shellwidget.executing.connect(
            self.shellwidget.set_backend_for_mayavi)

        # To update history after execution
        self.shellwidget.executed.connect(self.update_history)

        # To update the Variable Explorer after execution
        self.shellwidget.executed.connect(
            self.shellwidget.refresh_namespacebrowser)

        # To enable the stop button when executing a process
        self.shellwidget.executing.connect(self.enable_stop_button)

        # To disable the stop button after execution stopped
        self.shellwidget.executed.connect(self.disable_stop_button)

        # To show kernel restarted/died messages
        self.shellwidget.sig_kernel_restarted.connect(
            self.kernel_restarted_message)

        # To correctly change Matplotlib backend interactively
        self.shellwidget.executing.connect(
            self.shellwidget.change_mpl_backend)

        # To show env and sys.path contents
        self.shellwidget.sig_show_syspath.connect(self.show_syspath)
        self.shellwidget.sig_show_env.connect(self.show_env)

        # To sync with working directory toolbar
        self.shellwidget.executed.connect(self.shellwidget.get_cwd)

        # To apply style
        if not create_qss_style(self.shellwidget.syntax_style)[1]:
            self.shellwidget.silent_execute("%colors linux")
        else:
            self.shellwidget.silent_execute("%colors lightbg")

        # To hide the loading page
        self.shellwidget.sig_prompt_ready.connect(self._hide_loading_page)

        # Show possible errors when setting Matplotlib backend
        self.shellwidget.sig_prompt_ready.connect(
            self._show_mpl_backend_errors)
Exemple #2
0
 def set_color_scheme(self, color_scheme):
     """Set color scheme of the shell."""
     self.style_sheet, dark_color = create_qss_style(color_scheme)
     self.syntax_style = color_scheme
     self._style_sheet_changed()
     self._syntax_style_changed()
     self.reset(clear=True)
     if not dark_color:
         self.silent_execute("%colors linux")
     else:
         self.silent_execute("%colors lightbg")
Exemple #3
0
 def set_color_scheme(self, color_scheme):
     """Set color scheme of the shell."""
     self.set_bracket_matcher_color_scheme(color_scheme)
     self.style_sheet, dark_color = create_qss_style(color_scheme)
     self.syntax_style = color_scheme
     self._style_sheet_changed()
     self._syntax_style_changed()
     self.reset(clear=True)
     if not dark_color:
         self.silent_execute("%colors linux")
     else:
         self.silent_execute("%colors lightbg")
Exemple #4
0
    def configure_shellwidget(self, give_focus=True):
        """Configure shellwidget after kernel is started"""
        if give_focus:
            self.get_control().setFocus()

        # Set exit callback
        self.shellwidget.set_exit_callback()

        # To save history
        self.shellwidget.executing.connect(self.add_to_history)

        # For Mayavi to run correctly
        self.shellwidget.executing.connect(
            self.shellwidget.set_backend_for_mayavi)

        # To update history after execution
        self.shellwidget.executed.connect(self.update_history)

        # To update the Variable Explorer after execution
        self.shellwidget.executed.connect(
            self.shellwidget.refresh_namespacebrowser)

        # To enable the stop button when executing a process
        self.shellwidget.executing.connect(self.enable_stop_button)

        # To disable the stop button after execution stopped
        self.shellwidget.executed.connect(self.disable_stop_button)

        # To show kernel restarted/died messages
        self.shellwidget.sig_kernel_restarted.connect(
            self.kernel_restarted_message)

        # To correctly change Matplotlib backend interactively
        self.shellwidget.executing.connect(
            self.shellwidget.change_mpl_backend)

        # To show env and sys.path contents
        self.shellwidget.sig_show_syspath.connect(self.show_syspath)
        self.shellwidget.sig_show_env.connect(self.show_env)

        # To sync with working directory toolbar
        self.shellwidget.executed.connect(self.shellwidget.get_cwd)

        if not create_qss_style(self.shellwidget.syntax_style)[1]:
            self.shellwidget.silent_execute("%colors linux")
        else:
            self.shellwidget.silent_execute("%colors lightbg")