+
    Ki$  c                   s    R t ^ RIt^ RIt^ RIt^ RIHtHtHtHt ^ RI	H
t
 R.t ! R R]4      tR tR tR	 t ! R
 R4      t ! R R4      t]tR# )a  GtkTemplate implementation for PyGI

Blog post
http://www.virtualroadside.com/blog/index.php/2015/05/24/gtk3-composite-widget-templates-for-python/

Github
https://github.com/virtuald/pygi-composite-templates/blob/master/gi_composites.py

This should have landed in PyGObect and will be available without this shim in the future.
See: https://gitlab.gnome.org/GNOME/pygobject/merge_requests/52
N)GioGLibGObjectGtk)ErrorDialogGtkTemplatec                   s    ] tR t^)tRtR# )GtkTemplateWarning N)__name__
__module____qualname____firstlineno____static_attributes__r       E/usr/lib/python3.14/site-packages/lutris/gui/widgets/gi_composites.pyr   r   )   s    r   r   c                s   Vf   RpMV3pV P                  VP                  4      pVf4   \        P                  ! RV: RV: RV: RV: RV: 2
\        ^R7       R# \        W4      p	V\        P                  P                  8X  d   VP                  ! W).VO5!   MVP                  ! W).VO5!   VP                  P                  V4       R# )	z(Handles GtkBuilder signal connect eventsNz4Internal error: cannot find template instance! obj: z
; signal: z; handler: z; connect_obj: z	; class: Z
stacklevelr   )Z
get_objectZ__gtype_name__warningswarnr   getattrr   ZConnectFlagsZAFTERZconnect_afterZconnect__connected_template_signals__add)
ZbuilderZobjZsignal_nameZhandler_nameZconnect_objectZflagsclsZextraZtemplate_instZhandlers
   &&&&&&&   r   _connect_funcr   -   s     ! &&s'9'9:M K~sD 	
 	m2G$$***+77K1510044\Br   c                sX  a a \        S R4      '       g   \        R4       \        R4      hS P                  V4       \	        4       p\	        4       p\        S 4       F  p\        S VR4      p\        P                  ! V4      '       d(   \        VR4      '       d   VP                  V4       KQ  KS  \        V\        4      '       g   Kk  S P                  VR^ 4       VP                  V4       K  	  S P                  \        S 4       VS n        VS n        S P"                  oVV 3R lS n        R# )z=Registers the template for the widget and hooks init_templateset_templatezCYour Linux distribution is too old. Lutris won't function properly.z$Requires PyGObject 3.13.2 or greaterN_gtk_callbackTc                 s   < \        V SS4      # N)_init_template)Zsbase_init_templater   s   &r   Z<lambda>Z$_register_template.<locals>.<lambda>q   s    .C9K"Lr   )hasattrr   	TypeErrorr   setZdirr   inspectZismethodr   
