
    cc                      (    d dl mZ dZ G d d      Zy)    )Gtkz*/com/github/maoschanz/drawing/optionsbars/c                   d    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zy)AbstractOptionsBarc                      d| _         d| _        y )Ni  F)_limit_size
_is_narrowselfs    =/usr/lib/python3/dist-packages/drawing/abstract_optionsbar.py__init__zAbstractOptionsBar.__init__   s    $$/    c                 |   t         j                  j                  t        |z         }|j	                  d      | _        |j	                  d      | _        |j	                  d      | _        |j	                  d      | _        |j	                  d      | _	        |j	                  d      | _
        | j                  | _        |S )aL  Creates a Gtk.Builder for the resource whose path is hinted in the
		method parameter, and tries to extract usual widgets ids from it. Most
		resulting widgets can be `None`, except `action_bar`. The builder is
		returned if the caller wants to extract more objects from it.
		This is valid for any instance of `AbstractOptionsBar`.zbottom-pane
cancel_btncentered_box	apply_btnhelp_btnoptions_btn)r   Buildernew_from_resourceRSRC_PREFIX
get_object
action_barr   r   r   r   r   _togglable_btn)r
   end_of_pathbuilders      r   	_build_uizAbstractOptionsBar._build_ui   s     KK))+*CD'&&}5$/&&|4$/((8$%%k2$.$$Z0$-''6$(($	.r   c                 j   t         j                  j                  t        |z         }|j	                  d      | _        | j                  j                  | j
                         |j	                  d      }|r| j                  j                  |       |S | j                  j                          d| _        |S )a  Same as above, BUT this isn't valid for any instance of
		`AbstractOptionsBar`: only an optionsbar for a transform tool should
		call that method, and it should call it *after* `_build_ui`. This method
		will "hydrate" the previously built (but still incomplete) widgets.r   zactions-menuN)r   r   r   r   r   r   r   set_center_widgetr   set_menu_modeldestroy)r
   r   r   actions_menus       r   _hydrate_transform_toolz*AbstractOptionsBar._hydrate_transform_tool.   s    
 KK))+*CD'((8$//##D$5$56##N3,""<0 
. 4	.r   c                      y)zSet a widget (or a menu) as the popover with tools options. In
		practice this is used only with the classic tools' pane, and all classic
		tools provide a menu instead of a widget.N )r
   widgetmodellabels       r   build_options_menuz%AbstractOptionsBar.build_options_menu>        r   c                      y)zUpdate the pane when a tool using it has just been activated. Widgets
		may be hidden/shown or enabled/disabled depending on the properties of
		the given tool.Nr$   )r
   tools     r   update_for_new_toolz&AbstractOptionsBar.update_for_new_toolD   r)   r   c                      y Nr$   r	   s    r   get_minimap_btnz"AbstractOptionsBar.get_minimap_btnJ       r   c                      y r.   r$   )r
   r'   s     r   set_minimap_labelz$AbstractOptionsBar.set_minimap_labelM   r0   r   c                     | j                   rP| j                   j                         r5| j                   j                  | j                   j                                 y y y r.   )r   get_visible
set_active
get_activer	   s    r   toggle_options_menuz&AbstractOptionsBar.toggle_options_menuP   sJ    	T00<<>!!d&9&9&D&D&F"FG ?r   c                 T    | j                   r| j                   j                  d       y y )NF)r   r5   r	   s    r   hide_options_menuz$AbstractOptionsBar.hide_options_menuT   s$    	!!%( r   c                      y r.   r$   r	   s    r   middle_click_actionz&AbstractOptionsBar.middle_click_actionX   r0   r   c                 Z    | j                  d       | j                  j                          y)aE  Instructions to run during the first window size allocation (and only
		the first). Calling this is managed by the window's `DrOptionsManager`.
		It estimates the minimal amount of pixels for the mobile version, and
		gives it to the `_set_limit_size` method.
		Any implementation HAS TO end with a call to `_set_limit_size`!FN)set_compactr   show_allr	   s    r   init_adaptabilityz$AbstractOptionsBar.init_adaptability[   s"     5//r   c                 L    t        d|z        | _        | j                  d       y )Ng      ?T)intr   r=   )r
   temp_limit_sizes     r   _set_limit_sizez"AbstractOptionsBar._set_limit_sizee   s"    /0$4r   c                 ~    || j                   kD  }|| j                  k(  }|r| j                  | j                          yy)zCheck whether or not the costly `set_compact` method should be
		called, depending on a given window width, and the pane's limit
		previously set.N)r   r   r=   )r
   allocated_width
can_expand
incoherents       r   adapt_to_window_sizez'AbstractOptionsBar.adapt_to_window_sizei   s?      $"2"22*doo-*'( r   c                 d    || _         | j                  | j                  j                  |        yy)zUThe parameter is a boolean telling if the bottom pane should become
		compact or not.N)r   r   set_visible)r
   states     r   r=   zAbstractOptionsBar.set_compactr   s.     $/	]]==Y' r   N)__name__
__module____qualname____gtype_name__r   r   r"   r(   r,   r/   r2   r7   r9   r;   r?   rC   rH   r=   r$   r   r   r   r      sN    &
  H))(r   r   N)gi.repositoryr   r   r   r$   r   r   <module>rQ      s   $ :a( a(r   