def _disable_reinteract_output(self): self.statement = _Statement.get_current() if self.statement is not None: self.old_reinteract_output = self.statement.result_scope[ 'reinteract_output'] if self._disable_output: self.statement.result_scope[ 'reinteract_output'] = lambda *args: None
def _set_rcParams(): """Add new values to rcParams and read in values from refigurerc file(s).""" _p.rcParams.validate.update({'refigure.printdpi': _p.matplotlib.rcsetup.validate_float, 'refigure.disableoutput': _p.matplotlib.rcsetup.validate_bool, 'refigure.keyboardcontrol': _p.matplotlib.rcsetup.validate_bool, 'refigure.display': _p.matplotlib.rcsetup.ValidateInStrings('refigure.display', ['inline', 'side']), 'refigure.toolbar': _p.matplotlib.rcsetup.validate_bool, }) _p.rcParams.update({'figure.figsize': [6.0, 4.5], 'figure.subplot.bottom': 0.12, 'refigure.printdpi': 300, 'refigure.disableoutput': False, 'refigure.keyboardcontrol': True, 'refigure.display': 'inline', 'refigure.toolbar': True, }) paths = ((_os.path.dirname(__file__), 'refigurerc'), (_os.path.expanduser('~'), '.matplotlib', 'refigurerc')) statement = _Statement.get_current() if statement is not None: paths += ((statement._Statement__worksheet.notebook.folder, 'refigurerc'),) for filename in (_os.path.join(*p) for p in paths): if _os.path.exists(filename): for line in file(filename, 'r'): stripline = line.split('#', 1)[0].strip() if not stripline: continue key, val = [s.strip() for s in stripline.split(':', 1)] try: _p.rcParams[key] = val except KeyError: print "Warning: Invalid key %s in %s"%(key, filename) print " See rcParams.keys() for a list of valid keys." except Exception: print "Warning: Bad value for %s: %s\n in %s"%(key, val, filename)
def _disable_reinteract_output(self): self.statement = _Statement.get_current() if self.statement is not None: self.old_reinteract_output = self.statement.result_scope['reinteract_output'] if self._disable_output: self.statement.result_scope['reinteract_output'] = lambda *args: None