def __init__(self, parent, dlg, cms, image_style, onchange=None): self.image_style = deepcopy(image_style) self.callback = onchange wal.HPanel.__init__(self, parent) self.pack(wal.Label(self, _('Fg:'))) txt = _('Change pattern foreground color') self.fg_btn = PDColorButton(self, dlg, cms, self.image_style[0], txt, onchange=self.fg_changed) self.pack(self.fg_btn, padding=5) self.pack((10, 1)) self.pack(wal.Label(self, _('Bg:'))) txt = _('Change pattern background color') self.bg_btn = PDColorButton(self, dlg, cms, self.image_style[1], txt, onchange=self.bg_changed) self.pack(self.bg_btn, padding=5)
def __init__(self, parent, dlg, cms, stops, sel_stop=0, onposition=None, oncolor=None): self.dlg = dlg self.cms = cms self.stops = stops self.selected_stop = sel_stop self.pos_callback = onposition self.color_callback = oncolor wal.LabeledPanel.__init__(self, parent, text=_('Gradient stop')) grid = wal.GridPanel(self, cols=3, vgap=5, hgap=5) grid.pack(wal.Label(grid, _('Color value:'))) clr = self.stops[self.selected_stop][1] txt = _('Change stop color') self.swatch = PDColorButton(grid, self.dlg, self.cms, clr, txt, onchange=self.edit_color) grid.pack(self.swatch) grid.pack((1, 1)) grid.pack(wal.Label(grid, _('Position:'))) self.position = wal.FloatSpin(grid, range_val=(0.0, 100.0), step=1.0, onchange=self.pos_changed, onenter=self.pos_changed) grid.pack(self.position) grid.pack(wal.Label(grid, '%')) self.pack(grid, align_center=False, padding_all=10)