def __init__(self, parent, cms, color=None): self.cms = cms if not color: color = get_registration_black() wal.VPanel.__init__(self, parent, True) nf = wal.VPanel(self) nf.set_bg(wal.BLACK) self.name_field = wal.Label(nf, '???', fontbold=True, fg=wal.WHITE) nf.pack(self.name_field, padding_all=3) vf = wal.VPanel(self) vf.set_bg(wal.WHITE) self.color_type = wal.Label(vf, '???', fontbold=True, fontsize=-1) self.line1 = wal.Label(vf, '???', fontsize=-1) self.line2 = wal.Label(vf, '???', fontsize=-1) vf.pack(self.color_type, padding_all=3) vf.pack(self.line1, padding_all=1) vf.pack(self.line2, padding_all=1) self.color_swatch = AlphaColorSwatch(self, self.cms, color, (180, 100), border='') self.pack(nf, fill=True) self.pack(vf, fill=True) self.pack(self.color_swatch, fill=True, expand=True)
def convert_to_skp(self, skp_doc): skp = skp_doc.model skp.name = self.model.Name.decode('utf-8') if not skp.name: if self.doc_file: name = os.path.basename(self.doc_file) skp.name = name.replace('.xml', '').replace('_', ' ') else: skp.name = self.config.default_name if self.doc_file: filename = os.path.basename(self.doc_file) skp.comments = 'Converted from %s' % filename skp.source = '' + self.config.source for item in self.model.childs: color = None if item.Register == '1': color = cms.get_registration_black() if item.Spot == '1': rgb = [] cmyk = [] if item.RGB: rgb = cms.hexcolor_to_rgb(item.RGB) if item.CMYK: cmyk = cms.hexcolor_to_cmyk(item.CMYK) name = item.NAME.decode('utf-8') color = [COLOR_SPOT, [rgb, cmyk], 1.0, name] elif item.CMYK: cmyk = cms.hexcolor_to_cmyk(item.CMYK) name = item.NAME.decode('utf-8') color = [COLOR_CMYK, cmyk, 1.0, name] elif item.RGB: rgb = cms.hexcolor_to_rgb(item.RGB) name = item.NAME.decode('utf-8') color = [COLOR_RGB, rgb, 1.0, name] else: continue skp.colors.append(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()
def activate(self, cms, orig_fill, new_color): fill = None if orig_fill and orig_fill[1] == sk2_const.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()
def __init__(self, parent, cms_ref, color=None, onchange=None): wal.VPanel.__init__(self, parent) self.cms = cms_ref if color: self.color = color else: self.color = get_registration_black() if onchange: self.callback = onchange name_panel = wal.HPanel(self) name_panel.pack(wal.Label(name_panel, 'Name:'), padding=5) self.name_field = wal.Entry(name_panel, width=30, onchange=self.on_change) name_panel.pack(self.name_field) self.pack(name_panel, padding_all=5) grid = wal.GridPanel(self, 3, 4, 3, 5) grid.pack((1, 1)) self.rgb_txt = wal.Label(grid, '---') grid.pack(self.rgb_txt) grid.pack((1, 1)) grid.pack((1, 1)) grid.pack((1, 1)) self.cmyk_txt = wal.Label(grid, '---') grid.pack(self.cmyk_txt) grid.pack((1, 1)) grid.pack((1, 1)) grid.pack(wal.Label(grid, 'A:')) self.alpha_slider = ColoredAlphaSlider(grid, onchange=self.on_slider_change) grid.pack(self.alpha_slider) self.alpha_spin = wal.FloatSpin(grid, range_val=(0.0, 100.0), onchange=self.on_change, onenter=self.on_change) grid.pack(self.alpha_spin) grid.pack(wal.Label(self, '%')) self.pack(grid)
def __init__(self, parent, cms, color=None, onchange=None): wal.VPanel.__init__(self, parent) self.cms = cms if color: self.color = color else: self.color = get_registration_black() if onchange: self.callback = onchange name_panel = wal.HPanel(self) name_panel.pack(wal.Label(name_panel, 'Name:'), padding=5) self.name_field = wal.Entry(name_panel, width=30, onchange=self.on_change) name_panel.pack(self.name_field) self.pack(name_panel, padding_all=5) grid = wal.GridPanel(self, 3, 4, 3, 5) grid.pack((1, 1)) self.rgb_txt = wal.Label(grid, '---') grid.pack(self.rgb_txt) grid.pack((1, 1)) grid.pack((1, 1)) grid.pack((1, 1)) self.cmyk_txt = wal.Label(grid, '---') grid.pack(self.cmyk_txt) grid.pack((1, 1)) grid.pack((1, 1)) grid.pack(wal.Label(grid, 'A:')) self.alpha_slider = ColoredAlphaSlider(grid, onchange=self.on_slider_change) grid.pack(self.alpha_slider) self.alpha_spin = wal.FloatSpin(grid, range_val=(0.0, 100.0), width=5, onchange=self.on_change, onenter=self.on_change) grid.pack(self.alpha_spin) grid.pack(wal.Label(self, '%')) self.pack(grid)
def __init__(self, parent, cms_ref, color=None): self.cms = cms_ref if not color: color = get_registration_black() wal.VPanel.__init__(self, parent, True) if wal.IS_MSW: self.set_bg(wal.GRAY) inner_panel = wal.VPanel(self) inner_panel.set_bg(wal.WHITE) nf = wal.VPanel(inner_panel) nf.set_bg(wal.BLACK) self.name_field = wal.Label(nf, '???', fontbold=True, fg=wal.WHITE) nf.pack(self.name_field, padding_all=3) vf = wal.VPanel(inner_panel) vf.set_bg(wal.WHITE) self.color_type = wal.Label(vf, '???', fontbold=True, fontsize=-1, fg=wal.BLACK) self.line1 = wal.Label(vf, '???', fontsize=-1, fg=wal.BLACK) self.line2 = wal.Label(vf, '???', fontsize=-1, fg=wal.BLACK) vf.pack(self.color_type, padding_all=3) vf.pack(self.line1, padding_all=1) vf.pack(self.line2, padding_all=1) self.color_swatch = AlphaColorSwatch(inner_panel, self.cms, color, (180, 100), border='') inner_panel.pack(nf, fill=True) inner_panel.pack(vf, fill=True) inner_panel.pack(self.color_swatch, fill=True, expand=True) padding = 0 if wal.IS_MSW: padding = 1 self.pack(inner_panel, fill=True, expand=True, padding_all=padding) self.layout()
def activate(self, cms, orig_fill, new_color): new_color = get_registration_black() SolidFillPanel.activate(self, cms, orig_fill, new_color) self.mixer.on_change()
[uc2const.COLOR_GRAY, [ 0.8, ], 1.0, '20% Black'], [uc2const.COLOR_GRAY, [ 0.9, ], 1.0, '10% Black'], [uc2const.COLOR_GRAY, [ 0.95, ], 1.0, '5% Black'], [uc2const.COLOR_GRAY, [ 1.0, ], 1.0, 'White'], ] SPOT_PALETTE = [ cms.get_registration_black(), [uc2const.COLOR_SPOT, [[0.7608, 0.6039, 0.2196], []], 1.0, 'Rich Gold'], [uc2const.COLOR_SPOT, [[0.6745, 0.6, 0.3804], []], 1.0, 'Metallic Gold'], [uc2const.COLOR_SPOT, [[0.8471, 0.6118, 0.4667], []], 1.0, 'Bronze'], [uc2const.COLOR_SPOT, [[0.7098, 0.7098, 0.7098], []], 1.0, 'Silver'], [ uc2const.COLOR_SPOT, [[1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0]], 1.0, 'Opaque White' ], [uc2const.COLOR_SPOT, [[1.0, 0.0, 0.0], []], 1.0, 'Fluorescent Red'], [ uc2const.COLOR_SPOT, [[1.0, 0.5922, 0.0118], []], 1.0, 'Fluorescent Orange' ], [uc2const.COLOR_SPOT, [[0.9216, 1.0, 0.0], []], 1.0, 'Fluorescent Yellow'], [uc2const.COLOR_SPOT, [[0.0, 1.0, 0.0157], []], 1.0, 'Fluorescent Green'],
[uc2const.COLOR_GRAY, [0.5, ], 1.0, '50% Black'], [uc2const.COLOR_GRAY, [0.6, ], 1.0, '40% Black'], [uc2const.COLOR_GRAY, [0.7, ], 1.0, '30% Black'], [uc2const.COLOR_GRAY, [0.8, ], 1.0, '20% Black'], [uc2const.COLOR_GRAY, [0.9, ], 1.0, '10% Black'], [uc2const.COLOR_GRAY, [0.95, ], 1.0, '5% Black'], [uc2const.COLOR_GRAY, [1.0, ], 1.0, 'White'], ] SPOT_PALETTE = [ cms.get_registration_black(), [uc2const.COLOR_SPOT, [[0.7608, 0.6039, 0.2196], []], 1.0, 'Rich Gold'], [uc2const.COLOR_SPOT, [[0.6745, 0.6, 0.3804], []], 1.0, 'Metallic Gold'], [uc2const.COLOR_SPOT, [[0.8471, 0.6118, 0.4667], []], 1.0, 'Bronze'], [uc2const.COLOR_SPOT, [[0.7098, 0.7098, 0.7098], []], 1.0, 'Silver'], [uc2const.COLOR_SPOT, [[1.0, 1.0, 1.0 ], [0.0, 0.0, 0.0, 0.0]], 1.0, 'Opaque White'], [uc2const.COLOR_SPOT, [[1.0, 0.0, 0.0], []], 1.0, 'Fluorescent Red'], [uc2const.COLOR_SPOT, [[1.0, 0.5922, 0.0118], []], 1.0, 'Fluorescent Orange'], [uc2const.COLOR_SPOT, [[0.9216, 1.0, 0.0], []], 1.0, 'Fluorescent Yellow'], [uc2const.COLOR_SPOT, [[0.0, 1.0, 0.0157], []], 1.0, 'Fluorescent Green'], [uc2const.COLOR_SPOT, [[0.0549, 0.5647, 1.0], []], 1.0, 'Fluorescent Blue'], [uc2const.COLOR_SPOT, [[1.0, 0.0039, 0.498], []], 1.0, 'Fluorescent Magenta'], ] REG_COLOR = [1.0, 1.0, 1.0, 1.0] REG_SPOT_COLOR = [[0.0, 0.0, 0.0], [1.0, 1.0, 1.0, 1.0]] class HexField(wal.Entry): color = None callback = None