ó
dòôdc        ;   @` sb  d  Z  d d l m Z m Z m Z m Z d d l Td d l Z d d l m Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d e f d „  ƒ  YZ e i d d 6d d d d d g d 6i d d 6d d d g d 6d d 6d „  d 6i d d 6d d g d 6i d  d 6d! g d 6d" „  d 6i d# d 6d$ d% g d 6i d& d 6d' g d 6i d( d 6d) g d 6i d* d 6d+ g d 6i d, d 6d- g d 6i d. d 6d/ d0 g d 6i d1 d 6d2 g d 6i d3 d 6d4 d5 g d 6i d6 d 6d7 g d 6i d8 d 6d9 g d 6i d: d 6d; g d 6i d< d 6d= g d 6i d> d 6d? g d 6i d@ d 6dA dB g d 6i dC d 6dD dE g d 6dF „  d 6i dG d 6dH dI g d 6i dJ d 6dK dL dM g d 6i dN d 6dO g d 6dP dQ 6dR „  d 6i dS d 6dT g d 6dU d 6dV dQ 6i dW d 6dX g d 6dY „  dZ 6d[ „  d 6d\ dQ 6i d] d 6d^ g d 6i d_ d 6d` g d 6i da d 6db g d 6i dc d 6dd g d 6i de d 6df g d 6dg „  d 6i dh d 6di g d 6i dj d 6dk g d 6dl „  d 6i dm d 6dn g d 6i do d 6dp g d 6i dq d 6dr g d 6i ds d 6dt g d 6du d 6dv „  dZ 6dw dQ 6i dx d 6dy g d 6i dz d 6d{ g d 6i d| d 6d} g d 6i d~ d 6d g d 6i d€ d 6d g d 6d‚ „  d 6i dƒ d 6d„ d… g d 6d† „  dZ 6i d‡ d 6dˆ d‰ dŠ d‹ dŒ g d 6i d d 6d d d d‘ d’ d“ g d 6i d” d 6d• g d 6i d– d 6d— d˜ g d 6i d™ d 6dš g d 6d› d 6dœ dQ 6i d d 6d g d 6i dŸ d 6d  g d 6i d¡ d 6d¢ d 6d£ g d 6d¤ „  d 6i d¥ d 6d¦ d§ g d 6i d¨ d 6d© g d 6i dª d 6d« g d 6i d¬ d 6d­ g d 6d® „  dZ 6d¯ „  d 6d\ dQ 6i d° d 6d± d² g d 6d³ „  d 6i d´ d 6dµ g d 6d¶ „  dZ 6d· „  d 6d\ dQ 6i d¸ d 6d¹ dº g d 6g8 ƒ Z e e ƒ Z d S(»   u  List of built-in and several third-party file formats supported by GIMP.

Each element of the list is a tuple:

  (file format description, file extensions, (optional) file save procedure)

The file save procedure can be used for multiple purposes, such as:
* checking that the corresponding file format plug-in is installed,
* using that save procedure instead of the default save procedure
  (`pdb.gimp_file_save()`, which invokes the correct file save procedure based
  on the file extension of the filename).
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t   *N(   t   pdbc           C` s   t  S(   N(   t   _save_image_default(    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt   get_default_save_procedure   s    c         C` s<   |  t  k r5 t  |  } | j r5 | j ƒ  r5 | j Sn  t ƒ  S(   uğ   
  Return the file save procedure for the given file extension. If the file
  extension is invalid or does not have a specific save procedure defined,
  return the default save procedure (as returned by
  `get_default_save_procedure()`).
  (   t   file_formats_dictt   save_procedure_funct   is_installedR   (   t   file_extensiont   file_format(    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt   get_save_procedure   s
    

c         C` s    t  j | | | | d |  ƒd  S(   Nt   run_mode(   R   t   gimp_file_save(   R   t   imaget   layert   filepatht   raw_filepath(    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   *   s    c         C` s   g  |  D] } t  |   ^ q S(   N(   t   _FileFormat(   t   file_formats_paramst   params(    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt   _create_file_formats.   s    c         C` sT   i  } xG |  D]? } x6 | j  D]+ } | | k r | j ƒ  r | | | <q q Wq W| S(   N(   t   file_extensionst   version_check_func(   t   file_formatsR   R   R   (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt   _create_file_formats_dict2   s    R   c           B` s8   e  Z d d d d d  „ Z d „  Z d „  Z d „  Z RS(   c   
      K` s¯   | |  _  | |  _ | |  _ | d  k	 r3 | |  _ n t ƒ  |  _ | d  k	 rW | |  _ n	 g  |  _ | d  k	 rr | n d „  |  _ x* | j ƒ  D] \ } }	 t	 |  | |	 ƒ q‹ Wd  S(   Nc           S` s   t  S(   N(   t   True(    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt   <lambda>R   t    (
   t   descriptionR   t   save_procedure_namet   NoneR	   R   t   save_procedure_func_argsR   t   itemst   setattr(
   t   selfR   R   R    R	   R"   t   versionst   kwargst   namet   value(    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt   __init__?   s    				c         C` s   |  j  S(   N(   R    (   R%   (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt
   is_builtinW   s    c         C` s   t  |  j ƒ S(   N(   t   boolR    (   R%   (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt   is_third_partyZ   s    c         C` s(   |  j  ƒ  p' |  j ƒ  o' t j |  j ƒ S(   N(   R+   R-   R   t   gimp_procedural_db_proc_existsR    (   R%   (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR
   ]   s    N(   t   __name__t
   __module__R!   R*   R+   R-   R
   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   =   s
   		u   Alias Pix imageu   descriptionu   pixu   matteu   masku   alphau   alsu   file_extensionsu	   ASCII artu   txtu   ansiu   textu   file-aa-saveu   save_procedure_namec           C` s   t  j d k  S(   Ni   i	   (   i   i	   (   t   gimpt   version(    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   j   R   u   versionsu   AutoDesk FLIC animationu   fliu   flcu   AVIFu   avifc           C` s   t  j d k S(   Ni   i
   i   (   i   i
   i   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   o   R   u   bzip archiveu   xcf.bz2u   xcfbz2u   C source codeu   cu   C source code headeru   hu   Colored XHTMLu   xhtmlu	   DDS imageu   ddsu   DICOM imageu   dcmu   dicomu   Encapsulated PostScript imageu   epsu   Flexible Image Transport Systemu   fitu   fitsu	   GIF imageu   gifu
   GIMP brushu   gbru   GIMP brush (animated)u   gihu   GIMP patternu   patu   GIMP XCF imageu   xcfu   gzip archiveu   xcf.gzu   xcfgzu	   HEIF/HEICu   heicu   heifc           C` s   t  j d k S(   Ni   i
   (   i   i
   i   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR      R   u
   HTML tableu   htmlu   htmu
   JPEG imageu   jpgu   jpegu   jpeu   JPEG XL imageu   jxlu    https://github.com/libjxl/libjxlu   urlc           C` s   t  j d k S(   Ni   i
   i    (   i   i
   i    (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   –   R   u   JPEG XR imageu   jxru   file-jxr-saveu$   https://github.com/chausner/gimp-jxru   JSON metadatau   jsonc         G` s   t  j d |  | Œ S(   NR   (   R   t   file_metadata_json_save(   R   t   args(    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR      R   u   save_procedure_funcc           C` s   t  j d k S(   Ni   i
   (   i   i
   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   Ÿ   R   u2   https://github.com/kamilburda/gimp-metadata-exportu   KISS CELu   celu   Microsoft Windows iconu   icou   MNG animationu   mngu
   OpenRasteru   orau   OpenEXR imageu   exrc           C` s   t  j d k S(   Ni   i
   (   i   i
   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   «   R   u	   PBM imageu   pbmu	   PFM imageu   pfmc           C` s   t  j d k S(   Ni   i
   (   i   i
   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   °   R   u	   PGM imageu   pgmu   Photoshop imageu   psdu	   PNG imageu   pngu
   APNG imageu   apngu   file-apng-save-defaultsc         G` s   t  j d |  | Œ S(   NR   (   R   t   file_apng_save_defaults(   R   R4   (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   »   R   u+   https://sourceforge.net/projects/gimp-apng/u	   PNM imageu   pnmu   Portable Document Formatu   pdfu   PostScript documentu   psu	   PPM imageu   ppmu   Radiance RGBEu   hdrc           C` s   t  j d k S(   Ni   i
   (   i   i
   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   Ç   R   u   Raw image datau   datau   rawc         G` s   t  j d |  | Œ S(   NR   (   R   t   file_raw_save(   R   R4   (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   Ë   R   u   Silicon Graphics IRIS imageu   sgiu   rgbu   rgbau   bwu   iconu   SUN Rasterfile imageu   im1u   im8u   im24u   im32u   rsu   rasu   TarGA imageu   tgau
   TIFF imageu   tifu   tiffu   Valve Texture Formatu   vtfu   file-vtf-saveu%   https://github.com/Artfunkel/gimp-vtfu
   WebP imageu   webpu   Windows BMP imageu   bmpu   X11 Mouse Cursoru   file-xmc-saveu   xmcc           C` s   t  j d k  S(   Ni   i	   (   i   i	   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   ß   R   u   X BitMap imageu   xbmu   bitmapu   X PixMap imageu   xpmu   X window dumpu   xwdu   XML metadatau   xmlc         G` s   t  j d |  | Œ S(   NR   (   R   t   file_metadata_xml_save(   R   R4   (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   é   R   c           C` s   t  j d k S(   Ni   i
   (   i   i
   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   ê   R   u
   xz archiveu   xcf.xzu   xcfxzc           C` s   t  j d k S(   Ni   i
   (   i   i
   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   î   R   u   YAML metadatau   yamlc         G` s   t  j d |  | Œ S(   NR   (   R   t   file_metadata_yaml_save(   R   R4   (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   ò   R   c           C` s   t  j d k S(   Ni   i
   (   i   i
   (   R1   R2   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyR   ó   R   u   ZSoft PCX imageu   pcxu   pcc(   t   __doc__t
   __future__R    R   R   R   t   future.builtinsR1   R   R   R   R   R   R   t   objectR   R   R   (    (    (    sM   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/fileformats.pyt   <module>   s2  "
					'















































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        # -*- coding: utf-8 -*-

"""Functions to invoke other functions in various ways, e.g. with a timeout."""

from __future__ import absolute_import, division, print_function, unicode_literals
from future.builtins import *

import os

import gimp
import gobject


_timer_ids = {}


def timeout_add(interval, callback, *callback_args):
  """
  This is a thin wrapper of `gobject.timeout_add()` that 'fixes' the function
  failing to work on Windows on GIMP 2.10 by setting the interval to zero.
  """
  if os.name == 'nt' and ((2, 10, 0) <= gimp.version < (2, 10, 6)):
    return gobject.timeout_add(0, callback, *callback_args)
  else:
    return gobject.timeout_add(interval, callback, *callback_args)


def timeout_add_strict(interval, callback, *callback_args, **callback_kwargs):
  """
  This is a wrapper for `gobject.timeout_add()`, which calls the specified
  callback at regular intervals (in milliseconds).
  
  Additionally, if the same callback is called again before the timeout, the
  first invocation will be canceled. If different functions are called before
  the timeout, they will all be invoked normally.
  
  This function also supports keyword arguments to the callback.
  """
  global _timer_ids
  
  def _callback_wrapper(callback_args, callback_kwargs):
    retval = callback(*callback_args, **callback_kwargs)
    if callback in _timer_ids:
      del _timer_ids[callback]
    
    return retval
  
  timeout_remove_strict(callback)
  
  _timer_ids[callback] = timeout_add(
    interval, _callback_wrapper, callback_args, callback_kwargs)
  
  return _timer_ids[callback]


def timeout_remove_strict(callback):
  """
  Remove a callback scheduled by `timeout_add_strict()`. If no such callback
  exists, do nothing.
  """
  if callback in _timer_ids:
    gobject.source_remove(_timer_ids[callback])
    del _timer_ids[callback]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         