isinstance_ChildZbind_template_child_fullZset_connect_funcr   __gtemplate_methods____gtemplate_widgets__Zinit_template)r   template_bytesZbound_methodsZbound_widgetsnameZor   s   f&    @r   _register_templater&   M   s     3''YZ>??^$EMEM CCt$Aq/**!!$' + 6""((tQ7d#  , -C -C**LCr   c                s   V P                   VJd   \        R4      h\        4       pW0n        V! V 4       V P                   FQ  pV P                  W4      pWPP                  V&   Ve   K(  \        RRP                  V P                  4      ,          4      h	  V P                  P                  V4       F'  p\        P                  ! RV,          \        ^R7       K)  	  R# )z2This would be better as an override for Gtk.WidgetzQInheritance from classes with @GtkTemplate decorators is not allowed at this timeNzjA missing child widget was set using GtkTemplate.Child and the entire template is now broken (widgets: %s)z, zSSignal '%s' was declared with @GtkTemplate.Callback but was not present in templater   )Z	__class__r   r   r   r#   Zget_template_childZ__dict__ZAttributeErrorjoinr"   Z
differencer   r   r   )selfr   r   Zconnected_signalsr%   Zwidgets   &&&   r   r   r   t   s    
 ~~S kll*;'t**((3$d> !79=4C]C]9^_  +  **556GHadhh	
 Ir   c                   s8   a  ] tR t^t o Rt. t]R 4       tRtV t	R# )r!   z
Assign this to an attribute in your class definition and it will
be replaced with a widget defined in the UI file when init_template
is called
c                sR    \        V 4       Uu. uF  p\        4       NK  	  up# u upi )z
Allows declaring multiple widgets with less typing::

    button                    label1                    label2    = GtkTemplate.Child.widgets(3)
)Zranger!   )ZcountZ_s   & r   widgetsZ_Child.widgets   s"     #(,/,Q,///s   $r   N)
r   r	   r
   r   __doc__Z	__slots__staticmethodr)   r   __classdictcell__Z__classdict__   @r   r!   r!      s#      I0 0r   r!   c                   sX   a  ] tR t^t o RtRt]R 4       t]t	]R 4       t
R tR tRtV tR# )_GtkTemplatea  
Use this class decorator to signify that a class is a composite
widget which will receive widgets and connect to signals as
defined in a UI template. You must call init_template to
cause the widgets/signals to be initialized from the template::

    @GtkTemplate(ui='foo.ui')
    class Foo(Gtk.Box):

        def __init__(self):
            super().__init__()
            self.init_template()

The 'ui' parameter can either be a file path or a GResource resource
path::

    @GtkTemplate(ui='/org/example/foo.ui')
    class Foo(Gtk.Box):
        pass

To connect a signal to a method on your instance, do::

    @GtkTemplate.Callback
    def on_thing_happened(self, widget):
        pass

To create a child attribute that is retrieved from your template,
add this to your class definition::

    @GtkTemplate(ui='foo.ui')
    class Foo(Gtk.Box):

        widget = GtkTemplate.Child()


Note: This is implemented as a class decorator, but if it were
included with PyGI I suspect it might be better to do this
in the GObject metaclass (or similar) so that init_template
can be called automatically instead of forcing the user to do it.

.. note:: Due to limitations in PyGObject, you may not inherit from
          python objects that use the GtkTemplate decorator.
Nc                s    RV n         V # )zQ
Decorator that designates a method to be attached to a signal from
the template
T)r   )Zfs   &r   CallbackZ_GtkTemplate.Callback   s     r   c                 s    \         P                  P                  \         P                  P                  ! V !  4      \        n        R# )aw  
If using file paths instead of resources, call this *before*
loading anything that uses GtkTemplate, or it will fail to load
your template file

:param path: one or more path elements, will be joined together
             to create the final path

TODO: Alternatively, could wait until first class instantiation
      before registering templates? Would need a metaclass...
N)ospathZabspathr'   r/   __ui_path__)r2   s   *r   set_ui_pathZ_GtkTemplate.set_ui_path   s&     $&77??277<<3F#G r   c                s    Wn         R # r   ui)r(   r6   s   &&r   __init__Z_GtkTemplate.__init__   s    r   c                s   \        V\        P                  4      '       g   \        R 4      h\	        VR4      '       d   \        R4      h \
        P                  ! V P                  \
        P                  P                  4      p\1        TX4       T#   \        P                   d    T P                  p\        T\        \        34      '       d   RP                  T4      p\         P"                  e/   \$        P&                  P                  \         P"                  T4      p\)        TR4      ;_uu_ 4       p\        P*                  P-                  TP/                  4       4      pRRR4        K    + '       g   i      L; ii ; i)z$Can only use @GtkTemplate on Widgetsr"   zCannot nest template classesZ NZrb)Z
issubclassr   ZWidgetr   r   r    Zresources_lookup_datar6   ZResourceLookupFlagsZNONEr   ZGErrorr    ZlistZtupler'   r/   r3   r1   r2   ZopenZBytesZnewZreadr&   )r(   r   r$   r6   Zfps   &&   r   __call__Z_GtkTemplate.__call__   s   #szz**BCC 3/00:;;
	; 66tww@W@W@\@\]N 	3/
 {{ 		;B"tUm,,XXb\''3WW\\,":":B?b$2!%	!:  		;s+   
9B B"F3.E,!F,E=7F=Fr5   )r   r	   r
   r   r*   r3   r+   r0   r!   ZChildr4   r7   r8   r   r,   r-   r.   r   r/   r/      sN     *X K  EH H r   r/   )r*   r   r1   r   Zgi.repositoryr    r   r   r   Zlutris.gui.dialogsr   Z__all__ZUserWarningr   r   r&   r   r!   r/   r   r   r   r   <module>r9      sc   
:  	  1 1 */	 	C@$MN"
L0 0*e eX r   