Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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)
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)
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)
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)
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)
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,
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
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
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(