How to use the chameleon.chameleon.Params function in Chameleon

To help you get started, we’ve selected a few Chameleon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seebye / chameleon / chameleon / chameleon.py View on Github external
def main():
    disp = display.Display()
    root = disp.screen().root
    wnd = ui.ColorWindow(disp, Params.margin, Params.size, Params.border)
    count = itertools.count()
    calc = colors.ColorCalculator(Params.conversion)
    rgbs = colors.parse_hex_rgb(*Params.COLORS)

    with ui.WindowMapper(wnd) as mapper,\
            ui.create_font_cursor(disp, Xcursorfont.tcross) as cursor,\
            ui.pick_coordinate(disp, cursor):
        for e in ui.events(disp):
            x, y = ui.get_pointer_position(root, e)
            rgb = calc.calc(*itertools.chain(
                (ui.get_pixel(root, x, y),), rgbs))

            if e.type == X.ButtonPress and e.detail == X.MOUSE_BUTTON_LEFT:
                print(Params.format.format(*rgb))
                if next(count) + 1 >= Params.count:
                    break
github seebye / chameleon / chameleon / chameleon.py View on Github external
for e in ui.events(disp):
            x, y = ui.get_pointer_position(root, e)
            rgb = calc.calc(*itertools.chain(
                (ui.get_pixel(root, x, y),), rgbs))

            if e.type == X.ButtonPress and e.detail == X.MOUSE_BUTTON_LEFT:
                print(Params.format.format(*rgb))
                if next(count) + 1 >= Params.count:
                    break

                mapper.append(ui.ColorWindow(
                    disp,
                    (len(mapper) * (Params.size + Params.separator) +
                        Params.margin),
                    Params.size,
                    Params.border,
                    rgb))

            elif e.type in (X.Expose, X.MotionNotify):
                for w in mapper:
                    if e.type == X.Expose:
                        w.draw()
                    w.move(x, y)
                wnd.draw(rgb)
github seebye / chameleon / chameleon / chameleon.py View on Github external
def _init_key(self, key):
        val_def = Params.__default.get(key)
        val = Params.__dict[key]

        try:
            int(val_def)
        except (TypeError, ValueError):
            return val
        return int(val)
github seebye / chameleon / chameleon / chameleon.py View on Github external
with ui.WindowMapper(wnd) as mapper,\
            ui.create_font_cursor(disp, Xcursorfont.tcross) as cursor,\
            ui.pick_coordinate(disp, cursor):
        for e in ui.events(disp):
            x, y = ui.get_pointer_position(root, e)
            rgb = calc.calc(*itertools.chain(
                (ui.get_pixel(root, x, y),), rgbs))

            if e.type == X.ButtonPress and e.detail == X.MOUSE_BUTTON_LEFT:
                print(Params.format.format(*rgb))
                if next(count) + 1 >= Params.count:
                    break

                mapper.append(ui.ColorWindow(
                    disp,
                    (len(mapper) * (Params.size + Params.separator) +
                        Params.margin),
                    Params.size,
                    Params.border,
                    rgb))

            elif e.type in (X.Expose, X.MotionNotify):
                for w in mapper:
                    if e.type == X.Expose:
                        w.draw()
                    w.move(x, y)
                wnd.draw(rgb)
github seebye / chameleon / chameleon / chameleon.py View on Github external
root = disp.screen().root
    wnd = ui.ColorWindow(disp, Params.margin, Params.size, Params.border)
    count = itertools.count()
    calc = colors.ColorCalculator(Params.conversion)
    rgbs = colors.parse_hex_rgb(*Params.COLORS)

    with ui.WindowMapper(wnd) as mapper,\
            ui.create_font_cursor(disp, Xcursorfont.tcross) as cursor,\
            ui.pick_coordinate(disp, cursor):
        for e in ui.events(disp):
            x, y = ui.get_pointer_position(root, e)
            rgb = calc.calc(*itertools.chain(
                (ui.get_pixel(root, x, y),), rgbs))

            if e.type == X.ButtonPress and e.detail == X.MOUSE_BUTTON_LEFT:
                print(Params.format.format(*rgb))
                if next(count) + 1 >= Params.count:
                    break

                mapper.append(ui.ColorWindow(
                    disp,
                    (len(mapper) * (Params.size + Params.separator) +
                        Params.margin),
                    Params.size,
                    Params.border,
                    rgb))

            elif e.type in (X.Expose, X.MotionNotify):
                for w in mapper:
                    if e.type == X.Expose:
                        w.draw()
                    w.move(x, y)
