Exemplo n.º 1
0
class PsyRcParamsWidget(RcParamsWidget):
    """The config page for the :class:`psyplot.config.rcsetup.rcParams`"""

    rc = psy_rcParams

    title = 'psyplot defaults'

    default_path = psyplot_fname(if_exists=False)
Exemplo n.º 2
0
def psyplot_gui_fname():
    """
    Get the location of the config file.

    The file location is determined by the
    :func:`psyplot.config.rcsetup.psyplot_fname` function"""
    psyplot_file = psyplot_fname()
    if psyplot_file:
        return osp.join(osp.dirname(psyplot_file), 'psyplotguirc.yaml')
    return None
Exemplo n.º 3
0
class GuiRcParamsWidget(RcParamsWidget):
    """The config page for the :class:`psyplot_gui.config.rcsetup.rcParams`"""

    rc = rcParams

    title = 'GUI defaults'

    default_path = psyplot_fname('PSYPLOTGUIRC',
                                 'psyplotguirc.yml',
                                 if_exists=False)
Exemplo n.º 4
0
    def load_from_file(self, fname=None):
        """
        Update rcParams from user-defined settings

        This function updates the instance with what is found in `fname`

        Parameters
        ----------
        fname: str
            Path to the yaml configuration file. Possible keys of the
            dictionary are defined by :data:`config.rcsetup.defaultParams`.
            If None, the :func:`config.rcsetup.psyplot_fname` function is used.

        See Also
        --------
        dump_to_file, psyplot_fname"""
        fname = fname or psyplot_fname(env_key='PSYPLOTGUIRC',
                                       fname='psyplotguirc.yml')
        if fname:
            super(GuiRcParams, self).load_from_file(fname)
Exemplo n.º 5
0
    def load_from_file(self, fname=None):
        """
        Update rcParams from user-defined settings

        This function updates the instance with what is found in `fname`

        Parameters
        ----------
        fname: str
            Path to the yaml configuration file. Possible keys of the
            dictionary are defined by :data:`config.rcsetup.defaultParams`.
            If None, the :func:`config.rcsetup.psyplot_fname` function is used.

        See Also
        --------
        dump_to_file, psyplot_fname"""
        fname = fname or psyplot_fname(env_key='PSYPLOTGUIRC',
                                       fname='psyplotguirc.yml')
        if fname:
            super(GuiRcParams, self).load_from_file(fname)
Exemplo n.º 6
0
"""Configuration module of the psyplot package

This module contains the module for managing rc parameters and the logging.
Default parameters are defined in the :data:`rcsetup.defaultParams`
dictionary, however you can set up your own configuration in a yaml file (see
:func:`psyplot.load_rc_from_file`)"""
import os.path as osp
from psyplot.config.logsetup import setup_logging
from psyplot.config.rcsetup import psyplot_fname

#: :class:`str`. Path to the yaml logging configuration file
logcfg_path = setup_logging(default_path=osp.join(osp.dirname(__file__),
                                                  'logging.yml'),
                            env_key='LOG_PSYPLOTGUI')

#: class:`str` or ``None``. Path to the yaml configuration file (if found).
#: See :func:`psyplot.config.rcsetup.psyplot_fname` for further
#: information
config_path = psyplot_fname(env_key='PSYPLOTGUIRC', fname='psyplotguirc.yaml')