
    g
f                     P    d Z dZdZdZdZdZddlZddlmZ d	d
l	m
Z
  G d d      Zy)z)Displays a GUI for the user to quit Orca.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2009 Sun Microsystems Inc.LGPL    N)Gtk   )_c                   .    e Zd ZdZd Zd Zd Zd Zd Zy)GtkBuilderWrappera  
    Superclass for GtkBuilder based applications. Just derive from this
    and your subclass should create methods whose names correspond to
    the signal handlers defined in the GtkBuilder file. Any other attributes
    in your class will be safely ignored.

    This class will give you the ability to do:
        subclass_instance.GtkWindow.method(...)
        subclass_instance.widget_name...
    c                    t        j                         | _        | j                  j                  t	        j
                                | j                  j                  |       | j                  j                  |      | _        | j                  j                         D ]  }| j                  |        | j                          i }t        | j                        D ]  }t        | |      ||<    | j                  j                  |       y )N)r   Builderbuilderset_translation_domaingettext
textdomainadd_from_file
get_object	gtkWindowget_objectslocalize_widgetset_orca_icondir	__class__getattrconnect_signals)selffileName
windowNameobjinstance_attributes	attributes         6/usr/lib/python3/dist-packages/orca/orca_gtkbuilder.py__init__zGtkBuilderWrapper.__init__-   s    {{}++G,>,>,@A""8,00<
 <<++- 	&C  %	& 	 T^^, 	FI-4T9-E	*	F$$%89    c                 f   t         j                  j                         }	 |j                  ddd      }|j                  ddd      }|j                  ddd      }|j                  ddd      }|j                  ddd      }t         j                  j                  |||||f       y# t        $ r Y yw xY w)	zvGet the icon in all sizes from the current theme and set them as
        default for all application windows.
        orca   r             0   N)r   	IconThemeget_default	load_iconWindowset_default_icon_list	Exception)r   
icon_themeicon16icon22icon24icon32icon48s          r   r   zGtkBuilderWrapper.set_orca_iconB   s    
 ]]..0
	6))&"a8F))&"a8F))&"a8F))&"a8F))&"a8F JJ,,f-3-3-3-3	.5 6  		s   AB$ $	B0/B0c                 b    | j                   j                  |      }|t        d|z   dz         |S )a(  Return the requested widget. This routine has been introduced
        (and calls to it made by the Orca GtkBuilder sub-classes), to prevent
        "No class attribute" pychecker errors caused when using __getattr__.

        Arguments:
        - attribute: name of the widget to return.
        Widget [] not found)r   r   AttributeErrorr   r   widgets      r   
get_widgetzGtkBuilderWrapper.get_widgetW   s7     ((3> i!7-!GHHr!   c                     | j                   j                  |      }|t        d|z   dz         || j                  |<   |S )Nr6   r7   )r   r   r8   __dict__r9   s      r   __getattr__zGtkBuilderWrapper.__getattr__f   sC    ((3> i!7-!GHH#)i r!   c                 "   	 |j                         }|j                         }t        |t        j
                        ry	 |j                         }|r%t        |      r|j                  t        |             |r|j                  d       y# t        $ r d}d}Y vw xY w# t        $ ri 	 |j                         }n# t        $ r Y Y yw xY w|rBt        |      r7|r|j                  t        |             n|j                  t        |             Y w xY w)zForce the localization of the label/title of GtkBuilder objects

        Arguments:
        - obj: the GtkBuilder object whose label or title should be localized
        FNT)get_use_markupget_use_underliner.   
isinstancer   Frame	get_titlelen	set_titler   	get_label
set_markup	set_labelset_use_underline)r   r   	useMarkupuseUnderlinetitletexts         r   r   z!GtkBuilderWrapper.localize_widgetn   s    	!**,I002L
 c399% 	+MMOEUah' !!$'A  	!I L	!"  
	+}}  D	NN1T7+MM!D'*
	+sG    B	 7B 	BB	D&B76D7	C DCADDN)	__name__
__module____qualname____doc__r    r   r;   r>   r    r!   r   r   r   !   s     	:*6*.r!   r   )rR   __id____version____date____copyright____license__r   gi.repositoryr   	orca_i18nr   r   rS   r!   r   <module>r[      s8   ( 0?   { {r!   