コード例 #1
0
ファイル: __init__.py プロジェクト: ppawlak/pystacia
        depth, type = self.depth, self.type.name  # @ReservedAssignment
        colorspace, addr = self.colorspace.name, id(self)
        class_ = self.__class__.__name__

        return formattable(template).format(class_=class_,
                                            w=w,
                                            h=h,
                                            depth=depth,
                                            colorspace=colorspace,
                                            addr=hex(addr),
                                            type=type)


from pystacia import registry

registry._install_default('image_factory', Image)  # @UndefinedVariable

from pystacia.compat import formattable, gui_open
from pystacia import color
color_module = color
from pystacia.api.func import c_call
from pystacia import magick
from pystacia.api.enum import (lookup as enum_lookup, reverse_lookup as
                               enum_reverse_lookup)

if not registry.get('no_chains', environ.get('PYSTACIA_NO_CHAINS')):
    registry._lock('no_chains')
    # perform chainability
    from pystacia.util import chainable

    for key in (key for key in Image.__dict__ if not key.startswith('_')):
コード例 #2
0
ファイル: __init__.py プロジェクト: ppawlak/pystacia
    def __repr__(self):
        template = "<{class_}(w={w},h={h},{depth}bit" ",{colorspace},{type}) object at {addr}>"
        w, h = self.size
        depth, type = self.depth, self.type.name  # @ReservedAssignment
        colorspace, addr = self.colorspace.name, id(self)
        class_ = self.__class__.__name__

        return formattable(template).format(
            class_=class_, w=w, h=h, depth=depth, colorspace=colorspace, addr=hex(addr), type=type
        )


from pystacia import registry

registry._install_default("image_factory", Image)  # @UndefinedVariable


from pystacia.compat import formattable, gui_open
from pystacia import color

color_module = color
from pystacia.api.func import c_call
from pystacia import magick
from pystacia.api.enum import lookup as enum_lookup, reverse_lookup as enum_reverse_lookup


if not registry.get("no_chains", environ.get("PYSTACIA_NO_CHAINS")):
    registry._lock("no_chains")
    # perform chainability
    from pystacia.util import chainable
コード例 #3
0
    def __eq__(self, other):
        return self.get_rgba() == cast(other).get_rgba()

    def __str__(self):
        return self.get_string()

    def __repr__(self):
        template = ('<{class_}(r={0},g={1},b={2},a={3})' ' object at {id}>')
        kw = dict(id=hex(id(self)), class_=self.__class__.__name__)

        return formattable(template).format(*self.get_rgba(), **kw)


from pystacia import registry

registry._install_default('color_factory', Color)  # @UndefinedVariable


class Factory(object):
    """Convenience color factory for SVG names"""
    def __getattr__(self, string):
        return from_string(string)


def cast(value):
    if isinstance(value, Color):
        return value
    elif isinstance(value, integer_types):
        return from_int24(value)
    elif isinstance(value, string_types):
        return from_string(value)
コード例 #4
0
ファイル: __init__.py プロジェクト: ppawlak/pystacia
        return self.get_rgba() == cast(other).get_rgba()

    def __str__(self):
        return self.get_string()

    def __repr__(self):
        template = ('<{class_}(r={0},g={1},b={2},a={3})'
                    ' object at {id}>')
        kw = dict(id=hex(id(self)), class_=self.__class__.__name__)

        return formattable(template).format(*self.get_rgba(), **kw)


from pystacia import registry

registry._install_default('color_factory', Color)  # @UndefinedVariable


class Factory(object):

    """Convenience color factory for SVG names"""

    def __getattr__(self, string):
        return from_string(string)


def cast(value):
    if isinstance(value, Color):
        return value
    elif isinstance(value, integer_types):
        return from_int24(value)