Re: remove layer should not force you to last selected layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've always hated the way that worked, I've got a script that deletes 
the active layer, then sets the layer underneath it to active if anyone 
wants to use it...

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#   delete-layer.py - Version 1.0
#   Copyright (C) 07/11/2008 by Jerry Baker <jbaker@xxxxxxxxxxxxxxxx>
#   www.gimpthoughts.com
#
#   Deletes active layer then selects the layer underneath.
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
02111-1307, USA.

# --- Imports
from gimpfu import *

gettext.install("gimp20-python", gimp.locale_directory, unicode=True)

def delete_layer(image, drawable):
     image.undo_group_start()

     layer_index = image.layers.index(image.active_layer)
     if layer_index == (len(image.layers)-1):
         layer_index -= 1
     image.remove_layer(image.active_layer)
     if layer_index >= 0:
         image.active_layer = image.layers[layer_index]

     image.undo_group_end()

register(
     "delete-layer",
     N_("Deletes active layer then selects the layer underneath."),
     "Deletes active layer then selects the layer underneath.",
     "Jerry Baker",
     "Jerry Baker",
     "07/11/2008",
     N_("Delete Active Layer"),
     "RGB*, GRAY*, INDEXED*",
     [
         # --- Parameters
         (PF_IMAGE, "image", _("Image"), None),
         (PF_DRAWABLE, "layer", _("Drawable"), None),
     ],
     [
         # --- Results
     ],
     delete_layer,
     menu="<Image>/_Layer",
     domain=("gimp20-python", gimp.locale_directory)
     )

main()




On 03/05/2010 02:22 PM, Martin Nordholts wrote:
> On 03/05/2010 03:20 AM, Luiz Felipe Moraes Pereira wrote:
>    
>> Hi again, the original discussion is in the link below:
>> https://bugzilla.gnome.org/show_bug.cgi?id=611758
>>
>> I was advised to present this idea here, what do you think?
>>
>> Also I do not mind much about not having a selected layer after
>> the deletion of a layer. But the forced viewer scroll down( or up ),
>> depending of the last selected layer is a problem.
>>      
> To me, having the layers dialog scroll to a seemingly random place after
> deleting a layer is a clear usability problem. A user should not have to
> worry about what layer that was previously selected when deleting a layer.
>
>    / Martin
>
>
>    

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux