How to use the qtconsole.styles function in qtconsole

To help you get started, we’ve selected a few qtconsole examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Fluorescence-Tools / chisurf / chisurf / widgets / widgets.py View on Github external
IPython.lib.guisupport.get_app_qt4().exit()

        self.exit_requested.connect(stop)
        self.width = kwargs.get(
            'width',
            chisurf.settings.gui['console']['width']
        )
        self._macro = ""
        self.recording = False

        # save nevertheless every inputs into a session file
        self.session_file = chisurf.settings.session_file
        #self.set_default_style(
        #    chisurf.settings.gui['console']['style']
        #)
        self.style_sheet = qtconsole.styles.default_light_style_sheet
github jupyter / qtconsole / qtconsole / mainwindow.py View on Github external
def set_syntax_style(self, syntax_style):
        """Set up syntax style for the current console."""
        if syntax_style=='bw':
            colors='nocolor'
        elif styles.dark_style(syntax_style):
            colors='linux'
        else:
            colors='lightbg'
        self.active_frontend.syntax_style = syntax_style
        style_sheet = styles.sheet_from_template(syntax_style, colors)
        self.active_frontend.style_sheet = style_sheet
        self.active_frontend._syntax_style_changed()
        self.active_frontend._style_sheet_changed()
        self.active_frontend.reset(clear=True)
        self.active_frontend._execute("%colors linux", True)
github jupyter / qtconsole / qtconsole / mainwindow.py View on Github external
def set_syntax_style(self, syntax_style):
        """Set up syntax style for the current console."""
        if syntax_style=='bw':
            colors='nocolor'
        elif styles.dark_style(syntax_style):
            colors='linux'
        else:
            colors='lightbg'
        self.active_frontend.syntax_style = syntax_style
        style_sheet = styles.sheet_from_template(syntax_style, colors)
        self.active_frontend.style_sheet = style_sheet
        self.active_frontend._syntax_style_changed()
        self.active_frontend._style_sheet_changed()
        self.active_frontend.reset(clear=True)
        self.active_frontend._execute("%colors linux", True)
github jupyter / qtconsole / qtconsole / jupyter_widget.py View on Github external
Parameters
        ----------
        colors : str, optional (default lightbg)
            Whether to use the default light background or dark
            background or B&W style.
        """
        colors = colors.lower()
        if colors=='lightbg':
            self.style_sheet = styles.default_light_style_sheet
            self.syntax_style = styles.default_light_syntax_style
        elif colors=='linux':
            self.style_sheet = styles.default_dark_style_sheet
            self.syntax_style = styles.default_dark_syntax_style
        elif colors=='nocolor':
            self.style_sheet = styles.default_bw_style_sheet
            self.syntax_style = styles.default_bw_syntax_style
        else:
            raise KeyError("No such color scheme: %s"%colors)
github jupyter / qtconsole / qtconsole / jupyter_widget.py View on Github external
def set_default_style(self, colors='lightbg'):
        """ Sets the widget style to the class defaults.

        Parameters
        ----------
        colors : str, optional (default lightbg)
            Whether to use the default light background or dark
            background or B&W style.
        """
        colors = colors.lower()
        if colors=='lightbg':
            self.style_sheet = styles.default_light_style_sheet
            self.syntax_style = styles.default_light_syntax_style
        elif colors=='linux':
            self.style_sheet = styles.default_dark_style_sheet
            self.syntax_style = styles.default_dark_syntax_style
        elif colors=='nocolor':
            self.style_sheet = styles.default_bw_style_sheet
            self.syntax_style = styles.default_bw_syntax_style
        else:
            raise KeyError("No such color scheme: %s"%colors)
github jupyter / qtconsole / qtconsole / jupyter_widget.py View on Github external
Parameters
        ----------
        colors : str, optional (default lightbg)
            Whether to use the default light background or dark
            background or B&W style.
        """
        colors = colors.lower()
        if colors=='lightbg':
            self.style_sheet = styles.default_light_style_sheet
            self.syntax_style = styles.default_light_syntax_style
        elif colors=='linux':
            self.style_sheet = styles.default_dark_style_sheet
            self.syntax_style = styles.default_dark_syntax_style
        elif colors=='nocolor':
            self.style_sheet = styles.default_bw_style_sheet
            self.syntax_style = styles.default_bw_syntax_style
        else:
            raise KeyError("No such color scheme: %s"%colors)
github jupyter / qtconsole / qtconsole / jupyter_widget.py View on Github external
def set_default_style(self, colors='lightbg'):
        """ Sets the widget style to the class defaults.

        Parameters
        ----------
        colors : str, optional (default lightbg)
            Whether to use the default light background or dark
            background or B&W style.
        """
        colors = colors.lower()
        if colors=='lightbg':
            self.style_sheet = styles.default_light_style_sheet
            self.syntax_style = styles.default_light_syntax_style
        elif colors=='linux':
            self.style_sheet = styles.default_dark_style_sheet
            self.syntax_style = styles.default_dark_syntax_style
        elif colors=='nocolor':
            self.style_sheet = styles.default_bw_style_sheet
            self.syntax_style = styles.default_bw_syntax_style
        else:
            raise KeyError("No such color scheme: %s"%colors)
github jupyter / qtconsole / qtconsole / qtconsoleapp.py View on Github external
style = cfg.JupyterWidget.syntax_style if 'JupyterWidget.syntax_style' in cfg else None
        sheet = cfg.JupyterWidget.style_sheet if 'JupyterWidget.style_sheet' in cfg else None

        # find the value for colors:
        if colors:
            colors=colors.lower()
            if colors in ('lightbg', 'light'):
                colors='lightbg'
            elif colors in ('dark', 'linux'):
                colors='linux'
            else:
                colors='nocolor'
        elif style:
            if style=='bw':
                colors='nocolor'
            elif styles.dark_style(style):
                colors='linux'
            else:
                colors='lightbg'
        else:
            colors=None

        # Configure the style
        if style:
            widget.style_sheet = styles.sheet_from_template(style, colors)
            widget.syntax_style = style
            widget._syntax_style_changed()
            widget._style_sheet_changed()
        elif colors:
            # use a default dark/light/bw style
            widget.set_default_style(colors=colors)
github jupyter / qtconsole / qtconsole / jupyter_widget.py View on Github external
def set_default_style(self, colors='lightbg'):
        """ Sets the widget style to the class defaults.

        Parameters
        ----------
        colors : str, optional (default lightbg)
            Whether to use the default light background or dark
            background or B&W style.
        """
        colors = colors.lower()
        if colors=='lightbg':
            self.style_sheet = styles.default_light_style_sheet
            self.syntax_style = styles.default_light_syntax_style
        elif colors=='linux':
            self.style_sheet = styles.default_dark_style_sheet
            self.syntax_style = styles.default_dark_syntax_style
        elif colors=='nocolor':
            self.style_sheet = styles.default_bw_style_sheet
            self.syntax_style = styles.default_bw_syntax_style
        else:
            raise KeyError("No such color scheme: %s"%colors)