def set_option(self, option, value): """ Set a plugin option in configuration file Use a SIGNAL to call it, e.g.: plugin.sig_option_changed.emit('show_all', checked) """ CONF.set(self.CONF_SECTION, str(option), value)
def update_margins(self): layout = self.layout() if self.default_margins is None: self.default_margins = layout.getContentsMargins() if CONF.get('main', 'use_custom_margin', True): margin = CONF.get('main', 'custom_margin', 0) layout.setContentsMargins(*[margin]*4) else: layout.setContentsMargins(*self.default_margins)
def set_default_color_scheme(self, name='Spyder'): """Set default color scheme (only once)""" color_scheme_name = self.get_option('color_scheme_name', None) if color_scheme_name is None: names = CONF.get("color_schemes", "names") if name not in names: name = names[0] self.set_option('color_scheme_name', name)
def init_parameters(self): ''' Initialize the parameters of the simulation ''' try: population_file = CONF.get('paths', 'population_file') store_pop = HDFStore(population_file,'r') self.population_choices = store_pop.keys() store_pop.close() profiles_file = CONF.get('paths', 'profiles_file') store_prof = HDFStore(profiles_file,'r') profiles = store_prof['profiles'] self.set_population_prolong() self.set_taxes_proj() except Exception, e: self.population_loaded = False QMessageBox.warning(self, u"Impossible de lire les données de population", u"GA n'a pas réussi à lire les données de population. L'erreur suivante a été renvoyée:\n%s\n\nVous pouvez configuer le chemin vers le fichier de données Fichier>Paramètres>Chemins>Fichier données population"%e) return False
def init_parameters(self): ''' Initialize the parameters of the simulation ''' try: population_file = CONF.get('paths', 'population_file') store_pop = HDFStore(population_file, 'r') self.population_choices = store_pop.keys() store_pop.close() profiles_file = CONF.get('paths', 'profiles_file') store_prof = HDFStore(profiles_file, 'r') profiles = store_prof['profiles'] self.set_population_prolong() self.set_taxes_proj() except Exception, e: self.population_loaded = False QMessageBox.warning( self, u"Impossible de lire les données de population", u"GA n'a pas réussi à lire les données de population. L'erreur suivante a été renvoyée:\n%s\n\nVous pouvez configuer le chemin vers le fichier de données Fichier>Paramètres>Chemins>Fichier données population" % e) return False
def get_option(self, option, default=NoDefault): """ Get a plugin option from configuration file """ return CONF.get(self.CONF_SECTION, option, default)
def get_option(self, option, default=NoDefault): return CONF.get(self.CONF_SECTION, option, default)
def set_option(self, option, value): CONF.set(self.CONF_SECTION, option, value)
from src.gui.config import CONF #============================================================================== # General configuration #============================================================================== # If your extensions are in another directory, add it here. If the directory # is relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. #sys.path.append(os.path.abspath('.')) # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # We need jsmath to get pretty plain-text latex in docstrings math = CONF.get('inspector', 'math', '') if sphinx_version < "1.1" or not math: extensions = ['sphinx.ext.jsmath'] else: extensions = ['sphinx.ext.mathjax'] # Add any paths that contain templates here, relative to this directory. templates_path = ['templates'] # MathJax load path (doesn't have effect for sphinx 1.0-) mathjax_path = 'MathJax/MathJax.js' # JsMath load path (doesn't have effect for sphinx 1.1+) jsmath_path = 'easy/load.js'