def set_config(self, **cfg): # Remap deprecated names if u'bgcolor' in cfg: warnings.warn(u'bgcolor is a deprecated style argument. ' 'Use background_color instead.', DeprecationWarning) cfg[u'background_color'] = cfg[u'bgcolor'] del cfg['bgcolor'] if u'fgcolor' in cfg: warnings.warn(u'fgcolor is a deprecated style argument. ' 'Use color instead.', DeprecationWarning) cfg[u'color'] = cfg[u'fgcolor'] del cfg['fgcolor'] if u'font_style' in cfg: warnings.warn(u'font_style is a deprecated style argument. ' 'Use font_family instead.', DeprecationWarning) cfg[u'font_family'] = cfg[u'font_style'] del cfg['font_style'] # Convert color to backend specific colors if u'color' in cfg and not hasattr(cfg[u'color'], u'backend_color'): cfg[u'color'] = color(self.experiment, cfg[u'color']) if u'background_color' in cfg \ and not hasattr(cfg[u'background_color'], u'backend_color'): cfg[u'background_color'] = color(self.experiment, cfg[u'background_color']) backend.set_config(self, **cfg)
def set_config(self, **cfg): # Add synonyms to keylist if u'keylist' in cfg and isinstance(cfg[u'keylist'], list): for key in list(cfg[u'keylist']): cfg[u'keylist'] += [key for key in self.synonyms(key) \ if key not in cfg[u'keylist']] backend.set_config(self, **cfg)
def set_config(self, **cfg): # Create a new keylist that also contains synonyms if u'keylist' in cfg and isinstance(cfg[u'keylist'], list): keylist = list(cfg[u'keylist']) for key in keylist: keylist += [key for key in self.synonyms(key) \ if key not in keylist] cfg[u'keylist'] = keylist backend.set_config(self, **cfg)
def set_config(self, **cfg): # Add synonyms to keylist if u'buttonlist' in cfg and isinstance(cfg[u'buttonlist'], list): try: cfg[u'buttonlist'] = \ [int(button) for button in cfg[u'buttonlist']] except: raise osexception( u"buttonlist must be a list of numeric values, or None") backend.set_config(self, **cfg)