Пример #1
0
def color_icon(color):
    pixmap = QPixmap(12, 12)
    if color is None:
        color = Color(0, 0, 0, 0)
    pixmap.fill(get_cached_qcolor(color))
    icg = IconImage(image=Image(_tkdata=pixmap.toImage()))
    return Icon(images=[icg])
Пример #2
0
def _load_icon_(path, name):
    fname = os.path.join(path, name)
    with open(fname, 'rb') as f:
        data = f.read()
    img = Image(data=data)
    icg = IconImage(image=img)

    return Icon(images=[icg])
Пример #3
0
def load_icon(icon_name=None):
    """
    load icon image
    """
    image_file = get_icon(icon_name)
    with open(image_file, 'rb') as f:
        data = f.read()
    img = Image(data=data)
    icg = IconImage(image=img)
    return Icon(images=[icg])
Пример #4
0
def _load_icon2_(path, normalname, activename):

    normalfname = os.path.join(path, normalname)

    activename = os.path.join(path, activename)

    with open(normalfname, 'rb') as f1:
        data1 = f1.read()
    normalimg = Image(data=data1)

    normalicg = IconImage(image=normalimg)
    normalicg.mode = 'normal'

    with open(activename, 'rb') as f2:
        data2 = f2.read()
    activeimg = Image(data=data2)

    activeicg = IconImage(image=activeimg)
    activeicg.mode = 'active'

    return Icon(images=[normalicg, activeicg])
Пример #5
0
def load_icon(name):
    img = load_image(name)
    icg = IconImage(image=img)
    return Icon(images=[icg])
Пример #6
0
def get_enaml_icon(name, **kwargs):
    image = get_enaml_image(name, **kwargs)
    return Icon(images=[IconImage(image=image)])
Пример #7
0
def load_icon():
    path = Path(__file__).parent / 'psi-logo.png'
    image = Image(data=path.read_bytes())
    icon_image = IconImage(image=image)
    return Icon(images=[icon_image])