def __init__(self, app, prefpanel, parent): self.app = app self.prefpanel = prefpanel wal.HPanel.__init__(self, parent) data = self.get_palette_list() self.pal_list = wal.SimpleList(self, data, on_select=self.change_palette) self.pack(self.pal_list, expand=True, fill=True, padding_all=5) self.pal_viewer = PaletteViewer(self, self.app.default_cms) self.pack(self.pal_viewer, fill=True, padding_all=5) btn_box = wal.VPanel(self) self.pack(btn_box, fill=True, padding_all=5) btn_box.pack(wal.Button(btn_box, _('Import'), onclick=self.import_palette), fill=True, end_padding=5) btn_box.pack(wal.Button(btn_box, _('Export'), onclick=self.export_palette), fill=True, end_padding=5) self.remove_btn = wal.Button(btn_box, _('Remove'), onclick=self.remove_palette) btn_box.pack(self.remove_btn, fill=True, end_padding=5) self.edit_btn = wal.Button(btn_box, _('Edit info'), onclick=self.edit_info) btn_box.pack(self.edit_btn, fill=True, end_padding=5) btn_box.pack(wal.VPanel(btn_box), fill=True, expand=True) btn_box.pack(wal.ImageButton(btn_box, icons.PD_DOWNLOAD48, tooltip=_('Download more palettes'), flat=False, onclick=self.download_more), fill=True, end_padding=5) # btn_box.pack(CollectionButton(btn_box, self.app, self, # self.prefpanel.dlg), fill=True, end_padding=5) self.update_palette_list()
def __init__(self, parent): self.parent = parent self.app = parent.parent.app wal.VPanel.__init__(self, parent) self.viewer = PaletteViewer(self, self.app.default_cms) self.pack(self.viewer, expand=True, fill=True)
def build(self): self.nb = wal.Notebook(self) # ========Palette options pal_opt = wal.VPanel(self.nb) pal_opt.pack((10, 10)) grid = wal.GridPanel(self, hgap=5, vgap=5) grid.add_growable_col(1) txt = _('Current palette:') grid.pack(wal.Label(grid, txt)) pal_list = self.get_palette_list() self.pal = wal.Combolist(grid, items=pal_list, onchange=self.change_palette) current_palette = self.get_current_palette() current_palette_name = current_palette.model.name self.pal.set_active(pal_list.index(current_palette_name)) grid.pack(self.pal, fill=True) txt = _('Palette orientation:') grid.pack(wal.Label(grid, txt)) self.pal_orient = wal.Combolist(grid, items=PAL_ORIENT) self.pal_orient.set_active(config.palette_orientation) grid.pack(self.pal_orient) pal_opt.pack(grid, fill=True, padding_all=5) btm_panel = wal.HPanel(pal_opt) pal_opt.pack(btm_panel, expand=True, fill=True) cell_panel = wal.VPanel(btm_panel) btm_panel.pack(cell_panel, expand=True, fill=True, padding_all=5) # === txt = _('Vertical palette') vcell_panel = wal.LabeledPanel(cell_panel, text=txt) grid = wal.GridPanel(vcell_panel, cols=4, hgap=5, vgap=2) grid.pack((15, 1)) grid.pack(wal.Label(grid, _('Cell width:'))) self.vcell_width = wal.IntSpin(grid, config.palette_vcell_width, (10, 20)) self.vcell_width.set_enable(False) grid.pack(self.vcell_width) grid.pack(wal.Label(grid, _('px'))) grid.pack((15, 1)) grid.pack(wal.Label(grid, _('Cell height:'))) self.vcell_height = wal.IntSpin(grid, config.palette_vcell_height, (10, 100)) grid.pack(self.vcell_height) grid.pack(wal.Label(grid, _('px'))) vcell_panel.pack(grid, align_center=False, padding_all=5) cell_panel.pack(vcell_panel, fill=True) # === txt = _('Horizontal palette') hcell_panel = wal.LabeledPanel(cell_panel, text=txt) grid = wal.GridPanel(hcell_panel, cols=4, hgap=5, vgap=2) grid.pack((15, 1)) grid.pack(wal.Label(grid, _('Cell width:'))) self.hcell_width = wal.IntSpin(grid, config.palette_hcell_width, (10, 100)) grid.pack(self.hcell_width) grid.pack(wal.Label(grid, _('px'))) grid.pack((15, 1)) grid.pack(wal.Label(grid, _('Cell height:'))) self.hcell_height = wal.IntSpin(grid, config.palette_hcell_height, (10, 20)) self.hcell_height.set_enable(False) grid.pack(self.hcell_height) grid.pack(wal.Label(grid, _('px'))) hcell_panel.pack(grid, align_center=False, padding_all=5) cell_panel.pack(hcell_panel, fill=True, padding=5) # === txt = _('Expand short palettes') self.expand = wal.Checkbox(cell_panel, txt, config.palette_expand) cell_panel.pack(self.expand, align_center=False) self.palviewer = PaletteViewer(btm_panel, self.app.default_cms, current_palette) btm_panel.pack(self.palviewer, fill=True, padding_all=5) self.nb.add_page(pal_opt, _('Palette options')) # ========Palette management self.nb.add_page(PaletteManager(self.app, self, self.nb), _('Palette management')) self.pack(self.nb, expand=True, fill=True) self.built = True