Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def icon(name, scale_factor=None, resample=False, icon_path=None):
theme = CONF.get('appearance', 'icon_theme')
if theme == 'spyder 3':
if not _resource['loaded']:
qta.load_font('spyder', 'spyder.ttf', 'spyder-charmap.json',
directory=_resource['directory'])
_resource['loaded'] = True
args, kwargs = _qtaargs[name]
if scale_factor is not None:
kwargs['scale_factor'] = scale_factor
return qta.icon(*args, **kwargs)
elif theme == 'spyder 2':
icon = get_icon(name + '.png', resample=resample)
if icon_path:
icon_path = osp.join(icon_path, name + '.png')
if osp.isfile(icon_path):
icon = QIcon(icon_path)
return icon if icon is not None else QIcon()