class CmykPanel(SolidFillPanel): color_sliders = [] color_spins = [] mixer = None refpanel = None def build(self): self.mixer = CmykMixer(self, self.cms, onchange=self.update) self.pack(self.mixer) self.pack(wal.HPanel(self), fill=True, expand=True) self.pack(wal.HLine(self), fill=True, padding=5) bot_panel = wal.HPanel(self) self.refpanel = FillColorRefPanel(bot_panel, self.cms, [], [], on_orig=self.set_orig_fill) bot_panel.pack(self.refpanel) bot_panel.pack(wal.HPanel(bot_panel), fill=True, expand=True) minipal = MiniPalette(bot_panel, self.cms, CMYK_PALETTE, self.on_palette_click) bot_panel.pack(minipal, padding_all=5) self.pack(bot_panel, fill=True) def on_palette_click(self, color): self.new_color = color self.update() def update(self): self.mixer.set_color(self.new_color) self.refpanel.update(self.orig_fill, self.new_color) def activate(self, cms, orig_fill, new_color): fill = None if orig_fill and orig_fill[1] == sk2const.FILL_SOLID: fill = orig_fill if not new_color and fill: new_color = cms.get_cmyk_color(fill[2]) elif not new_color and not fill: new_color = [uc2const.COLOR_CMYK, [0.0, 0.0, 0.0, 1.0], 1.0, ''] else: new_color = cms.get_cmyk_color(new_color) SolidFillPanel.activate(self, cms, orig_fill, new_color) self.update()
def build(self): self.mixer = CmykMixer(self, self.cms, onchange=self.update) self.pack(self.mixer) self.pack(wal.HPanel(self), fill=True, expand=True) self.pack(wal.HLine(self), fill=True, padding=5) bot_panel = wal.HPanel(self) self.refpanel = FillColorRefPanel(bot_panel, self.cms, [], [], on_orig=self.set_orig_fill) bot_panel.pack(self.refpanel) bot_panel.pack(wal.HPanel(bot_panel), fill=True, expand=True) minipal = MiniPalette(bot_panel, self.cms, CMYK_PALETTE, self.on_palette_click) bot_panel.pack(minipal, padding_all=5) self.pack(bot_panel, fill=True)