~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/pygimp/plug-ins/palette-sort.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
gettext.install("gimp20-python", gimp.locale_directory, unicode=True)
20
20
 
21
21
def palette_sort (palette, model, channel, ascending):
22
 
    #If palette is read only, work on a copy:        
23
 
    editable = pdb.gimp_palette_is_editable(palette) 
24
 
    if not editable:palette = pdb.gimp_palette_duplicate (palette)     
 
22
    #If palette is read only, work on a copy:
 
23
    editable = pdb.gimp_palette_is_editable(palette)
 
24
    if not editable:palette = pdb.gimp_palette_duplicate (palette)
25
25
 
26
 
    num_colors = pdb.gimp_palette_get_info (palette) 
 
26
    num_colors = pdb.gimp_palette_get_info (palette)
27
27
    entry_list = []
28
28
    for i in xrange (num_colors):
29
29
        entry =  (pdb.gimp_palette_entry_get_name (palette, i),
39
39
        entry_list.reverse()
40
40
    for i in xrange(num_colors):
41
41
        pdb.gimp_palette_entry_set_name (palette, i, entry_list[i][1][0])
42
 
        pdb.gimp_palette_entry_set_color (palette, i, entry_list[i][1][1])  
43
 
    
 
42
        pdb.gimp_palette_entry_set_color (palette, i, entry_list[i][1][1])
 
43
 
44
44
    return palette
45
45
 
46
46
 
55
55
    "",
56
56
    [
57
57
        (PF_PALETTE, "palette",  _("Palette"), ""),
58
 
        (PF_RADIO,   "model",    _("Color _model"), "HSV", 
59
 
                                    ((_("RGB"), "RGB"), 
 
58
        (PF_RADIO,   "model",    _("Color _model"), "HSV",
 
59
                                    ((_("RGB"), "RGB"),
60
60
                                     (_("HSV"), "HSV"))),
61
 
        (PF_RADIO,   "channel",  _("Channel to _sort"), 2, 
62
 
                                    ((_("Red or Hue"),          0), 
63
 
                                     (_("Green or Saturation"), 1), 
 
61
        (PF_RADIO,   "channel",  _("Channel to _sort"), 2,
 
62
                                    ((_("Red or Hue"),          0),
 
63
                                     (_("Green or Saturation"), 1),
64
64
                                     (_("Blue or Value"),       2))),
65
65
        (PF_BOOL,   "ascending", _("_Ascending"), True)
66
 
    ],     
 
66
    ],
67
67
    [],
68
68
    palette_sort,
69
69
    menu="<Palettes>",