Ejemplo n.º 1
0
class SpotPanel(SolidFillPanel):
    mixer = None
    refpanel = None

    def build(self):
        self.pack(wal.HPanel(self), fill=True, expand=True)
        self.mixer = SpotMixer(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, SPOT_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 = color_to_spot(fill[2])
        elif not new_color and not fill:
            new_color = get_registration_black()
        else:
            new_color = color_to_spot(new_color)
        if not new_color[3]:
            new_color[3] = rgb_to_hexcolor(cms.get_rgb_color(new_color)[1])
        SolidFillPanel.activate(self, cms, orig_fill, new_color)
        self.update()
Ejemplo n.º 2
0
    def build(self):
        self.pack(wal.HPanel(self), fill=True, expand=True)
        self.mixer = SpotMixer(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, SPOT_PALETTE,
                              self.on_palette_click)
        bot_panel.pack(minipal, padding_all=5)

        self.pack(bot_panel, fill=True)