36 from python_qt_binding.QtGui
import QIcon
39 def get_icon(name, type_=None, base_path=None):
40 if type_ ==
'file' or type_
is None:
42 if base_path
is not None:
43 path = os.path.join(base_path, path)
45 if len(icon.availableSizes()) == 0:
46 raise UserWarning(
'icon "%s" not found' % str(path))
47 elif type_ ==
'resource':
49 if len(icon.availableSizes()) == 0:
50 raise UserWarning(
'icon "%s" not found' % str(path))
51 elif type_ ==
'theme':
53 icon = QIcon.fromTheme(name)
55 raise UserWarning(
'unknown icon type "%s"' % str(type_))