github seebye / chameleon / chameleon / chameleon.py View on Github external
wnd = ui.ColorWindow(disp, Params.margin, Params.size, Params.border)
    count = itertools.count()
    calc = colors.ColorCalculator(Params.conversion)
    rgbs = colors.parse_hex_rgb(*Params.COLORS)

    with ui.WindowMapper(wnd) as mapper,\
            ui.create_font_cursor(disp, Xcursorfont.tcross) as cursor,\
            ui.pick_coordinate(disp, cursor):
        for e in ui.events(disp):
            x, y = ui.get_pointer_position(root, e)
            rgb = calc.calc(*itertools.chain(
                (ui.get_pixel(root, x, y),), rgbs))

            if e.type == X.ButtonPress and e.detail == X.MOUSE_BUTTON_LEFT:
                print(Params.format.format(*rgb))
                if next(count) + 1 >= Params.count:
                    break

                mapper.append(ui.ColorWindow(
                    disp,
                    (len(mapper) * (Params.size + Params.separator) +
                        Params.margin),
                    Params.size,
                    Params.border,
                    rgb))

            elif e.type in (X.Expose, X.MotionNotify):
                for w in mapper:
                    if e.type == X.Expose:
                        w.draw()
                    w.move(x, y)
                wnd.draw(rgb)
github seebye / chameleon / chameleon / chameleon.py View on Github external
def main():
    disp = display.Display()
    root = disp.screen().root
    wnd = ui.ColorWindow(disp, Params.margin, Params.size, Params.border)
    count = itertools.count()
    calc = colors.ColorCalculator(Params.conversion)
    rgbs = colors.parse_hex_rgb(*Params.COLORS)

    with ui.WindowMapper(wnd) as mapper,\
            ui.create_font_cursor(disp, Xcursorfont.tcross) as cursor,\
            ui.pick_coordinate(disp, cursor):
        for e in ui.events(disp):
            x, y = ui.get_pointer_position(root, e)
            rgb = calc.calc(*itertools.chain(
                (ui.get_pixel(root, x, y),), rgbs))

            if e.type == X.ButtonPress and e.detail == X.MOUSE_BUTTON_LEFT:
                print(Params.format.format(*rgb))
                if next(count) + 1 >= Params.count:
                    break

                mapper.append(ui.ColorWindow(
                    disp,
github seebye / chameleon / chameleon / chameleon.py View on Github external
def __getattr__(self, name):
        key = name if name in Params.__dict \
            else '--' + name
        val = Params.__typed.get(key)

        if not val:
            val = self._init_key(key)
            Params.__typed[key] = val

        return val
github seebye / chameleon / chameleon / chameleon.py View on Github external
def __getattr__(self, name):
        key = name if name in Params.__dict \
            else '--' + name
        val = Params.__typed.get(key)

        if not val:
            val = self._init_key(key)
            Params.__typed[key] = val

        return val
github seebye / chameleon / chameleon / chameleon.py View on Github external
def main():
    disp = display.Display()
    root = disp.screen().root
    wnd = ui.ColorWindow(disp, Params.margin, Params.size, Params.border)
    count = itertools.count()
    calc = colors.ColorCalculator(Params.conversion)
    rgbs = colors.parse_hex_rgb(*Params.COLORS)

    with ui.WindowMapper(wnd) as mapper,\
            ui.create_font_cursor(disp, Xcursorfont.tcross) as cursor,\
            ui.pick_coordinate(disp, cursor):
        for e in ui.events(disp):
            x, y = ui.get_pointer_position(root, e)
            rgb = calc.calc(*itertools.chain(
                (ui.get_pixel(root, x, y),), rgbs))

            if e.type == X.ButtonPress and e.detail == X.MOUSE_BUTTON_LEFT:
                print(Params.format.format(*rgb))
                if next(count) + 1 >= Params.count:
                    break

                mapper.append(ui.ColorWindow(