ó
dòôdc           @` sð  d  Z  d d l m Z m Z m Z m Z d d l Td d l Z d d l Z d d l m	 Z	 d d l
 Z
 d d l m Z d d l m Z d d l m Z d	 Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e e d „ Z d „  Z i d d	 6e j d 6e d ƒ d 6e g d 6e d 6i d d 6d d	 6e j d ƒ d 6e d ƒ d 6d d 6i d  d 6d  d	 6d! d 6e d" ƒ d 6d# d 6e d$ 6i d% d 6d& d	 6d' d 6d' e d( ƒ e j j f d) e d* ƒ e j j  f d+ e d, ƒ e j j! f g d- 6e d. ƒ d 6i d/ d 6d0 d	 6d1 d 6e d2 ƒ d 6d3 d 6i d4 d 6d5 d	 6e d 6e d6 ƒ d 6d7 d 6i d4 d 6d8 d	 6e d 6e d9 ƒ d 6d7 d 6i d4 d 6d: d	 6e d 6e d; ƒ d 6d7 d 6g d< 6i d= d	 6e d 6e d> ƒ d 6e g d 6i d? d	 6e d 6e d@ ƒ d 6i dA d	 6e j" d 6e dB ƒ d 6i dC d 6dD d	 6e dE ƒ d 6dF d 6g d< 6i dG d	 6e j# d 6e dH ƒ d 6i dC d 6dD d	 6e dE ƒ d 6dI d 6g d< 6i dJ d	 6e j$ d 6e dK ƒ d 6i d% d 6dL d	 6dM d 6dM e dN ƒ e
 j% f dO e dP ƒ e
 j& f dQ e dR ƒ e
 j' f g d- 6e dS ƒ d 6g d< 6i dT d	 6e j( d 6e dU ƒ d 6i d% d 6dL d	 6dM d 6dM e dN ƒ e
 j% f dO e dP ƒ e
 j& f dQ e dR ƒ e
 j' f g d- 6e dS ƒ d 6g d< 6i dV d	 6e d 6e dW ƒ d 6e g d 6e d 6i d/ d 6dX d	 6dY d 6e dZ ƒ d 6d3 d 6i d4 d 6d[ d	 6e d 6e d\ ƒ d 6d7 d 6i d4 d 6d] d	 6e d 6e d^ ƒ d 6d7 d 6g d< 6i d_ d	 6e d 6e d` ƒ d 6g	 Z) e j* ƒ  Z+ e j* ƒ  Z, x> e) D]6 Z- e- d Z. da e- d <e- e+ e- d	 <e. e, e- d	 <q²Wd S(b   u   Built-in plug-in procedures.i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t   *N(   t   pdb(   t   background_foreground(   t   export(   t   renameru   namec         C` s   t  j |  j ƒ r$ |  j |  j _ ng t  j |  j j ƒ rK |  j j |  _ n@ t |  j j ƒ d k r‹ |  j j d } | |  _ | |  j _ n  d  S(   Ni    (   R   t   gimp_item_is_validt   current_raw_itemt   current_imaget   active_layert   lent   layers(   t   batchert   first_layer(    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt   set_active_and_current_layer   s    	c         c` s*   d  V} | s | d  k r& t |  ƒ n  d  S(   N(   t   NoneR   (   R   t   action_applied(    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt)   set_active_and_current_layer_after_action+   s    c         c` s1   d  V|  j  r- |  j r- |  j j |  j _ n  d  S(   N(   t   process_namest
   is_previewR
   t   namet   current_item(   R   (    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt    sync_item_name_and_raw_item_name2   s    c         c` s  |  j  } t | j t j ƒ } i  } xC | g | j D]1 } t j | j ƒ r5 t j | j ƒ | | <q5 q5 W| rÂ t j | j ƒ rÂ t j	 d k r§ t j
 | j ƒ } n d  } t j | j ƒ } n d  } d  } x6 | j ƒ  D]( \ } } | rÛ t j | j t ƒ qÛ qÛ W| sZ| r;t j	 d k r;t j | j t ƒ q;n  | rZt j | j t ƒ qZn  d  VxH | j ƒ  D]: \ } } | rlt j | j ƒ rlt j | j | ƒ qlqlW| rt j | j ƒ r| rñt j	 d k rñt j | j | ƒ qñn  | rt j | j | ƒ qn  d  S(   Ni   i
   (   i   i
   (   i   i
   (   i   i
   (   R   t
   isinstancet   rawt   gimpt
   GroupLayert   parentsR   R	   t   gimp_item_get_lock_contentt   versiont   gimp_item_get_lock_positionR   t   gimp_layer_get_lock_alphat   itemst   gimp_item_set_lock_contentt   Falset   gimp_item_set_lock_positiont   gimp_layer_set_lock_alpha(   R   t   itemt   is_item_groupt   locks_contentt   item_or_parentt   lock_positiont
   lock_alphat   lock_content(    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt   preserve_locks_between_actions9   s@    	c         C` s   |  j  } g  | _ g  | _ d  S(   N(   R   R   t   children(   R   R(   (    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt!   remove_folder_hierarchy_from_itemh   s    		c         C` sO   |  j  j d } x( |  j j D] } | | j j d } q W| d |  j  _ d  S(   Ng      Y@(   R
   t   opacityR   R   R   (   R   t   new_layer_opacityt   parent(    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt&   inherit_transparency_from_layer_groupso   s    c         c` sÈ   t  j | ƒ } t ƒ  } x© t rÃ | r? | j |  ƒ |  j _ n  | r“ xK |  j j D]: } | | k rR | j |  d | ƒ| _ | j | ƒ qR qR Wn  |  j	 r» |  j
 r» |  j j |  j _ n  d  Vq Wd  S(   NR(   (   t   renamer_t   ItemRenamert   sett   Truet   renameR   R   R   t   addR   R   R
   (   R   t   patternt   rename_layerst   rename_foldersR   t   renamed_parentsR4   (    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt   rename_layerw   s    		c         C` sF   |  j  } |  j } | j \ } } t j | | j | j | | ƒ d  S(   N(   R   R
   t   offsetsR   t   gimp_image_resizet   widtht   height(   R   t   imaget   layert   layer_offset_xt   layer_offset_y(    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt   resize_to_layer_size‹   s    		u   exportu   functionu   Exportu   display_nameu   additional_tagsu   display_options_on_createu	   directoryu   typeu   output_directoryi   u   default_valueu   Output folderu   folder_chooser_buttonu   gui_typeu   file_extensionu   pngu   File extensionu   file_extension_entryu   adjust_valueu   optionsu   export_modeu
   each_layeru   For each layeru   each_top_level_layer_or_groupu!   For each top-level layer or groupu   entire_image_at_onceu   For the entire image at onceu   itemsu   Perform export:u   filename_patternu   single_image_filename_patternu   [image name]u   Image filename patternu   filename_pattern_entryu   booleanu   use_file_extension_in_item_nameu    Use file extension in layer nameu   check_button_no_textu#   convert_file_extension_to_lowercaseu#   Convert file extension to lowercaseu    preserve_layer_name_after_exportu    Preserve layer name after exportu	   argumentsu   ignore_folder_structureu   Ignore folder structureu&   inherit_transparency_from_layer_groupsu&   Inherit transparency from layer groupsu   insert_background_layersu   Insert background layersu   stringu   tagu   Tagu
   backgroundu   insert_foreground_layersu   Insert foreground layersu
   foregroundu   merge_backgroundu   Merge backgroundu
   merge_typeu   expand_as_necessaryu   Expand as necessaryu   clip_to_imageu   Clip to imageu   clip_to_bottom_layeru   Clip to bottom layeru
   Merge typeu   merge_foregroundu   Merge foregroundu   renameu   Renameu   patternu   [layer name]u   Layer filename patternu   rename_layersu   Rename layersu   rename_foldersu   Rename foldersu   use_layer_sizeu   Use layer sizeu    (/   t   __doc__t
   __future__R    R   R   R   t   future.builtinst   collectionsR   R   t	   gimpenumst   export_layersR   R   t   export_R   R6   t   NAME_ONLY_TAGR   R   R   R/   R1   R5   R9   R%   R@   RI   t   _t   user_directoryt   ExportModest
   EACH_LAYERt   EACH_TOP_LEVEL_LAYER_OR_GROUPt   ENTIRE_IMAGE_AT_ONCEt   insert_background_layert   insert_foreground_layert   merge_backgroundt   EXPAND_AS_NECESSARYt   CLIP_TO_IMAGEt   CLIP_TO_BOTTOM_LAYERt   merge_foregroundt   _BUILTIN_PROCEDURES_LISTt   OrderedDictt   BUILTIN_PROCEDURESt   BUILTIN_PROCEDURES_FUNCTIONSt   action_dictt   function(    (    (    sJ   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/builtin_procedures.pyt   <module>   s>  "
				/				

		





	

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  # -*- coding: utf-8 -*-

"""Plug-in configuration.

Use `c` to access, create or modify configuration entries.
"""

from __future__ import absolute_import, division, print_function, unicode_literals

import os


c.PLUGIN_NAME = 'export_layers'
c.PLUGINS_DIRPATH = os.path.dirname(os.path.dirname(c.PYGIMPLIB_DIRPATH))
c.PLUGIN_SUBDIRPATH = os.path.join(c.PLUGINS_DIRPATH, c.PLUGIN_NAME)
c.LOCALE_DIRPATH = os.path.join(c.PLUGIN_SUBDIRPATH, 'locale')

c.PLUGINS_LOG_DIRPATHS.insert(0, c.PLUGIN_SUBDIRPATH)

c.LOG_MODE = 'exceptions'

c.PLUGIN_TITLE = lambda: _('Export Layers')
c.PLUGIN_VERSION = '4.0.2'
c.PLUGIN_VERSION_RELEASE_DATE = 'September 03, 2023'
c.AUTHOR_NAME = 'Kamil Burda'
c.COPYRIGHT_YEARS = '2013-2023'
c.PAGE_URL = 'https://kamilburda.github.io/gimp-export-layers'
c.DOCS_URL = c.PAGE_URL + '/sections'
c.LOCAL_DOCS_PATH = os.path.join(c.PLUGIN_SUBDIRPATH, 'docs', 'sections', 'index.html')
c.REPOSITORY_USERNAME = 'kamilburda'
c.REPOSITORY_NAME = 'gimp-export-layers'
c.REPOSITORY_URL = 'https://github.com/kamilburda/gimp-export-layers'
c.BUG_REPORT_URL_LIST = [
  ('GitHub', 'https://github.com/kamilburda/gimp-export-layers/issues')
]

# If True, display each step of image/layer editing in GIMP.
c.DEBUG_IMAGE_PROCESSING = False
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             