ó
âdc           @` sğ   d  Z  d d l m Z m Z m Z m Z d d l Td d l Z e j d  d d l	 Z	 d d l
 Z
 d d d d	 d
 g Z d   Z e d  Z e d  Z d d d d d  Z d   Z d S(   u7   Miscellaneous utility functions related to GTK widgets.i    (   t   absolute_importt   divisiont   print_functiont   unicode_literals(   t   *Nu   2.0u   get_toplevel_windowu   label_fits_textu   get_label_full_text_widthu   menu_popup_below_widgetu   get_position_below_widgetc         C` s+   |  j    } | j   t j @r# | Sd Sd S(   u   
  Return the toplevel window (`gtk.Window`) for the specified widget
  (`gtk.Widget`). If the widget has no toplevel window, return None.
  N(   t   get_toplevelt   flagst   gtkt   TOPLEVELt   None(   t   widgett   toplevel_widget(    (    sK   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/gui/utils.pyt   get_toplevel_window   s    c         C` s#   |  j    j   d t |  |  k S(   u¨   
  If the `label` is wide enough to display the entire text, return `True`,
  otherwise `False`. If `use_markup` is `True`, treat the label text as
  marked-up text.
  i    (   t
   get_layoutt   get_pixel_sizet   get_label_full_text_width(   t   labelt
   use_markup(    (    sK   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/gui/utils.pyt   label_fits_text"   s    c         C` sU   t  j |  j    } | r4 | j |  j   d  n | j |  j    | j   d S(   ut   
  Return the pixel width of the label text. If `use_markup` is `True`, treat the
  label text as marked-up text.
  u   _i    (   t   pangot   Layoutt   get_pango_contextt   set_markup_with_accelt	   get_labelt   set_textt   get_textR   (   R   R   t   full_text_layout(    (    sK   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/gui/utils.pyR   ,   s
    c         ` sZ   t  |      d k	 r= |  j | |   f d   | |  n |  j | | d | |  d S(   u£   
  Display popup of the specified menu below the specified widget. If the widget
  has no associated top-level window, display the popup on the cursor position.
  c         ` s     d   d t  f S(   Ni    i   (   t   True(   t   menu_(   t   position_below_widget(    sK   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/gui/utils.pyt   <lambda>L   t    N(   t   get_position_below_widgetR	   t   popup(   t   menuR
   t   parent_menu_shellt   parent_menu_itemt   buttont   activate_time(    (   R   sK   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/gui/utils.pyt   menu_popup_below_widget;   s    
c         C` se   t  |   } | d  k	 r] | j   j   } |  j   } | d | j | d | j | j f Sd  Sd  S(   Ni    i   (   R   R	   t
   get_windowt
   get_origint   get_allocationt   xt   yt   height(   R
   t   toplevel_windowt   toplevel_window_positiont   widget_allocation(    (    sK   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/gui/utils.pyR    S   s    (   t   __doc__t
   __future__R    R   R   R   t   future.builtinst   pygtkt   requireR   R   t   __all__R   R   R   R   R	   R'   R    (    (    (    sK   /home/josie/.config/GIMP/2.10/plug-ins/export_layers/pygimplib/gui/utils.pyt   <module>   s&   "
		
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                # -*- coding: utf-8 -*-

"""Functions dealing with strings, file/directory paths and file extensions."""

from __future__ import absolute_import, division, print_function, unicode_literals
from future.builtins import *

from .fileext import *
from .pattern import *
from .uniquify import *
from .validators import *

from .._path_dirs import *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           