Ë
    c­øcÑÐ  ã                   ó  — d dl Z d dlmZmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZmZmZ dd
lmZ ddlmZ ddlmZ ddlmZmZ dZdZ ej@                  edz   ¬«       G d„ dejB                  «      «       Z"y)é    N)ÚGtkÚGdkÚGioÚ	GdkPixbufÚGLibé   )ÚDrImage)ÚDrCustomImageDialog)Ú	DrMinimap)ÚDrOptionsManager)ÚDrMessageDialog)ÚDrDecoManagerMenubarÚDrDecoManagerHeaderbarÚDrDecoManagerToolbar)ÚDrSavingManager)ÚDrPrintingManager)ÚDrToolsInitializer)Ú!utilities_add_filechooser_filtersÚutilities_gfile_is_imagez!/com/github/maoschanz/drawing/ui/Úpencilz	window.ui)Úresource_pathc                   óœ  ‡ — e Zd Zd Zej
                  j                  d«      Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zej                  j                  «       Zˆ f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‚d„Z$ddddg d¢fd„Z%d„ Z&d„ Z'd„ Z(d„ Z)d„ Z*d„ Z+d„ Z,d„ Z-d„ Z.d„ Z/d„ Z0g fd „Z1d!„ Z2d"„ Z3d#„ Z4d$„ Z5d%„ Z6d&„ Z7dƒd'„Z8dƒd(„Z9d)„ Z:d*„ Z;d+„ Z<d,„ Z=d-„ Z>d.„ Z?d/„ Z@d0„ ZAd1„ ZBd2„ ZCd„d3„ZDd4„ ZEd5„ ZFd6„ ZGd7„ ZHd8„ ZId9„ ZJd:„ ZKd;„ ZLd<„ ZMd=„ ZNd>„ ZOd?„ ZPd@„ ZQdƒdA„ZRdB„ ZSdC„ ZTdD„ ZUdE„ ZVdF„ ZWdG„ ZXdH„ ZYdI„ ZZdJ„ Z[dK„ Z\dL„ Z]dM„ Z^dN„ Z_dO„ Z`dP„ ZadQ„ ZbdR„ ZcdS„ ZddT„ Zed‚dU„ZfdV„ ZgdW„ ZhdX„ ZidY„ ZjdZ„ Zkd[„ Zld\„ Zmd]„ Znd^„ Zod_„ Zpd`„ Zqda„ Zrdb„ Zsdc„ Ztdd„ Zude„ Zvdf„ Zwdg„ Zxdh„ Zydi„ Zzdj„ Z{dk„ Z|dl„ Z}dm„ Z~dn„ Zdo„ Z€dp„ Z�dq„ Z‚dr„ Zƒds„ Z„dt„ Z…du„ Z†dv„ Z‡dw„ Zˆdx„ Z‰dy„ ZŠdz„ Z‹d{„ ZŒd|„ Z�d}„ ZŽd~„ Z�d„ Z�d€„ Z‘d�„ Z’ˆ xZ“S )…ÚDrWindowzcom.github.maoschanz.drawingc                 ó  •— t        ‰| �  di |¤Ž |d   | _        d | _        d | _        d| _        d| _        d| _        | j                  j                  d«      r| j                  «        | j                  «        | j                  «        y )NÚapplicationFÚ	maximized© )ÚsuperÚ__init__ÚappÚpointer_to_current_pageÚactive_tool_idÚ!_is_tools_initialisation_finishedÚ
devel_modeÚshould_track_framerateÚ	gsettingsÚget_booleanÚmaximizeÚ_update_theme_variantÚ_set_ui_bars)ÚselfÚkwargsÚ	__class__s     €ú0/usr/lib/python3/dist-packages/drawing/window.pyr   zDrWindow.__init__?   s}   ø€ Ü�'ÑÑ�VÒØ�MÑ"€$„(à!%€$Ôð €$ÔØ+0€$Ô(Ø€$„/Ø %€$Ôà	‡^�^×Ñ Ô,Ø‡=�=„?à×ÑÔð ×ÑÕó    c                 ó¸  — | j                  t        d«      «       |d   }|d   }i | _        t        | d«      | _        t        | «      | _        t        | «      | _        t        | «      | _
        | j                  j                  d«      | _        | j                  «        | j                  «        | j!                  «        	 |r| j#                  «        n%|�| j%                  |¬«       n| j'                  «        | j/                  «       j1                  «        d| _        | j5                  «        y# t(        $ r$}| j+                  t-        |«      «       Y d}~Œ^d}~ww xY w)	a÷  Initialize the window's content, such as the minimap, the color
		popovers, the tools, their options, and a new image. Depending on the
		parameters, the new image can be imported from the clipboard, loaded
		from a GioFile, or (else) it can be a blank image.

		This method is called asynchronously, which isn't *correct* (not very
		thread-safe or anything) but it allows the window to be shown quicker.
		If it fails, a window is here anyway because this is independent from
		the object constructor.z7Error starting the application, please report this bug.ÚgfileÚget_cbNú
devel-only©r1   TF)Úreveal_action_reportÚ_Útoolsr   Úminimapr   Úoptions_managerr   Úsaving_managerr   Úprinting_managerr&   r'   r$   Úadd_all_win_actionsÚ_init_toolsÚconnect_signalsÚdelayed_build_from_clipboardÚ_build_new_tabÚbuild_blank_imageÚ	ExceptionÚreveal_messageÚstrÚactive_toolÚselect_flowbox_childr#   Ú_try_show_release_notes)r+   Úcontent_paramsr1   r2   Úexcps        r.   Úinit_window_content_asyncz"DrWindow.init_window_content_asyncS   s;  € ð ×ÑœAð Ió Jô Kð ˜Ñ
!€%Ø˜(Ñ#€&à€$„*Ü˜4 Ó&€$„,Ü)¨$Ó/€$ÔÜ'¨Ó-€$ÔÜ+¨DÓ1€$Ôà—N‘N×.Ñ.¨|Ó<€$„/Ø×ÑÔØ×ÑÔØ×ÑÔð"ÙØ×%Ñ%Õ'ØÐØ×Ñ˜eÐÕ$à×ÑÔð ×ÑÓ×)Ñ)Ô+Ø+/€$Ô(à×ÑÔ ð 
øô 
ò "Ø×Ñ”s˜4“y×!Ñ!ûð"ús   Â>8D, Ä,	EÄ5EÅEc                 ó„  — | j                   j                  d«      }| j                  j                  «       }||k(  ry|j	                  d«      d   |j	                  d«      d   k(  rF|j	                  d«      d   |j	                  d«      d   k(  r| j                   j                  d|«       yt        | «      }|dk(  r|j                  t        d«      «       n9t        d«      }|j                  ||z  «       |j                  t        d	«      «       |j                  t        d
«      dd«      }|j                  t        d«      d«      }|j                  «       }|j                  «        ||k(  r:|dk(  r| j                  j                  «        n| j                  j                  «        | j                   j                  d|«       y)z–Add specific actions to the primary menu if the current version is a
		new one (the corresponding release notes have never been opened or
		dismissed)zlast-versionNú.r   r   z0.0.0zLIt's the first time you use Drawing, would you like to read the help manual?zJIt's the first time you use Drawing %s, would you like to read what's new?zeThese news will always be available in the help manual: click the 'Help' menu item whenever you want!ÚNoTÚYesúsuggested-action)r&   Ú
get_stringr    Úget_current_versionÚsplitÚ
set_stringr   Ú
add_stringr6   Ú
set_actionÚrunÚdestroyÚon_help_indexÚon_help_whats_new)r+   Úlast_versionÚcurrent_versionÚdialogÚlabelÚno_idÚyes_idÚresults           r.   rG   z DrWindow._try_show_release_notes…   sš  € ð —‘×*Ñ*¨>Ó:€,Ø—H‘H×0Ñ0Ó2€/Ø˜Ò$Ø	ð ×Ñ˜Ó˜QÑ ?×#8Ñ#8¸Ó#=¸aÑ#@Ò@Ø×Ñ˜Ó˜aÑ  O×$9Ñ$9¸#Ó$>¸qÑ$AÒAØ‡>�>×Ñ˜^¨_Ô=Ø	ä˜4Ó €&à�WÒØ	×Ñ”Qð Fó Gõ Hô ð Gó H€5à	×Ñ�U˜_Ñ,Ô-Ø	×Ñ”Qð Fó Gô Hð ×
Ñ
œA˜d›G T¨4Ó
0€%Ø×ÑœQ˜u›XÐ'9Ó:€&Ø�:‰:‹<€&Ø‡.�.ÔàˆvÒØ�gÒØ‡H�H×ÑÕà‡H�H×ÑÔ Ø‡.�.×Ñ˜N¨OÕ<r/   c                 ó¨  — | j                   j                  d«      }| j                   j                  d«      }i | _        | j	                  d«       | j                  «        t        | «      }|j                  ||«      | _        | j                  j                  d| j                  «       | j                  D ]*  }| j                  |   j                  | j                  «       Œ, | j                  «        | j                  j                  s| j                  «        | j                   j!                  d«      }|| j                  vrt"        }|| _        || _        y)zdInitialize all tools, building the UI for them including the menubar,
		and enable the default tool.zdisabled-toolsr3   z%window has started, now loading toolszselected-children-changedúlast-active-toolN)r&   Úget_strvr'   r7   Úlog_messageÚ_hide_messager   Úload_all_toolsÚtools_flowboxÚconnectÚ'_update_active_tool_from_flowbox_signalÚbuild_flowbox_childÚon_show_labels_setting_changedr    Úhas_tools_in_menubarÚbuild_menubar_tools_menurP   ÚDEFAULT_TOOL_IDr"   Úformer_tool_id)r+   Údisabled_toolsÚdevÚtools_initializerÚtool_ids        r.   r=   zDrWindow._init_tools°   s   € ð —>‘>×*Ñ*Ð+;Ó<€.Ø�‰×"Ñ" <Ó0€#Ø€$„*Ø×ÑÐ:Ô;Ø×ÑÔä(¨Ó.ÐØ ×/Ñ/°°^ÓD€$„*ð ×Ñ×ÑÐ8Ø!×IÑIôKà—‘ò ?€gØ‡:�:ˆgÑ×*Ñ*¨4×+=Ñ+=Õ>ð?à×%Ñ%Ô'ð 
�‰×	&Ò	&Ø× Ñ Ô"ð �N‰N×%Ñ%Ð&8Ó9€'Ø�D—J‘JÑÜ€7Ø€$ÔØ€$Õr/   c                 óZ   — | j                  «       }| j                  |j                  «       y ©N)Ú_get_newly_selected_toolÚ	switch_toÚid)r+   ÚargsÚselected_tools      r.   ri   z0DrWindow._update_active_tool_from_flowbox_signalÑ   s"   € Ø×/Ñ/Ó1€-Ø‡.�.�×!Ñ!Õ"r/   c                 ó‚   — | j                   D ]0  }| j                   |   j                  «       sŒ!| j                   |   c S  y ru   )r7   Úis_flowbox_child_selected)r+   rs   s     r.   rv   z!DrWindow._get_newly_selected_toolÕ   s9   € Ø—‘ò €gØ
‡j�j�Ñ×3Ñ3Õ5Ø�:‰:�gÑÒñr/   c                 ó"  — g d¢}| j                  d«      |d<   | j                  d«      |d<   | j                  d«      |d<   | j                  D ]/  }| j                  |   }|j                  ||j                     «       Œ1 d| j                  _        y )N)NNNr   é   r   T)Ú_get_menubar_tools_sectionr7   Úadd_item_to_menuÚmenu_idr    rl   )r+   Úsectionsrs   Útools       r.   rm   z!DrWindow.build_menubar_tools_menuÚ   s‹   € Ú€(ð ×/Ñ/°Ó2€(ˆ1�+Ø×/Ñ/°Ó2€(ˆ1�+Ø×/Ñ/°Ó2€(ˆ1�+Ø—‘ò 1€gØ
�*‰*�WÑ
€4Ø×Ñ˜ $§,¡,Ñ/Õ0ð1ð #'€$‡(�(Õr/   c                 ó<   — | j                  ddgddgddgd|gg«      S )NTé   Fr   r   )Ú_get_menubar_item)r+   Úsection_indexs     r.   r   z#DrWindow._get_menubar_tools_sectionæ   s7   € Ø	×	Ñ	Øˆ!€9Ø	ˆ1€:Øˆ!€9Ø	ˆ=Ðð	!ó 
ð r/   c                 óî   — | j                   j                  d«      }| j                   j                  d«      }| j                   j                  d«      }| j                  |||¬«       | j	                  «        y)zaOpen a new tab with a drawable blank image using the default values
		defined by user's settings.zdefault-widthzdefault-heightzdefault-rgba©ÚwidthÚheightÚbackground_rgbaN)r&   Úget_intrc   r@   Úupdate_picture_title)r+   ry   rŠ   r‹   Úrgbas        r.   rA   zDrWindow.build_blank_imageñ   sb   € ð �.‰.×
 Ñ
  Ó
1€%Ø�>‰>×!Ñ!Ð"2Ó3€&Ø	�‰×	 Ñ	  Ó	0€$Ø×Ñ˜E¨&À$ÐÔGØ×ÑÕr/   c                 ó  — t        | «      }|j                  «       }|t        j                  j                  k(  r8|j                  «       \  }}}| j                  |||¬«       | j                  «        |j                  «        y)z]Open a new tab with a drawable blank image using the custom values
		defined by user's input.r‰   N)	r
   rV   r   ÚResponseTypeÚOKÚ
get_valuesr@   rŽ   rW   )r+   ry   r\   r`   rŠ   r‹   r�   s          r.   Úbuild_new_customzDrWindow.build_new_customú   sm   € ô ˜tÓ$€&Ø�:‰:‹<€&ØŒs×Ñ×"Ñ"Ò"Ø×*Ñ*Ó,Ñ€5ˆ&�$Ø×Ñ˜U¨6À4ÐÔHØ×ÑÔØ‡.�.Õr/   c                 óf   — | j                  «        t        j                  d| j                  i «       y)z2Calls `async_build_from_clipboard` asynchronously.iô  N)r@   r   Útimeout_addÚasync_build_from_clipboard©r+   ry   s     r.   r?   z%DrWindow.delayed_build_from_clipboard  s&   € à×ÑÔä×Ñ�3˜×7Ñ7¸Õ<r/   c                 ó–   — | j                  «       j                  «        | j                  «       r| j                  | j                  «       y)ú8This is used as a GSourceFunc so it should return False.F)Úget_active_imageÚtry_close_tabÚbuild_image_from_clipboardrw   r"   )r+   rH   s     r.   r—   z#DrWindow.async_build_from_clipboard  s8   € à×ÑÓ×'Ñ'Ô)Ø	×$Ñ$Ô&Ø‡>�>�$×%Ñ%Ô&Ø	r/   c                 ó:  — t         j                  j                  t        j                  «      }|j                  «       }|€J| j                  t        d«      d«       | j                  j                  «       dk  r| j                  «        yy| j                  |¬«       y)a  Open a new tab with the image in the clipboard. If the clipboard is
		empty, and there is no existing tab, a new blank image will be created
		to ensure the window can display the message.
		It returns `True` if an image (blank or not idc) has been created.z(The clipboard doesn't contain any image.Tr   F©Úpixbuf)r   Ú	ClipboardÚgetr   ÚSELECTION_CLIPBOARDÚwait_for_imagerC   r6   ÚnotebookÚget_current_pagerA   r@   )r+   ry   Úcbr    s       r.   r�   z#DrWindow.build_image_from_clipboard  s‚   € ô
 ‡}�}×Ñœ×0Ñ0Ó1€"Ø×ÑÓ€&Ø€^Ø×Ñ”qÐCÓDÀdÔKØ
‡m�m×$Ñ$Ó&¨Ò*à×ÑÔØØ
à×Ñ˜fÐÔ%Ø
r/   c                 óx   — | j                  «       j                  j                  «       }| j                  |¬«       y)z/Open a new tab with the image in the selection.rŸ   N)r›   Ú	selectionÚ
get_pixbufr@   ©r+   ry   r    s      r.   Úbuild_image_from_selectionz#DrWindow.build_image_from_selection$  s0   € à× Ñ Ó"×,Ñ,×7Ñ7Ó9€&Ø×Ñ˜VÐÕ$r/   c                 óâ   — |r[| j                   j                  |j                  «       «      \  }}|�-| j                  |«      s|j                  j                  |«       y | j                  |¬«       y )Nr4   )r    Úhas_image_openedÚget_pathÚconfirm_open_twicer¥   Úset_current_pager@   ©r+   r1   Úcheck_duplicatesÚwÚ	duplicates        r.   Úbuild_new_from_filezDrWindow.build_new_from_file)  s]   € ÙØ—(‘(×+Ñ+¨E¯N©NÓ,<Ó=�<€1€iØÐ D×$;Ñ$;¸EÔ$BØ‡J�J×Ñ 	Ô*Ø
Ø×Ñ˜EÐÕ"r/   NéÈ   )ç      à?r¸   r¸   r¸   c                 óª  — t        | «      }| j                  j                  ||j                  «       «       | j                  j	                  |dd«       |�|j                  |«       n'|�|j                  |«       n|j                  |||«       | j                  «        | j                  j                  | j                  j                  «       dz
  «       y)zwOpen a new tab with an optional file to load in it, or directly a
		pixbuf, or the color and dimensions of a blank tab.ÚreorderableTNr   )r	   r¥   Úappend_pageÚbuild_tab_widgetÚchild_set_propertyÚtry_load_fileÚtry_load_pixbufÚinit_backgroundÚ_update_tabs_visibilityr±   Úget_n_pages)r+   r1   r    rŠ   r‹   rŒ   Ú	new_images          r.   r@   zDrWindow._build_new_tab1  s¬   € ô �d‹m€)Ø‡-�-×Ñ˜I y×'AÑ'AÓ'CÔDØ‡-�-×"Ñ" 9¨m¸TÔBØ
ÐØ×Ñ˜5Õ!ØÐØ×Ñ˜VÕ$ð
 ×Ñ˜U F¨OÔ<Ø×ÑÔ Ø‡-�-× Ñ  §¡×!:Ñ!:Ó!<¸QÑ!>Õ?r/   c                 óR  — |j                  «       j                  d«      d   }t        | «      }t        d«      }|j	                  ||z  «       |j                  t        d«      d «      }|j                  t        d«      dd«      }|j                  «       }|j                  «        ||k(  S )Nú/éÿÿÿÿzThe file %s is already openedz
Open againzSwitch to this imagerO   T)r¯   rR   r   r6   rT   rU   rV   rW   )r+   r1   Ú
image_namer\   r]   Úopen_again_idÚswitch_to_idr`   s           r.   r°   zDrWindow.confirm_open_twiceF  sœ   € Ø�~‰~Ó×%Ñ% cÓ*¨2Ñ.€*Ü˜4Ó €&ä
Ð+Ó
,€%Ø×Ñ�E˜JÑ&Ô'ð ×#Ñ#¤A l£O°TÓ:€-Ø×"Ñ"¤1Ð%;Ó#<Ø1CÀTóK€,à�:‰:‹<€&Ø‡.�.ÔØ	�=Ñ	 Ð r/   c                 ó  — | j                   sy | j                  | j                  |d   «       | j                  |d   j	                  «       «       | j
                  j                  |d   j                  dz  «       |d   j                  «        y )Nr   éd   )	r#   rw   r"   rŽ   Úupdate_titler8   Úset_zoom_labelÚ
zoom_levelÚupdate_image_wide_actionsr˜   s     r.   Úon_active_tab_changedzDrWindow.on_active_tab_changedU  sr   € Ø	×	/Ò	/Ø	Ø‡.�.�×$Ñ$ d¨1¡gÔ.à×Ñ˜D ™G×0Ñ0Ó2Ô3Ø‡,�,×Ñ˜d 1™g×0Ñ0°3Ñ6Ô7Ø€q�'×#Ñ#Õ%r/   c                 óJ  — | j                  d«      }| j                  ddgddgg«      }|j                  «        | j                  j	                  «       D ]N  }|j                  «       }| j                  j                  |«      }|j                  |dt        |«      z   dz   «       ŒP y )NÚ
active_tabTr~   Fr   zwin.active_tab(ú))	Úlookup_actionr†   Ú
remove_allr¥   Úget_childrenrÌ   Úpage_numÚappendrD   )r+   ry   ÚactionÚsectionÚpageÚ	tab_titleÚ	tab_indexs          r.   Úupdate_tabs_menu_sectionz!DrWindow.update_tabs_menu_section_  s˜   € Ø×Ñ˜lÓ+€&Ø×"Ñ" T¨1 I°°q¨zÐ#:Ó;€'Ø	×ÑÔØ�m‰m×(Ñ(Ó*ò G€dØ× Ñ Ó"€9Ø�}‰}×%Ñ% dÓ+€9Ø
‡>�>�)Ð.´°Y³Ñ?À#ÑEÕFñGr/   c                 óì   — | j                   j                  «       }|dk(  r7| j                   j                  | j                   j                  «       dz
  «       y | j                   j                  |dz
  «       y ©Nr   r   )r¥   r¦   r±   rÂ   ©r+   ry   Úcurrent_pages      r.   Úaction_tab_leftzDrWindow.action_tab_lefth  sW   € à—‘×/Ñ/Ó1€,Ø�QÒØ‡=�=×!Ñ! $§-¡-×";Ñ";Ó"=ÀÑ"AÕBà‡=�=×!Ñ! ,°Ñ"2Õ3r/   c                 óì   — | j                   j                  «       }|| j                   j                  «       dz
  k(  r| j                   j                  d«       y | j                   j                  |dz   «       y ©Nr   r   )r¥   r¦   rÂ   r±   rá   s      r.   Úaction_tab_rightzDrWindow.action_tab_rightp  sW   € à—‘×/Ñ/Ó1€,Ø�T—]‘]×.Ñ.Ó0°1Ñ4Ò4Ø‡=�=×!Ñ! !Õ$à‡=�=×!Ñ! ,°Ñ"2Õ3r/   c                 óR  — | j                   j                  |«      }| j                   j                  |«      j                  «       s8| j                   j	                  |«       | j
                  j                  «       }|sy| j                   j                  |«       | j                  «        y)z-Close a tab (after asking to save if needed).FT)	r¥   r×   Úget_nth_pageÚis_savedr±   r:   Úconfirm_save_modifsÚremove_pagerÁ   )r+   ÚtabÚindexré   s       r.   Ú	close_tabzDrWindow.close_tabx  s~   € à
�-‰-×
 Ñ
  Ó
%€%Ø	�‰×	#Ñ	# EÓ	*×	3Ñ	3Ô	5Ø‡=�=×!Ñ! %Ô(Ø×!Ñ!×5Ñ5Ó7€8Ù
ØØ‡-�-×Ñ˜EÔ"Ø×ÑÔ Ø	r/   c                 óœ   — | j                   j                  «       dkD  r| j                  «       j                  «        y | j	                  «        y ©Nr   )r¥   rÂ   r›   rœ   Úcloser˜   s     r.   Úaction_close_tabzDrWindow.action_close_tab„  s5   € Ø	‡]�]×ÑÓ  1Ò$Ø×ÑÓ×(Ñ(Õ*à‡:�:…<r/   c                 ó$   — | j                  «        y ru   )rñ   r˜   s     r.   Úaction_close_windowzDrWindow.action_close_windowŠ  s   € Ø‡*�*…,r/   c                 óÀ  — | j                   j                  «       dk7  r=| j                  «       j                  «       sy| j                   j                  «       dk7  rŒ=| j                  j                  «        | j                  j                  «        | j                  j                  d| j                  «       | j                  j                  d| j                  «       «       y)z¸Event callback when trying to close a window. It saves/closes each
		tab and saves the current window settings in order to restore them.
		Returns `False` on success, `True` otherwise.r   Trb   r   F)r¥   rÂ   r›   rœ   Ú_decorationsÚremove_from_uir9   Úpersist_tools_optionsr&   rS   r"   Úset_booleanÚis_maximizedr˜   s     r.   Úon_closezDrWindow.on_close�  s©   € ð 	�‰×!Ñ!Ó# qÒ(Ø
×
Ñ
Ó
!×
/Ñ
/Ô
1Øð 	�‰×!Ñ!Ó# qÓ(ð ×Ñ×"Ñ"Ô$Ø×Ñ×,Ñ,Ô.Ø‡.�.×ÑÐ.°×0CÑ0CÔDØ‡.�.×Ñ˜[¨$×*;Ñ*;Ó*=Ô>Ø	r/   c                 óØ  — | j                   j                  d| j                  «       | j                   j                  d| j                  «       | j                  d| j                  «       | j                  d| j                  «       | j
                  j                  d| j                  «       | j
                  j                  d| j                  «       | j
                  j                  d| j                  «       | j
                  j                  d| j                  «       | j
                  j                  d	| j                  «       | j
                  j                  d
| j                  «       | j                  j                  d| j                  «       | j                  d| j                  «       | j                  d| j                  «       | j                  j                  ry | j                  j!                  t"        j$                  j&                  g t(        j*                  j,                  «       | j                  j                  d| j.                  «       | j                  j1                  «        y )Nrñ   Úresponsezdelete-eventzconfigure-eventzchanged::show-labelszchanged::deco-typezchanged::big-iconszchanged::preview-sizezchanged::disabled-toolszchanged::dark-theme-variantzswitch-pagezkey-press-eventzkey-release-eventzdrag-data-received)Úinfo_barrh   re   rû   Ú_adapt_to_window_sizer&   rk   Úon_layout_changedÚon_icon_size_changedÚshow_info_settingsr)   r¥   rÐ   Ú_check_for_alt_keyr    Úruns_in_sandboxÚdrag_dest_setr   ÚDestDefaultsÚALLr   Ú
DragActionÚMOVEÚon_data_droppedÚdrag_dest_add_uri_targets©r+   s    r.   r>   zDrWindow.connect_signalsž  s¸  € à‡-�-×Ñ˜ ×!3Ñ!3Ô4Ø‡-�-×Ñ˜
 D×$6Ñ$6Ô7ð ‡,�,ˆ~˜tŸ}™}Ô-ð ‡,�,Ð  $×"<Ñ"<Ô=ð ‡.�.×ÑÐ/°×1TÑ1TÔUØ‡.�.×ÑÐ-¨t×/EÑ/EÔFØ‡.�.×ÑÐ-¨t×/HÑ/HÔIØ‡.�.×ÑÐ0°$×2IÑ2IÔJà‡.�.×ÑÐ2°D×4KÑ4KÔLØ‡.�.×ÑÐ6¸×8RÑ8RÔSð ‡-�-×Ñ˜ t×'AÑ'AÔBð ‡,�,Ð  $×"9Ñ"9Ô:Ø‡,�,Ð" D×$;Ñ$;Ô<ð 
‡X�X×ÒØ	ð ‡-�-×Ñœc×.Ñ.×2Ñ2°B¼¿¹×8KÑ8KÔLØ‡-�-×ÑÐ,¨d×.BÑ.BÔCØ‡-�-×)Ñ)Õ+r/   c                 ó¾   — | j                   j                  «       }|D ]=  }|d   rt        j                  }nt        j                  }|j                  |d   |«      }Œ? |S )z´Get an item of the app-wide menubar. The `path_description` object
		is an array of [boolean, int] couples. The boolean means if we're
		looking for a submenu, the int is an index.r   r   )r    Úget_menubarr   ÚMENU_LINK_SUBMENUÚMENU_LINK_SECTIONÚget_item_link)r+   Úpath_descriptionÚcurrent_itemÚitemÚ	link_types        r.   r†   zDrWindow._get_menubar_itemÄ  sb   € ð —‘×%Ñ%Ó'€,Øò A€dØ
ˆ1‚gÜ×%Ñ%�Iä×%Ñ%€IØ×,Ñ,¨T°!©W°iÓ@�<ðAð 
Ðr/   c                 óÈ   — t         j                  j                  |d«      }|j                  d|«       | j	                  |«       | j
                  j                  d|z   |«       y)z¬Convenient wrapper method adding a stateless action to the window. It
		will be named 'action_name' (string) and activating the action will
		trigger the method 'callback'.NÚactivatezwin.)r   ÚSimpleActionÚnewrh   Ú
add_actionr    Úset_accels_for_action)r+   Úaction_nameÚcallbackÚ	shortcutsrÙ   s        r.   Úadd_action_simplezDrWindow.add_action_simpleÑ  sO   € ô ×Ñ×Ñ ¨TÓ2€&Ø‡.�.�˜XÔ&Ø‡/�/�&ÔØ‡(�(× Ñ  ¨+Ñ!5°yÕAr/   c                 óÎ   — t        j                  «       j                  |dt        j                  j                  |«      «      }|j                  d|«       | j                  |«       y)zÛConvenient wrapper method adding a stateful action to the window. It
		will be named 'action_name' (string), be created with the state 'default'
		(boolean), and activating the action will trigger the method 'callback'.Núchange-state)r   r  Únew_statefulr   ÚVariantÚnew_booleanrh   r  ©r+   r  Údefaultr  rÙ   s        r.   Úadd_action_booleanzDrWindow.add_action_booleanÚ  sN   € ô ×ÑÓ×*Ñ*¨;¸Ü(,¯©×(@Ñ(@ÀÓ(IóK€&à‡.�.� Ô*Ø‡/�/�&Õr/   c                 ó  — t        j                  «       j                  |t        j                  j                  d«      t        j                  j                  |«      «      }|j                  d|«       | j                  |«       y)zïConvenient wrapper method adding a stateful action to the window. It
		will be named 'action_name' (string), be created with the state 'default'
		(string), and changing the active target of the action will trigger the
		method 'callback'.Úsr!  N)
r   r  r"  r   ÚVariantTyper  r#  Ú
new_stringrh   r  r%  s        r.   Úadd_action_enumzDrWindow.add_action_enumã  s_   € ô
 ×ÑÓ×*Ñ*¨;Ü×Ñ×"Ñ" 3Ó'¬¯©×)@Ñ)@ÀÓ)IóK€&à‡.�.� Ô*Ø‡/�/�&Õr/   c                 ó"  — | j                  d| j                  dg«       | j                  d| j                  dg«       t        j                  j                  d| d«      }| j                  |«       | j                  j                  ddg«       | j                  dd	| j                  «       | j                  j                  d
dg«       | j                  j                  d«      }| j                  d|| j                  «       | j                  j                  d«      }| j                  d|| j                  «       | j                  j                  ddg«       | j                  dd	| j                  «       | j                  j                  ddg«       | j!                  d«      j#                  d	«       | j                  dd	| j$                  «       | j                  j                  ddg«       | j                  d| j&                  dg«       | j                  d| j(                  dg«       | j                  d| j*                  «       | j                  d| j,                  «       | j                  d| j.                  dg«       | j                  d | j0                  d!g«       | j                  d"| j2                  d#g«       | j                  d$| j4                  d%g«       | j                  d&| j6                  d'd(g«       | j                  d)| j8                  d*d+g«       | j                  d,| j:                  d-d.g«       | j                  d/| j<                  d0d1g«       | j                  d2| j>                  d3d4g«       | j                  d5| j@                  d6d7g«       | j                  d8| jB                  d9d:g«       | j                  d;| jD                  d<d=g«       | j                  d>| jF                  d?d@g«       | j                  dA| jH                  dBg«       | j                  dC| jJ                  «       | j                  dD| jL                  dEg«       | j                  dF| jN                  dGg«       | j                  dH| jP                  dIg«       | j                  dJ| jR                  dKg«       | j                  dL| jT                  dMg«       | j                  dN| jV                  dOg«       | j                  dP| jX                  «       | j                  dQ| jZ                  dRg«       | j                  dS| j\                  dTg«       | j                  dU| j^                  dVg«       | j                  dW| j`                  «       | j                  dX| jb                  dYg«       | j                  dZ| jd                  «       | j                  d[| jf                  d\g«       | j                  d]| jh                  «       | j                  d^| jj                  d_g«       | j                  d`| jl                  dag«       | j                  db| jn                  dcg«       | j                  dd| jp                  deg«       | j                  df| jr                  dgg«       | j                  dh| jt                  dig«       | j                  dj| jv                  dkg«       | j                  dl| jx                  «       | j                  dm| jz                  «       | j                  dn| j|                  «       | j                  do| j~                  dpg«       | j                  dq| j€                  drg«       | j                  ds| j‚                  «       | j…                  dtt†        | jˆ                  «       | j                  du| jŠ                  dvg«       | j                  dw| jŒ                  dxg«       | j                  dy| jŽ                  dzg«       | j                  j                  d{«      }| j                  j                  d||| j�                  «       | j                  d}| j’                  d~g«       | j                  d| j”                  d€g«       | j–                  rs| j                  d�| j˜                  «       | j                  d‚| jš                  «       | j                  dƒ| jœ                  d„g«       | j                  d…d	| jž                  «       t        j                  j                  d†| j                   d‡«      }| j                  |«       yˆ)‰z~This doesn't add all window-wide GioActions, but only the GioActions
		which are here "by default", independently of any tool.Ú	main_menuÚF10Úoptions_menuz
<Shift>F10zshow-menubarzwin.show-menubarz<Ctrl>F2Útoggle_previewFzwin.toggle_previewz<Ctrl>múdark-theme-variantzdark-variantúshow-labelsÚshow_labelszwin.show_labelsÚF9Úhide_controlszwin.hide_controlsÚF8Ú
fullscreenzwin.fullscreenÚF11Úreset_canvasz<Ctrl>BackSpaceÚreload_filez<Ctrl>rÚ
propertiesÚunfullscreenÚgo_upz<Ctrl>UpÚgo_downz
<Ctrl>DownÚgo_leftz
<Ctrl>LeftÚgo_rightz<Ctrl>RightÚgo_topz<Ctrl>Page_Upz<Ctrl>KP_Page_UpÚ	go_bottomz<Ctrl>Page_Downz<Ctrl>KP_Page_DownÚgo_firstz
<Ctrl>Homez<Ctrl>KP_HomeÚgo_lastz	<Ctrl>Endz<Ctrl>KP_EndÚzoom_inz
<Ctrl>plusz<Ctrl>KP_AddÚzoom_outz<Ctrl>minusz<Ctrl>KP_SubtractÚzoom_100z<Ctrl>1z
<Ctrl>KP_1Ú	zoom_optiz<Ctrl>0z
<Ctrl>KP_0Úzoom_maxz<Ctrl><Shift>plusz<Ctrl><Shift>KP_AddÚnew_tabz<Ctrl>tÚnew_tab_customÚnew_tab_selectionz<Ctrl><Shift>tÚnew_tab_clipboardz<Ctrl><Shift>vÚopenz<Ctrl>oÚ	tab_rightz	<Ctrl>TabÚtab_leftz<Ctrl><Shift>Tabrî   z<Ctrl>wrñ   Úundoz<Ctrl>zÚredoz<Ctrl><Shift>zÚsavez<Ctrl>sÚsave_alphalessÚsave_asz<Ctrl><Shift>sÚ	export_asÚto_clipboardz<Ctrl><Shift>cÚprintÚimportz<Ctrl>iÚpastez<Ctrl>vÚ
select_allz<Ctrl>aÚunselectz<Ctrl><Shift>aÚselection_cutz<Ctrl>xÚselection_copyz<Ctrl>cÚselection_deleteÚDeleteÚselection_exportzselection-replace-canvaszselection-expand-canvasÚback_to_previousz<Ctrl>bÚapply_transformz<Ctrl>ReturnÚcancel_transformrE   Ú
main_colorz<Ctrl><Shift>lÚsecondary_colorz<Ctrl><Shift>rÚexchange_colorz<Ctrl>eúdirect-color-editÚ
use_editorÚ	size_morez<Ctrl><Shift>UpÚ	size_lessz<Ctrl><Shift>DownÚrestore_pixbufÚrebuild_from_histor“   z<Ctrl>gÚtrack_frameraterÒ   rÛ   N)Qr  Úaction_main_menuÚaction_options_menur   ÚPropertyActionr  r  r    r  r'  Úaction_toggle_previewr&   r'   Úaction_dark_themeÚaction_show_labelsÚaction_hide_controlsrÔ   Úset_enabledÚaction_fullscreenÚaction_resetÚaction_reloadÚaction_propertiesÚaction_unfullscreenÚaction_go_upÚaction_go_downÚaction_go_leftÚaction_go_rightÚaction_go_topÚaction_go_bottomÚaction_go_firstÚaction_go_lastÚaction_zoom_inÚaction_zoom_outÚaction_zoom_100Úaction_zoom_optiÚaction_zoom_maxrA   r”   r¬   r�   Úaction_openræ   rã   rò   rô   Úaction_undoÚaction_redoÚaction_saveÚaction_save_alphalessÚaction_save_asÚaction_export_asÚaction_export_cbÚaction_printÚaction_importÚaction_pasteÚaction_select_allÚaction_unselectÚ
action_cutÚaction_copyÚaction_deleteÚaction_selection_exportÚaction_selection_replace_canvasÚaction_selection_expand_canvasrc  Úaction_apply_transformÚaction_cancel_transformr,  rn   Úon_change_active_toolÚaction_color1Úaction_color2Úexchange_colorsÚaction_use_editorÚaction_size_moreÚaction_size_lessr$   Úaction_restoreÚaction_rebuildÚaction_getvaluesÚ
action_fspr¥   )r+   rÙ   Údark_variantr4  Úeditors        r.   r<   zDrWindow.add_all_win_actionsí  sò  € ð ×Ñ˜ d×&;Ñ&;¸e¸WÔEØ×Ñ˜¨×)AÑ)AÀLÀ>ÔRä×Ñ×!Ñ! .°$¸ÓG€&Ø‡/�/�&ÔØ‡(�(× Ñ Ð!3°j°\ÔBà×ÑÐ*¨E°4×3MÑ3MÔNØ‡(�(× Ñ Ð!5¸	°{ÔCà—‘×+Ñ+Ð,@ÓA€,Ø×Ñ˜.¨,¸×8NÑ8NÔOà—‘×*Ñ*¨=Ó9€+Ø×Ñ˜-¨°d×6MÑ6MÔNØ‡(�(× Ñ Ð!2°T°FÔ;à×Ñ˜/¨5°$×2KÑ2KÔLØ‡(�(× Ñ Ð!4°t°fÔ=Ø×Ñ�_Ó%×1Ñ1°%Ô8à×Ñ˜,¨¨t×/EÑ/EÔFØ‡(�(× Ñ Ð!1°E°7Ô;à×Ñ˜¨×):Ñ):Ð=NÐ<OÔPØ×Ñ˜¨×(:Ñ(:¸Y¸KÔHØ×Ñ˜ t×'=Ñ'=Ô>Ø×Ñ˜¨×)AÑ)AÔBà×Ñ˜ $×"3Ñ"3°j°\ÔBØ×Ñ˜ D×$7Ñ$7¸,¸ÔHØ×Ñ˜ D×$7Ñ$7¸,¸ÔHØ×Ñ˜ T×%9Ñ%9¸M¸?ÔKà×Ñ˜ 4×#5Ñ#5Ø%4Ð6HÐ$IôKà×Ñ˜ d×&;Ñ&;Ø!2Ð4HÐ IôKà×Ñ˜ T×%9Ñ%9Ø+7¸Ð*IôKà×Ñ˜ D×$7Ñ$7Ø-8¸.Ð,IôKð ×Ñ˜ D×$7Ñ$7Ø,8¸.Ð+IôKà×Ñ˜ T×%9Ñ%9Ø&3Ð5HÐ%IôKà×Ñ˜ T×%9Ñ%9¸IÀ|Ð;TÔUØ×Ñ˜ d×&;Ñ&;¸iÈÐ=VÔWØ×Ñ˜ T×%9Ñ%9Ð<OÐQfÐ;gÔhà×Ñ˜ D×$:Ñ$:¸Y¸KÔHØ×ÑÐ)¨4×+@Ñ+@ÔAØ×ÑÐ,Ø×5Ñ5Ð8HÐ7IôKà×ÑÐ,Ø×5Ñ5Ð8HÐ7IôKà×Ñ˜ ×!1Ñ!1°I°;Ô?Ø×Ñ˜ d×&;Ñ&;¸k¸]ÔKØ×Ñ˜ T×%9Ñ%9Ð<NÐ;OÔPØ×Ñ˜ d×&;Ñ&;¸i¸[ÔIØ×Ñ˜ $×":Ñ":Ô;à×Ñ˜ ×!1Ñ!1°I°;Ô?Ø×Ñ˜ ×!1Ñ!1Ð4DÐ3EÔFà×Ñ˜ ×!1Ñ!1°I°;Ô?Ø×ÑÐ)¨4×+EÑ+EÔFØ×Ñ˜ D×$7Ñ$7Ð:JÐ9KÔLØ×Ñ˜ d×&;Ñ&;Ô<Ø×Ñ˜¨×)>Ñ)>ÐAQÐ@RÔSØ×Ñ˜ $×"3Ñ"3Ô4à×Ñ˜ 4×#5Ñ#5¸	°{ÔCØ×Ñ˜ $×"3Ñ"3°i°[ÔAØ×Ñ˜ t×'=Ñ'=À	¸{ÔKØ×Ñ˜ T×%9Ñ%9Ð<LÐ;MÔNà×Ñ˜¨$¯/©/¸I¸;ÔGØ×ÑÐ)¨4×+;Ñ+;¸i¸[ÔIØ×ÑÐ+¨T×-?Ñ-?À(ÀÔLà×ÑÐ+¨T×-IÑ-IÔJØ×ÑÐ3Ø%)×%IÑ%IôKà×ÑÐ2Ø&*×&IÑ&IôKð ×ÑÐ+¨T×-BÑ-BÀYÀKÔPØ×ÑÐ*¨D×,GÑ,GÈ.ÐIYÔZØ×ÑÐ+¨T×-IÑ-IÔJà×Ñ�}¤o°t×7QÑ7QÔRà×Ñ˜ t×'9Ñ'9Ð<LÐ;MÔNØ×ÑÐ*¨D×,>Ñ,>ÐAQÐ@RÔSØ×ÑÐ)¨4×+?Ñ+?À)ÀÔMà�>‰>×%Ñ%Ð&9Ó:€&Ø‡(�(×Ñ˜l¨F°D×4JÑ4JÔKà×Ñ˜ d×&;Ñ&;Ð>OÐ=PÔQØ×Ñ˜ d×&;Ñ&;Ð>QÐ=RÔSà	‡_‚_Ø×ÑÐ*¨D×,?Ñ,?Ô@Ø×ÑÐ.°×0CÑ0CÔDØ×Ñ˜,¨×(=Ñ(=À	¸{ÔKØ×ÑÐ,¨e°T·_±_ÔEä×Ñ×!Ñ! ,°·±¸vÓF€&Ø‡/�/�&Õr/   c                 óø   — |r| j                  «       j                  }nd}t        j                  j	                  t        j
                  j                  «       |«      }| j                  «       j                  |«       y)z»Called by the tools at various occasions, this method updates the
		mouse cursor according to `is_custom` (if False, use the default cursor)
		and the active tool `cursor_name` attribute.r&  N)	rE   Úcursor_namer   ÚCursorÚnew_from_nameÚDisplayÚget_defaultÚ
get_windowÚ
set_cursor)r+   Ú	is_customÚnameÚcursors       r.   r³  zDrWindow.set_cursorb  sX   € ñ Ø
×
Ñ
Ó
×
(Ñ
(�4à
€4Ü�:‰:×#Ñ#¤C§K¡K×$;Ñ$;Ó$=¸tÓD€&Ø‡/�/Ó×Ñ˜vÕ&r/   c                 óÞ   — 	 | j                   j                  «       }| j                  «        | j                   j                  |«       | j	                  «        | j                  «        y #  Y y xY wru   )rö   r÷   r*   Úset_compactrŽ   Úset_window_subtitles)r+   ry   Ú	is_narrows      r.   r   zDrWindow.on_layout_changedp  s]   € ðØ× Ñ ×/Ñ/Ó1€9Ø×ÑÔØ×Ñ× Ñ  Ô+Ø×ÑÔØ×ÑÕøðÙús   ‚A%A( Á(A,c                 ó8   — | j                  t        d«      «       y)zuThis is executed when a setting changed but the method to apply it
		immediately in the current window doesn't exist.z6Modifications will take effect in the next new window.N)rC   r6   r˜   s     r.   r  zDrWindow.show_info_settings|  s   € ð ×Ñ”aÐPÓQÕRr/   c                 óÐ   — |€| j                  «       j                  «       }| j                  «        | j                  j	                  |«      r| j                  j                  «        yy)zdSet the window's title (regardless of the current UI bars), and the
		active tab title (indirectly).N)r›   rÌ   rÞ   rö   Ú	set_titleÚforce_update_titles)r+   Ú
main_titles     r.   rŽ   zDrWindow.update_picture_title�  sX   € ð ÐØ×%Ñ%Ó'×4Ñ4Ó6€:Ø×ÑÔ!Ø	×Ñ× Ñ  Ô,Ø×Ñ×(Ñ(Õ*ð -r/   c                 ó°   — |€| j                  «       j                  «       }| j                  j                  |«      r| j                  j	                  «        yy)zˆSet the window's subtitles list (regardless of the current UI bars).
		Tools have to be initialized before calling this method, for now.N)rE   Úget_editing_tipsrö   Úset_subtitlesr¾  )r+   Úsubtitles_lists     r.   r¹  zDrWindow.set_window_subtitlesŠ  sL   € ð Ðà×$Ñ$Ó&×7Ñ7Ó9€>Ø	×Ñ×$Ñ$ ^Ô4Ø×Ñ×(Ñ(Õ*ð 5r/   c                 ól   — t        j                  dd«      }d|v ryd|v ryd|v ryd|v ry	d
|v ry|dv ryy)zWReturn the decorations setting based on the XDG_CURRENT_DESKTOP
		environment variable.ÚXDG_CURRENT_DESKTOPÚGNOMEÚhgÚPantheonÚheÚUnityÚtcÚKDEÚtsÚCinnamonÚmts)ÚMATEÚXFCEÚLXDEÚLXQtÚmtc)ÚosÚgetenv)r+   Údesktop_envs     r.   Úget_auto_decorationszDrWindow.get_auto_decorations“  s[   € ô —	‘	Ð/°Ó9€+Ø�ÑØ
Ø�[Ñ Ø
Ø�+ÑØ
Ø�ÑØ
Ø�[Ñ Ø
ØÐ6Ñ6Ø
à
r/   c                 ó¦  — d| _         | j                  j                  d«      | _        | j                  dk(  r| j	                  «       | _        | j                  dk(  rt        d| «      | _        n«| j                  dk(  rt        d| «      | _        nŠ| j                  dk(  rt        | d«      | _        nid| j                  v r/d	| j                  v }d| j                  v }t        ||| «      | _        n,| j                  j                  dd«       | j                  «        | j                  j                  «       r | j                  «       j                  d
«       yy)zÓSet the UI "bars" (headerbar, menubar, titlebar, toolbar, whatever)
		according to the user's preference, which by default is an empty string.
		In this case, an useful string is set by `get_auto_decorations()`.Fz	deco-typeÚ rÇ  rÉ  TÚmÚtr)  ÚdevelN)Úhas_good_width_limitsr&   rP   Údeco_layoutrØ  r   rö   r   r   rS   r*   r    Úis_betaÚget_style_contextÚ	add_class)r+   ÚsymbolicÚmenubars      r.   r*   zDrWindow._set_ui_bars§  s&  € ð  %€$Ôð —^‘^×.Ñ.¨{Ó;€$ÔØ	×Ñ˜ÒØ×/Ñ/Ó1€4Ôà	×Ñ˜ÒÜ-¨e°TÓ:€4ÕØ×Ñ˜4ÒÜ-¨d°DÓ9€4ÕØ×Ñ˜3ÒÜ+¨D°$Ó7€4ÕØ
ˆd×ÑÑØ�T×%Ñ%Ð%€8Ø�D×$Ñ$Ð$€7Ü+¨H°g¸tÓD€4Õà‡>�>×Ñ˜[¨"Ô-Ø×ÑÔà	‡X�X×ÑÔØ×ÑÓ×%Ñ% gÕ.ð r/   c                 ó8   — | j                   j                  «        y ru   )rö   Útoggle_menur˜   s     r.   rp  zDrWindow.action_main_menuÃ  s   € Ø×Ñ×ÑÕ!r/   c                 ó8   — | j                   j                  «        y)zsThis displays/hides the tool's options menu, and is implemented as an
		action to ease the accelerator (shift+f10).N)r9   ræ  r˜   s     r.   rq  zDrWindow.action_options_menuÆ  s   € ð ×Ñ×"Ñ"Õ$r/   c                 ó¬  — | j                   sN| j                  «       dkD  r;| j                  j                  «        | j                  j                  «        d| _         | j                  j                  «        | j                  j                  «       }| j                  sy| j                  j                  |«       | j                  «       j                  «        y)zÎAdapts the headerbar (if any) and the default bottom pane to the new
		window size. If the current bottom pane isn't the default one, this
		will call the tool method applying the new size to the tool pane.i¼  TN)
rÞ  Úget_allocated_widthr9   Úinit_adaptabilityrö   Úadapt_to_window_sizeÚbottom_panes_boxr#   r›   Úfake_scrollbar_update)r+   ry   Úavailable_widths      r.   rÿ   zDrWindow._adapt_to_window_sizeË  s¦   € ð 
×	#Ò	#¨×(@Ñ(@Ó(BÀSÒ(HØ×Ñ×)Ñ)Ô+Ø×Ñ×&Ñ&Ô(Ø $€4ÔØ×Ñ×(Ñ(Ô*à×)Ñ)×=Ñ=Ó?€/Ø	×	/Ò	/Ø	Ø×Ñ×+Ñ+¨OÔ<ð ×ÑÓ×/Ñ/Õ1r/   c                 ó¼   — | j                  d«      j                  «       }| j                  j                  «       dkD  xr | }| j                  j	                  |«       y )Nr6  r   )rÔ   Ú	get_stater¥   rÂ   Úset_show_tabs)r+   Úcontrols_hiddenÚshould_shows      r.   rÁ   z DrWindow._update_tabs_visibilityÝ  sL   € Ø×&Ñ& Ó7×AÑAÓC€/Ø—‘×*Ñ*Ó,¨qÑ0ÒI¸/Ð6I€+Ø‡-�-×Ñ˜kÕ*r/   c                 ó¨   — |d   }| j                   j                  d|«       |d   j                  t        j                  j                  |«      «       y )Nr   r2  r   )r&   rù   Ú	set_stater   r#  r$  )r+   ry   Úshall_be_darks      r.   rt  zDrWindow.action_dark_themeâ  sA   € Ø�q‘'€-Ø‡.�.×ÑÐ1°=ÔAØ€q�'×Ñ”D—L‘L×,Ñ,¨]Ó;Õ<r/   c                 óš   — d}| j                   j                  d«      }t        j                  j	                  «       j                  ||«       y )Nz!gtk-application-prefer-dark-themer2  )r&   r'   r   ÚSettingsr±  Úset_property)r+   ry   ÚkeyÚuse_dark_themes       r.   r)   zDrWindow._update_theme_variantç  s9   € Ø+€#Ø—>‘>×-Ñ-Ð.BÓC€.Ü‡,�,×ÑÓ×)Ñ)¨#¨~Õ>r/   c                 ó:   — | j                   rt        d|z   «       y y )Nz	Drawing: )r$   rY  ©r+   Úmessages     r.   rd   zDrWindow.log_messageð  s   € Ø	‡_‚_Üˆ�wÑ	Õð r/   c                 óF  — | j                   j                  d«       | j                  j                  |«       | j                  j                  d«       | j                  j                  t        d«      «       | j                  j                  d«       | j                  |«       y)z\Update the label and the visibility of the info bar. The 'report bug'
		action is suggested.Tzapp.report-issuezReport a bugN)rþ   Úset_visibleÚ
info_labelÚ	set_labelÚinfo_actionÚset_action_namer6   rd   rý  s     r.   r5   zDrWindow.reveal_action_reportô  sx   € ð ‡-�-×Ñ˜DÔ!Ø‡/�/×Ñ˜GÔ$Ø×Ñ×"Ñ"Ð#5Ô6Ø×Ñ×ÑœQ˜~Ó.Ô/Ø×Ñ×Ñ˜tÔ$Ø×Ñ�7Õr/   c                 ó  — |r#t        j                  d| j                  d|i«       | j                  j	                  d«       | j
                  j	                  d«       | j                  j                  |«       | j                  |«       y)z‰Update the label and the visibility of the info bar. No action is
		suggested, and the info bar may optionally be hidden after 4 seconds.i   r]   TFN)	r   r–   Ú_DrWindow__hide_message_asyncrþ   r   r  r  r  rd   )r+   r]   Úhide_afterwardss      r.   rC   zDrWindow.reveal_messageþ  sj   € ñ Ü×Ñ�D˜$×3Ñ3°g¸uÐ5EÔFØ‡-�-×Ñ˜DÔ!Ø×Ñ×Ñ˜uÔ%Ø‡/�/×Ñ˜EÔ"Ø×Ñ�5Õr/   c                 ód   — |d   | j                   j                  «       k(  r| j                  «        y)rš   r]   F)r  Ú	get_labelre   )r+   Úasync_cb_datas     r.   Ú__hide_message_asynczDrWindow.__hide_message_async  s+   € à�7Ñ˜tŸ™×8Ñ8Ó:Ò:Ø×ÑÔà	r/   c                 ó¦   — | j                   j                  d«       | j                  j                  d«       | j                  j	                  d«       y )NFrÚ  )rþ   r   r  r  r  r˜   s     r.   re   zDrWindow._hide_message  s:   € Ø‡-�-×Ñ˜EÔ"Ø×Ñ×Ñ˜uÔ%Ø‡/�/×Ñ˜BÕr/   c                 ó‚   — | j                  d«      }|j                  t        j                  j	                  d«      «       y)z"Simple action, exiting fullscreen.r8  FN©rÔ   Úchange_stater   r#  r$  )r+   ry   Ú	fs_actions      r.   r|  zDrWindow.action_unfullscreen  s/   € à× Ñ  Ó.€)Ø×ÑœŸ™×1Ñ1°%Ó8Õ9r/   c                 ó¢  — |d   }|r;| j                  «        | j                  t        d«      dz   t        d«      z   d«       n| j                  «        | j	                  |«       | j                  d«      j                  |«       | j                  j                  |«       |d   j                  t        j                  j                  |«      «       y)	z)Boolean action, toggling fullscreen mode.r   z/Middle-click or press F8 to show/hide controls.ú zPress F11 to exit fullscreen.Tr6  r   N)r8  rC   r6   r=  Ú_set_controls_hiddenrÔ   rw  Úunfullscreen_btnr   rõ  r   r#  r$  )r+   ry   Úshall_fullscreens      r.   rx  zDrWindow.action_fullscreen  sº   € ð ˜!‘WÐÙØ‡?�?ÔØ×Ñ”qÐJÓKØñÜÐ ?Ó@ñAØBFõHð ×ÑÔØ×ÑÐ,Ô-Ø×Ñ�_Ó%×1Ñ1Ð2BÔCØ×Ñ×#Ñ#Ð$4Ô5Ø€q�'×Ñ”D—L‘L×,Ñ,Ð-=Ó>Õ?r/   c                 ó”  — |d   }| j                   j                  | «       d| j                  v r| j                  j                  | «       d| j                  v r| j	                  | «       | j
                  j                  | «       |d   j                  t        j                  j                  |«      «       | j                  «        y)z¼Boolean action controlling the visibility of the UI elements such as
		the tools list, the bottom pane, the menubar/toolbar if any. This can
		only (in theory) be used while in fullscreen.r   rÜ  rÛ  r   N)rg   r   rß  Útoolbar_boxÚset_show_menubarÚbottom_meta_boxrõ  r   r#  r$  rÁ   )r+   ry   rò  s      r.   rv  zDrWindow.action_hide_controls-  s¬   € ð ˜‘G€/Ø×Ñ× Ñ  _Ð!4Ô5ØˆD×ÑÑØ×Ñ×Ñ OÐ 3Ô4ØˆD×ÑÑØ×Ñ˜_Ð,Ô-Ø×Ñ×"Ñ" Ð#6Ô7Ø€q�'×Ñ”D—L‘L×,Ñ,¨_Ó=Ô>Ø×ÑÕ r/   c                 ó‚   — | j                  d«      }|j                  t        j                  j	                  |«      «       y )Nr6  r  )r+   ÚstateÚ	hc_actions      r.   r  zDrWindow._set_controls_hidden;  s/   € Ø× Ñ  Ó1€)Ø×ÑœŸ™×1Ñ1°%Ó8Õ9r/   c                 óú   — | j                  d«      j                  «       }|r2| j                  d«      }| j                  |j                  «        «       y | j                  j	                  «       j                  «        y )Nr8  r6  )rÔ   rð  r  r9   Úget_active_paneÚmiddle_click_action)r+   Úis_fullscreenedr  s      r.   Úon_middle_clickzDrWindow.on_middle_click?  sc   € Ø×&Ñ& |Ó4×>Ñ>Ó@€/ÙØ×!Ñ! /Ó2€9Ø×Ñ ×!4Ñ!4Ó!6Ð6Õ7à×Ñ×'Ñ'Ó)×=Ñ=Õ?r/   c                 ó`   — | j                   D ]  }| j                   |   j                  «        Œ! y ru   )r7   Úupdate_icon_size)r+   ry   rs   s      r.   r  zDrWindow.on_icon_size_changedJ  s*   € Ø—‘ò *€gØ‡:�:ˆgÑ×'Ñ'Õ)ñ*r/   c                 óú  — | j                   D ]   }| j                   |   j                  |«       Œ" t        | j                   «      }| j                  j	                  «       }|ru| j                  j                  |«       || j                  k(  rÖ| j                  j                  | j                  «       | j                  j                  | j                  «       n‹|| j                  k(  rJ| j                  j                  | j                  «       | j                  j                  | j                  «       t        ||dz  z   dz  «      dz
  }| j                  j                  |«       | j                  j                  |«       y)z´Change the way tools are displayed in the side pane. Visible labels
		mean the tools will be arranged in a scrollable list of buttons, else
		they will be in an adaptative flowbox.é   r   N)r7   Úset_show_labelÚlenrg   Ú
get_parentÚset_min_children_per_lineÚtools_nonscrollable_boxÚremoveÚtools_scrollable_boxÚaddÚintÚset_max_children_per_line)r+   Úvisiblers   Únb_toolsÚ
parent_boxÚnb_mins         r.   Úset_tools_labels_visibilityz$DrWindow.set_tools_labels_visibilityN  s/  € ð —‘ò /€gØ‡:�:ˆgÑ×%Ñ% gÕ.ð/ä�—‘‹_€(Ø×!Ñ!×,Ñ,Ó.€*ÙØ×Ñ×/Ñ/°Ô9Ø�D×0Ñ0Ò0Ø× Ñ ×'Ñ'¨×(:Ñ(:Ô;Ø×Ñ×!Ñ! $×"4Ñ"4Õ5à�D×-Ñ-Ò-Ø×Ñ×$Ñ$ T×%7Ñ%7Ô8Ø× Ñ ×$Ñ$ T×%7Ñ%7Ô8Ü�(˜H q™LÑ)¨1Ñ,Ó.°Ñ2€6Ø×Ñ×/Ñ/°Ô7Ø×Ñ×.Ñ.¨xÕ8r/   c                 óX   — | j                  | j                  j                  d«      «       y )Nr3  )r4  r&   r'   r˜   s     r.   rk   z'DrWindow.on_show_labels_setting_changedc  s   € à×"Ñ" 4§>¡>×#=Ñ#=¸mÓ#LÕMr/   c                 óÆ   — |d   j                  «        }| j                  j                  d|«       |d   j                  t        j
                  j                  |«      «       y )Nr   r3  )rð  r&   rù   rõ  r   r#  r$  )r+   ry   r4  s      r.   ru  zDrWindow.action_show_labelsg  sL   € Ø˜‘G×%Ñ%Ó'Ð'€+Ø‡.�.×Ñ˜]¨KÔ8Ø€q�'×Ñ”D—L‘L×,Ñ,¨[Ó9Õ:r/   c                 ó,  — |d   j                   t        j                  j                  z  |d   j                   k(  sy |d   j                  t        j
                  j                  k(  }| j                  D ]   }| j                  |   j                  |«       Œ" y rð   )	r  r   ÚModifierTypeÚ	MOD1_MASKÚtypeÚ	EventTypeÚ	KEY_PRESSr7   Úshow_only_mnemonics)r+   ry   Úis_pressrs   s       r.   r  zDrWindow._check_for_alt_keyl  st   € Ø	ˆa‰�‰œ×)Ñ)×3Ñ3Ñ	3°t¸A±w·}±}Ò	DØ	Ø�!‰W�\‰\œSŸ]™]×4Ñ4Ñ4€(Ø—‘ò 5€gØ‡:�:ˆgÑ×*Ñ*¨8Õ4ñ5r/   c                 ó  — |d   j                  «       }||d   j                  «       j                  «       k(  ry| j                  |   j                  «       r| j	                  |«       y| j                  |   j                  «        y)z”Action callback, doing nothing in some situations, thus avoiding
		infinite loops. It sets the correct `tool_id` using adequate methods
		otherwise.r   r   N)rP   rð  r7   r|   rw   rF   )r+   ry   Ústate_as_strings      r.   rŸ  zDrWindow.on_change_active_toolv  sm   € ð ˜‘G×&Ñ&Ó(€/Ø˜˜Q™×)Ñ)Ó+×6Ñ6Ó8Ò8Ø	Ø	‡Z�Z�Ñ ×:Ñ:Ô<Ø‡>�>�/Õ"à‡:�:ˆoÑ×3Ñ3Õ5r/   c                 óÌ  — d| _         | j                  d«      }|j                  t        j                  j                  |«      «       | j                  | _        | j                  |   j                  }| j                  «       j                  |«       | j                  «       j                  «        | j                  «       j                  j                  «        || _         | j                  «       j!                  «        || _        | j#                  «       j%                  «        | j'                  «        | j                  «       j)                  «        | j+                  «        d| _         y)z‚Switch from the current tool to `new_tool_id` and to the current
		image to `image_pointer` (`None` if the image is not changing).NrE   )r!   rÔ   rõ  r   r#  r+  r"   ro   r7   Úaccept_selectionÚformer_toolÚgive_back_controlÚon_tool_unselectedr›   r©   Úhide_popoversÚupdaterE   Úon_tool_selectedÚ_update_bottom_paneÚupdate_actions_stater¹  )r+   Únew_tool_idÚimage_pointerrÙ   Úshould_preserve_selections        r.   rw   zDrWindow.switch_to‚  s  € ð "&€$Ôà×Ñ˜mÓ,€&Ø×Ñ”4—<‘<×*Ñ*¨;Ó7Ô8ð ×+Ñ+€$ÔØ"Ÿj™j¨Ñ5×FÑFÐØ×ÑÓ×&Ñ&Ð'@ÔAØ×ÑÓ×'Ñ'Ô)Ø×ÑÓ×#Ñ#×1Ñ1Ô3à!.€$Ôð ×ÑÓ× Ñ Ô"Ø#€$ÔØ×ÑÓ×%Ñ%Ô'Ø×ÑÔØ×ÑÓ×.Ñ.Ô0Ø×ÑÔà!%€$Õr/   c                 óŽ  — 	 | j                   j                  | j                  «       j                  «       | j                   j	                  | j                  «       «       | j                  «        | j                  «        y# t        $ r<}| j                  t        d«      | j                  z  «       t        |«       Y d}~yd}~ww xY w)zAShow the correct bottom pane, with the correct tool options menu.zHError loading the bottom pane for the tool '%s', please report this bug.N)r9   Útry_enable_panerE   Úpane_idÚupdate_paneÚ_build_options_menurÿ   rB   rC   r6   r"   rY  )r+   Úes     r.   rI  zDrWindow._update_bottom_pane�  s¢   € ðØ×Ñ×'Ñ'¨×(8Ñ(8Ó(:×(BÑ(BÔCØ×Ñ×#Ñ# D×$4Ñ$4Ó$6Ô7Ø×ÑÔØ×ÑÕøÜ	ò Ø×Ñ”qð 0ó 1Ø37×3FÑ3FñGô Häˆ‡8�8ûðús   ‚A<A? Á?	CÂ2B?Â?Cc                 ó4   — | j                   | j                     S ru   )r7   r"   r  s    r.   rE   zDrWindow.active_tool©  ó   € Ø	�‰�D×'Ñ'Ñ	(Ð(r/   c                 ó4   — | j                   | j                     S ru   )r7   ro   r  s    r.   rC  zDrWindow.former_tool¬  rU  r/   c                 ó¦   — | j                   | j                  k(  r| j                  «        y| j                  | j                      j	                  «        y)zTSwitch back to the previously active tool, if it's different from the
		current one.N)ro   r"   Úforce_selectionr7   rF   r˜   s     r.   rc  zDrWindow.back_to_previous¯  sA   € ð 
×Ñ˜D×/Ñ/Ò/Ø×ÑÕð ‡:�:ˆd×!Ñ!Ñ"×7Ñ7Õ9r/   c                 óÔ  — | j                  «       j                  «       }| j                  «       j                  «       }| j                  «       j                  «       }|€‹| j                  j                  «       j                  d«       t        j                  «       }|j                  |«       |j                  dd«       | j                  j                  «       j                  d|«       nT| j                  j                  «       j                  d«       | j                  j                  «       j                  d||«       | j                  j                  «       }|j                  |||«       y)a
  Build the active tool's option menus.
		The first menu is the popover from the bottom bar. It can be built from
		a Gio.MenuModel, or it can contain any widget.
		The second menu is build from a Gio.MenuModel and is in the menubar (not
		available with all layouts).Né   zwin.PLACEHOLDER)rE   Úget_options_widgetÚget_options_modelÚget_options_labelr    r  r+  r   ÚMenuItemr  Úset_action_and_target_valueÚinsert_itemÚinsert_submenur9   r  Úbuild_options_menu)r+   ÚwidgetÚmodelr]   r  Úpanes         r.   rR  zDrWindow._build_options_menu¸  s  € ð ×ÑÓ×0Ñ0Ó2€&Ø
×
Ñ
Ó
×
.Ñ
.Ó
0€%Ø
×
Ñ
Ó
×
.Ñ
.Ó
0€%Ø
€]Ø‡8�8×ÑÓ× Ñ  Ô#Ü
�,‰,‹.€4Ø‡>�>�%ÔØ×#Ñ#Ð$5°tÔ<Ø‡8�8×ÑÓ×%Ñ% a¨Õ.à‡8�8×ÑÓ× Ñ  Ô#Ø‡8�8×ÑÓ×(Ñ(¨¨E°5Ô9Ø	×	Ñ	×	-Ñ	-Ó	/€$Ø×Ñ˜& %¨Õ/r/   c                 óü   — |d   j                  «        }| j                  j                  d|«       |d   j                  t        j
                  j                  |«      «       | j                  j                  |«       y )Nr   ri  )	rð  r&   rù   rõ  r   r#  r$  r9   Úset_palette_setting)r+   ry   rj  s      r.   r£  zDrWindow.action_use_editorÍ  sa   € Ø˜‘7×$Ñ$Ó&Ð&€*Ø‡.�.×ÑÐ0°*Ô=Ø€q�'×Ñ”D—L‘L×,Ñ,¨ZÓ8Ô9Ø×Ñ×*Ñ*¨:Õ6r/   c                 óT   — | j                   j                  «       j                  «        y ru   )r9   Úget_classic_tools_paner  r˜   s     r.   r¢  zDrWindow.exchange_colorsÓ  s   € Ø×Ñ×-Ñ-Ó/×CÑCÕEr/   c                 óŠ   — | j                  «       j                  r)| j                  j                  «       j	                  «        y y ru   )rE   Ú	use_colorr9   Úleft_color_btnrO  r˜   s     r.   r   zDrWindow.action_color1Ö  s4   € Ø	×ÑÓ×!Ò!Ø×Ñ×&Ñ&Ó(×-Ñ-Õ/ð "r/   c                 óŠ   — | j                  «       j                  r)| j                  j                  «       j	                  «        y y ru   )rE   rk  r9   Úright_color_btnrO  r˜   s     r.   r¡  zDrWindow.action_color2Ú  s4   € Ø	×ÑÓ×!Ò!Ø×Ñ×'Ñ'Ó)×.Ñ.Õ0ð "r/   c                 ó:   — | j                   j                  d«       y rð   ©r9   Úupdate_tool_widthr˜   s     r.   r¤  zDrWindow.action_size_moreÞ  s   € Ø×Ñ×(Ñ(¨Õ+r/   c                 ó:   — | j                   j                  d«       y )NrÆ   rp  r˜   s     r.   r¥  zDrWindow.action_size_lessá  s   € Ø×Ñ×(Ñ(¨Õ,r/   c                 ó@   — | j                  «       j                  «        y)z‰Display the properties dialog for the current image. This could be
		done here but it's done in DrImage to have a satisfying UML diagram.N)r›   Úshow_propertiesr˜   s     r.   r{  zDrWindow.action_propertiesç  s   € ð ×ÑÓ×)Ñ)Õ+r/   c                 óü   — | j                    | _         | j                  j                  «       D ]  }|j                  «        Œ |d   j	                  t
        j                  j                  | j                   «      «       y)zqDevelopment only: tracks and displays the framerate, thus it helps
		debugging how Gdk/cairo draws on the widget.r   N)r%   r¥   rÖ   Úreset_fps_counterrõ  r   r#  r$  )r+   ry   Úimgs      r.   r©  zDrWindow.action_fspì  sd   € ð %)×$?Ñ$?Ð ?€$ÔØ�]‰]×'Ñ'Ó)ò €cØ×ÑÕðà€q�'×Ñ”D—L‘L×,Ñ,¨T×-HÑ-HÓIÕJr/   c                 ó˜   — | j                   €3| j                  j                  | j                  j                  «       «      S | j                   S ru   )r!   r¥   rè   r¦   r  s    r.   r›   zDrWindow.get_active_imageô  s<   € Ø	×!Ñ!Ð)Ø
�-‰-×
$Ñ
$ T§]¡]×%CÑ%CÓ%EÓ
FÐFà
×
&Ñ
&Ð&r/   c                 ó@   — | j                  «       j                  «        y ru   )r›   Úreset_to_initial_pixbufr˜   s     r.   ry  zDrWindow.action_resetú  s   € Ø×ÑÓ×1Ñ1Õ3r/   c                 ó@   — | j                  «       j                  «        y ru   )r›   Úreload_from_diskr˜   s     r.   rz  zDrWindow.action_reloadý  s   € Ø×ÑÓ×*Ñ*Õ,r/   c                 ó†  — | j                  «       }|€y|j                  «       j                  d«      d   }| j                  t	        d«      |z  «       | j                  «       j                  «       r| j                  |«       �n®| j                  j                  |j                  «       «      \  }}|�=| j                  |«      s,|j                  j                  |«       | j                  «        yt        | «      }|j                  t	        d«      dd«      }|j                  t	        d«      d«      }|j                  t	        d«      d	«      }	| j                  «       j!                  «       s9|j#                  t	        d
«      | j                  «       j%                  «       z  «       |j#                  t	        d«      |z  «       |j'                  «       }
|j)                  «        |
|k(  r| j+                  |d«       n:|
|	k(  r| j                  |d«       n"|
|k(  r| j                  j-                  |dd«       | j                  «        y)z÷Handle the result of an "open" file chooser dialog, and open it in
		the current tab, or in a new one, or in a new window. The decision is
		made depending on what's in the current tab, and (if any doubt)
		according to the user explicit decision.NrÅ   rÆ   z
Loading %szNew TabTz
New WindowzDiscard changeszdestructive-actionz&There are unsaved modifications to %s.zWhere do you want to open %s?F)Úfile_chooser_openr¯   rR   rC   r6   r›   Úshould_replaceÚ_try_load_filer    r®   r°   r¥   r±   re   r   rU   ré   rT   Úget_filename_for_displayrV   rW   r¶   Úopen_window_with_content)r+   ry   r1   Ú	file_namer´   rµ   r\   Ú
new_tab_idÚnew_window_idÚ
discard_idr`   s              r.   rŠ  zDrWindow.action_open   sé  € ð
 ×
 Ñ
 Ó
"€%Ø
€]Ø	à�~‰~Ó×%Ñ% cÓ*¨2Ñ.€9Ø×Ñ”q˜“¨Ñ2Ô3Ø	×ÑÓ×+Ñ+Ô-ð ×Ñ�uÖð —(‘(×+Ñ+¨E¯N©NÓ,<Ó=�<€1€iØÐ D×$;Ñ$;¸EÔ$BØ‡J�J×Ñ 	Ô*Ø×ÑÔØ
ä˜DÓ!€6Ø×!Ñ!¤! I£,°°dÓ;€:Ø×$Ñ$¤Q |£_°dÓ;€=Ø×!Ñ!¤!Ð$5Ó"6Ð8LÓM€:Ø
×
Ñ
Ó
!×
*Ñ
*Ô
,à
×Ñ”aÐ@ÓAØ×&Ñ&Ó(×AÑAÓCñDô Eð 
×Ñ”QÐ6Ó7¸)ÑCÔDØ�J‰J‹L€6Ø	‡>�>ÔØ�
ÒØ×Ñ˜U EÕ*Ø�*ÒØ×Ñ˜˜uÕ%Ø�-ÒØ‡H�H×%Ñ% e¨U°EÔ:Ø×ÑÕr/   c           	      óf  — d}t         j                  j                  t        d«      | t         j                  j
                  t        d«      t        d«      «      }t        |«       |j                  «       }|t         j                  j                  k(  r|j                  «       }|j                  «        |S )zBOpens an "open" file chooser dialog, and return a GioFile or None.NzOpen a pictureÚOpenÚCancel)r   ÚFileChooserNativer  r6   ÚFileChooserActionÚOPENr   rV   r‘   ÚACCEPTÚget_filerW   )r+   ry   r1   Úfile_chooserrý   s        r.   r~  zDrWindow.file_chooser_open,  sŒ   € à
€%Ü×&Ñ&×*Ñ*¬1Ð-=Ó+>ÀÜ×,Ñ,×1Ñ1´1°V³9¼aÀ»kóK€,ä# LÔ1Ø×ÑÓ€(Ø”×!Ñ!×(Ñ(Ò(Ø× Ñ Ó"€5Ø×ÑÔØ	€,r/   c                 ó„  — t        | «      }|j                  t        d«      d«      }	|j                  t        d«      d«      }
|j                  t        d«      dd«      }|j                  «       }g }|D ]U  }	 t        j
                  j                  |«      }t        |«      \  }}|r|j                  «       ŒE| j                  |«       ŒW t        |«      dk(  ryt        |«      dk(  r&|d   j                  «       j                  d	«      d
   }nt        d«      }|j                  t        d«      |z  «       |j!                  «       }|j#                  «        ||
k(  r|D ]  }| j%                  |¬«       Œ y||k(  r#| j'                  |d   j                  «       «       yy# t        $ r}d}|j                  }Y d}~�Œd}~ww xY w)zÿSignal callback: when files are dropped on `self.notebook`, a message
		dialog is shown, asking if the user prefers to open them (one new tab
		per image), or to import them (it will only import the first), or to
		cancel (if the user dropped mistakenly).r‰  Nrˆ  ÚImportTFr   r   rÅ   rÆ   zthese fileszWhat do you want to do with %s?r4   )r   rU   r6   Úget_urisr   ÚFileÚnew_for_urir   rB   rþ  rØ   rC   r'  r¯   rR   rT   rV   rW   r@   Úimport_from_path)r+   rc  Údrag_contextÚxÚyÚdataÚinfoÚtimer\   Ú	cancel_idÚopen_idÚ	import_idÚurisÚgfilesÚurir1   Úis_valid_imageÚ	error_msgrI   r]   r`   Úfs                         r.   r
  zDrWindow.on_data_dropped8  s£  € ô
 ˜4Ó €&Ø×Ñ¤ (£¨TÓ2€)Ø×Ñœa ›i¨Ó.€'Ø×Ñ¤ (£¨T°4Ó8€)à	�‰‹€$Ø€&Øò 
#€cðÜ�H‰H× Ñ  Ó%€EÜ 8¸Ó ?Ñ€N�Iñ Ø
‡M�M�%Õà×Ñ˜	Õ"ð
#ô 	ˆƒ[�AÒØ	Ü
ˆ6ƒ{�aÒØ�!‰9×ÑÓ×%Ñ% cÓ*¨2Ñ.�5ô ˆ]Ó€5ð 	×Ñ”AÐ7Ó8¸5Ñ@ÔAØ�:‰:‹<€&Ø‡.�.ÔàˆwÒØò !€qØ×Ñ˜aÐÕ ñ!à�ÒØ×Ñ˜ ™×+Ñ+Ó-Õ.ð øô3 ò Ø€NØ—‘†Iûðús   Á6-FÆ	F?Æ&F:Æ:F?c                 ó"  — |€y |r[| j                   j                  |j                  «       «      \  }}|�-| j                  |«      s|j                  j                  |«       y | j                  «       j                  |«       | j                  «        y ru   )	r    r®   r¯   r°   r¥   r±   r›   r¾   rŽ   r²   s        r.   r€  zDrWindow._try_load_filed  sv   € Ø
€]Ø	ÙØ—(‘(×+Ñ+¨E¯N©NÓ,<Ó=�<€1€iØ€m˜D×3Ñ3°EÔ:Ø‡J�J×Ñ 	Ô*Ø
à×ÑÓ×'Ñ'¨Ô.Ø×ÑÕr/   c                 ó¢   — | j                   j                  «       D ]2  }|j                  «       |k(  sŒ| j                   j                  |«      c S  y ru   )r¥   rÖ   Úget_file_pathr×   )r+   Ú	file_pathrì   s      r.   r®   zDrWindow.has_image_openedp  sI   € Ø�]‰]×'Ñ'Ó)ò '€cØ	×ÑÓ˜YÓ&Ø�=‰=×!Ñ! #Ó&Ò&ð'ð 
r/   c                 ó>   — | j                   j                  dddd«      S )zYTry to save the active image, and return True if the image has been
		successfully saved.FT©r:   Úsave_current_imager˜   s     r.   r�  zDrWindow.action_savev  s!   € ð 
×	Ñ	×	/Ñ	/°°u¸eÀTÓ	JÐJr/   c                 ó>   — | j                   j                  dddd«      S )NFTrª  r˜   s     r.   r�  zDrWindow.action_save_as{  s   € Ø	×	Ñ	×	/Ñ	/°°t¸UÀDÓ	IÐIr/   c                 ó>   — | j                   j                  dddd«      S ©NFrª  r˜   s     r.   rŽ  zDrWindow.action_save_alphaless~  s   € Ø	×	Ñ	×	/Ñ	/°°u¸eÀUÓ	KÐKr/   c                 ó>   — | j                   j                  dddd«      S )NTFrª  r˜   s     r.   r�  zDrWindow.action_export_as�  s   € Ø	×	Ñ	×	/Ñ	/°°d¸EÀ4Ó	HÐHr/   c                 ón   — | j                  «       j                  }| j                  j                  |«       y ru   )r›   Úmain_pixbufr;   Úprint_pixbufr«   s      r.   r’  zDrWindow.action_print„  s*   € Ø× Ñ Ó"×.Ñ.€&Ø×Ñ×$Ñ$ VÕ,r/   c                 óæ   — t         j                  j                  t        j                  «      }|j                  | j                  «       j                  «       | j                  t        d«      d«       y )NzImage copied to clipboardT)
r   r¡   r¢   r   r£   Ú	set_imager›   r±  rC   r6   )r+   ry   r§   s      r.   r‘  zDrWindow.action_export_cbˆ  sM   € Ü
‡}�}×Ñœ×0Ñ0Ó1€"Ø‡,�,ˆt×$Ñ$Ó&×2Ñ2Ô3Ø×Ñ”aÐ3Ó4°dÕ;r/   c                 óT   — | j                  «       j                  j                  «        y)z0Development only: helps debugging the selection.N)r›   r©   Úprint_valuesr˜   s     r.   r¨  zDrWindow.action_getvalues�  s   € à×ÑÓ×#Ñ#×0Ñ0Õ2r/   c                 ó`   — | j                  «        | j                  «       j                  «        y ru   )rX  Úget_selection_toolr\  r˜   s     r.   r•  zDrWindow.action_select_all”  s#   € Ø×ÑÔØ×ÑÓ×&Ñ&Õ(r/   c                 óB   — | j                  «       j                  d«       y r®  )r¸  rD  r˜   s     r.   r–  zDrWindow.action_unselect˜  s   € Ø×ÑÓ×-Ñ-¨eÕ4r/   c                 óD   — | j                  «        | j                  «        y ru   )Úcopy_operationr™  r˜   s     r.   r—  zDrWindow.action_cut›  s   € Ø×ÑÔØ×ÑÕr/   c                 ó$   — | j                  «        y ru   )r»  r˜   s     r.   r˜  zDrWindow.action_copyŸ  s   € Ø×ÑÕr/   c                 óÌ   — t         j                  j                  t        j                  «      }|j                  | j                  «       j                  j                  «       «       y ru   )	r   r¡   r¢   r   r£   r´  r›   r©   rª   )r+   r§   s     r.   r»  zDrWindow.copy_operation¢  s@   € Ü
‡}�}×Ñœ×0Ñ0Ó1€"Ø‡,�,ˆt×$Ñ$Ó&×0Ñ0×;Ñ;Ó=Õ>r/   c                 ó@   — | j                  «       j                  «        y ru   )r¸  Údelete_selectionr˜   s     r.   r™  zDrWindow.action_delete¦  ó   € Ø×ÑÓ×,Ñ,Õ.r/   c                 óD  — t         j                  j                  t        j                  «      }|j                  «       }|�0| j                  «        | j                  «       j                  |«       y|j                  «       }|�| j                  d   j                  |«       yy)a  By default, this action pastes an image, but if there is no image in
		the clipboard, it will paste text using the text tool. Once the text
		tool is active, this action is disabled to not interfere with the default
		behavior of ctrl+v provided by the GTK text entry.NÚtext)r   r¡   r¢   r   r£   r¤   rX  r¸  Úimport_selectionÚwait_for_textr7   Úforce_text_tool)r+   ry   r§   r    Ústrings        r.   r”  zDrWindow.action_paste©  s…   € ô
 ‡}�}×Ñœ×0Ñ0Ó1€"Ø×ÑÓ€&ØÐØ×ÑÔØ×ÑÓ×-Ñ-¨fÕ5à×ÑÓ€6ØÐØ‡J�JˆvÑ×&Ñ& vÕ.ð r/   c           	      ó~  — t         j                  j                  t        d«      | t         j                  j
                  t        d«      t        d«      «      }t        |«       |j                  «       }|t         j                  j                  k(  r| j                  |j                  «       «       |j                  «        y)zeHandle the result of an 'open' file chooser dialog. It will then try
		to import it as the selection.zImport a picturer‘  r‰  N)r   rŠ  r  r6   r‹  rŒ  r   rV   r‘   r�  r•  Úget_filenamerW   )r+   ry   r�  rý   s       r.   r“  zDrWindow.action_import¸  s�   € ô ×&Ñ&×*Ñ*¬1Ð-?Ó+@À$Ü×*Ñ*×/Ñ/´°8³¼aÀ»kóK€,ä# LÔ1Ø×ÑÓ€(Ø”×!Ñ!×(Ñ(Ò(Ø×Ñ˜×2Ñ2Ó4Ô5Ø×ÑÕr/   c                 ó    — | j                  «        t        j                  j                  |«      }| j	                  «       j                  |«       y)zyImport a file as the selection pixbuf. Called by the 'win.import'
		action or when an image is imported by drag-and-drop.N)rX  r   ÚPixbufÚnew_from_filer¸  rÃ  )r+   r¨  r    s      r.   r•  zDrWindow.import_from_pathÃ  s=   € ð ×ÑÔÜ×Ñ×)Ñ)¨)Ó4€&Ø×ÑÓ×,Ñ,¨VÕ4r/   c                 ó>   — | j                   j                  dddd«      S )NTrª  r˜   s     r.   rš  z DrWindow.action_selection_exportÊ  s   € Ø	×	Ñ	×	/Ñ	/°°d¸DÀ$Ó	GÐGr/   c                 ó@   — | j                  «       j                  «        y ru   )r¸  Úreplace_canvasr˜   s     r.   r›  z(DrWindow.action_selection_replace_canvasÍ  s   € Ø×ÑÓ×*Ñ*Õ,r/   c                 ód   — | j                   d   }|j                  «       }|j                  |«       y )NÚcrop)r7   Úbuild_selection_fit_operationÚapply_operation)r+   ry   Ú	crop_toolÚ	operations       r.   rœ  z'DrWindow.action_selection_expand_canvasÐ  s,   € Ø�j‰j˜Ñ €)Ø×5Ñ5Ó7€)Ø×Ñ˜IÕ&r/   c                 ó@   — | j                  «       j                  «        y ru   )r¸  Úinvert_selectionr˜   s     r.   Úaction_selection_invertz DrWindow.action_selection_invertÕ  rÀ  r/   c                 ó  — d| j                   v r| j                   d   S d| j                   v r| j                   d   S d| j                   v r| j                   d   S | j                  t        d«      «       | j                  «       S )NÚrect_selectÚfree_selectÚcolor_selectzRequired tool is not available)r7   r5   r6   rE   r  s    r.   r¸  zDrWindow.get_selection_toolØ  sv   € Ø�d—j‘jÑ Ø
�*‰*�]Ñ
#Ð#Ø˜Ÿ
™
Ñ"Ø
�*‰*�]Ñ
#Ð#Ø˜Ÿ™Ñ#Ø
�*‰*�^Ñ
$Ð$à×ÑœQÐ?Ó@ÔAØ
×
Ñ
Ó
Ðr/   c                 ó@   — | j                  «       j                  «        y ru   )r¸  rF   r  s    r.   rX  zDrWindow.force_selectionã  s   € Ø×ÑÓ×0Ñ0Õ2r/   c                 ó@   — | j                  «       j                  «        y ru   )rE   Ú!on_apply_transform_tool_operationr˜   s     r.   r�  zDrWindow.action_apply_transformæ  s   € Ø×ÑÓ×6Ñ6Õ8r/   c                 ó@   — | j                  «       j                  «        y ru   )rE   Ú"on_cancel_transform_tool_operationr˜   s     r.   rž  z DrWindow.action_cancel_transformé  s   € Ø×ÑÓ×7Ñ7Õ9r/   c                 ó@   — | j                  «       j                  «        y ru   )r›   Útry_undor˜   s     r.   r‹  zDrWindow.action_undoï  s   € à×ÑÓ×"Ñ"Õ$r/   c                 ó@   — | j                  «       j                  «        y ru   )r›   Útry_redor˜   s     r.   rŒ  zDrWindow.action_redoõ  s   € Ø×ÑÓ×"Ñ"Õ$r/   c                 ó|   — | j                  «       j                  «        | j                  «       j                  «        y)z4[Dev only] show the last saved pixbuf on the canvas.N)r›   Úuse_stable_pixbufrG  r˜   s     r.   r¦  zDrWindow.action_restoreø  s,   € à×ÑÓ×+Ñ+Ô-Ø×ÑÓ× Ñ Õ"r/   c                 óT   — | j                  «       j                  j                  «        y)z>[Dev only] rebuild the image according to the history content.N)r›   Ú_historyÚ_rebuild_from_historyr˜   s     r.   r§  zDrWindow.action_rebuildý  s   € à×ÑÓ×"Ñ"×8Ñ8Õ:r/   c                 óp   — | j                   j                  |«       | j                   j                  |«       y ru   )rö   Úset_undo_labelÚset_redo_label)r+   Ú
undo_labelÚ
redo_labels      r.   Úupdate_history_actions_labelsz&DrWindow.update_history_actions_labels  s*   € Ø×Ñ×"Ñ" :Ô.Ø×Ñ×"Ñ" :Õ.r/   c                 óF   — | j                  «       j                  ddd«       y )Nr   rÆ   rË   ©r›   Ú
add_deltasr˜   s     r.   r}  zDrWindow.action_go_up  s   € Ø×ÑÓ×$Ñ$ Q¨¨CÕ0r/   c                 óF   — | j                  «       j                  ddd«       y )Nr   r   rË   rñ  r˜   s     r.   r~  zDrWindow.action_go_down  ó   € Ø×ÑÓ×$Ñ$ Q¨¨3Õ/r/   c                 óF   — | j                  «       j                  ddd«       y )NrÆ   r   rË   rñ  r˜   s     r.   r  zDrWindow.action_go_left  s   € Ø×ÑÓ×$Ñ$ R¨¨CÕ0r/   c                 óF   — | j                  «       j                  ddd«       y )Nr   r   rË   rñ  r˜   s     r.   r€  zDrWindow.action_go_right  rô  r/   c                 óD   — | j                  «       j                  dd«       y )Nr   rÆ   ©r›   Úreset_deltasr˜   s     r.   r�  zDrWindow.action_go_top  s   € Ø×ÑÓ×&Ñ& q¨"Õ-r/   c                 óD   — | j                  «       j                  dd«       y rà   rø  r˜   s     r.   r‚  zDrWindow.action_go_bottom  ó   € Ø×ÑÓ×&Ñ& q¨!Õ,r/   c                 óD   — | j                  «       j                  dd«       y )NrÆ   r   rø  r˜   s     r.   rƒ  zDrWindow.action_go_first  s   € Ø×ÑÓ×&Ñ& r¨1Õ-r/   c                 óD   — | j                  «       j                  dd«       y rå   rø  r˜   s     r.   r„  zDrWindow.action_go_last  rû  r/   c                 ó0  — |d   j                  «        }|r5| j                  j                  «        | j                  j                  «        n| j                  j	                  «        |d   j                  t        j                  j                  |«      «       y)zAAction callback, showing or hiding the "minimap" preview popover.r   N)	rð  r8   ÚpopupÚupdate_contentÚpopdownrõ  r   r#  r$  )r+   ry   Úpreview_visibles      r.   rs  zDrWindow.action_toggle_preview   sk   € à˜Q™×)Ñ)Ó+Ð+€/ÙØ‡<�<×ÑÔØ‡<�<×ÑÕ à‡<�<×ÑÔØ€q�'×Ñ”D—L‘L×,Ñ,¨_Ó=Õ>r/   c                 óB   — | j                  «       j                  d«       y )Né   ©r›   Úinc_zoom_levelr˜   s     r.   r…  zDrWindow.action_zoom_in*  s   € Ø×ÑÓ×(Ñ(¨Õ,r/   c                 óB   — | j                  «       j                  d«       y )Niçÿÿÿr  r˜   s     r.   r†  zDrWindow.action_zoom_out-  ó   € Ø×ÑÓ×(Ñ(¨Õ-r/   c                 óB   — | j                  «       j                  d«       y )NrË   ©r›   Úset_zoom_levelr˜   s     r.   r‡  zDrWindow.action_zoom_1000  r  r/   c                 ó@   — | j                  «       j                  «        y ru   )r›   Úset_opti_zoom_levelr˜   s     r.   rˆ  zDrWindow.action_zoom_opti3  s   € Ø×ÑÓ×-Ñ-Õ/r/   c                 ó€   — | j                  «       j                  d«       | j                  «       j                  d«       y )NiÐ  r
  r˜   s     r.   r‰  zDrWindow.action_zoom_max6  s0   € Ø×ÑÓ×(Ñ(¨Ô.à×ÑÓ×(Ñ(¨Õ.r/   )Tru   )F)”Ú__name__Ú
__module__Ú__qualname__Ú__gtype_name__r   rø  r  r&   r   ÚTemplateÚChildrg   r  rþ   r  r  r¥   rì  r  r  r,  r*  r   rJ   rG   r=   ri   rv   rm   r   rA   r”   r?   r—   r�   r¬   r¶   r@   r°   rÐ   rÞ   rã   ræ   rî   rò   rô   rû   r>   r†   r  r'  r,  r<   r³  r   r  rŽ   r¹  rØ  r*   rp  rq  rÿ   rÁ   rt  r)   rd   r5   rC   r  re   r|  rx  rv  r  r!  r  r4  rk   ru  r  rŸ  rw   rI  rE   rC  rc  rR  r£  r¢  r   r¡  r¤  r¥  r{  r©  r›   ry  rz  rŠ  r~  r
  r€  r®   r�  r�  rŽ  r�  r’  r‘  r¨  r•  r–  r—  r˜  r»  r™  r”  r“  r•  rš  r›  rœ  r×  r¸  rX  r�  rž  r‹  rŒ  r¦  r§  rï  r}  r~  r  r€  r�  r‚  rƒ  r„  rs  r…  r†  r‡  rˆ  r‰  Ú__classcell__)r-   s   @r.   r   r   ,   s…  ø„ à€à�\‰\×ÑÐ<Ó=€ð —‘×#Ñ#Ó%€Ø�|‰|×!Ñ!Ó#€Ø�L‰L×ÑÓ €Ø�l‰l× Ñ Ó"€Ø�|‰|×!Ñ!Ó#€Ø�L‰L×ÑÓ €Ø—L‘L×&Ñ&Ó(ÐØ—L‘L×&Ñ&Ó(ÐØ—<‘<×%Ñ%Ó'€ØŸ™×*Ñ*Ó,ÐØŸ<™<×-Ñ-Ó/Ðôò(0òd)=òV òB#òò

'òòò	ò=òòò$%ó
#ð !%¨TØ ¨Ú';ó@ò*!ò&òGò4ò4ò
òòòò"#,òLð ?Aó Bòòòsòj	'òòSó
+ó+òò(/ò8"ò%ò
2ò$+ò
=ò
?ò òóòò ò:ò
@ò"!ò:ò@ò*ò9ò*Nò;ò
5ò
6ó&ò6
ò)ò)ò:ò0ò*7òFò0ò1ò,ò-ò,ò
Kò'ò4ò-ò*òX
ò*/óX
òòKò
JòLòIò-ò<ò3ò)ò5òòò?ò/ò/ò	ò5òHò-ò'ò
/ò	ò3ò9ò:ò%ò%ò#ò
;ò/ò1ò0ò1ò0ò.ò-ò.ò-ò?ò-ò.ò.ò0ö/r/   r   )#rÕ  Úgi.repositoryr   r   r   r   r   Úimager	   Únew_image_dialogr
   r8   r   r9   r   Úmessage_dialogr   Údeco_managerr   r   r   r:   r   r;   r   rr   r   Úutilities_filesr   r   ÚUI_PATHrn   r  ÚApplicationWindowr   r   r/   r.   ú<module>r     s{   ðó& 
ß 8Õ 8õ Ý 1Ý Ý -Ý +÷/ñ /õ ,Ý /Ý 1÷6ð .€Ø€ð €‡�˜G KÑ/Ô0ôL/ˆs×$Ñ$ó L/ó 1ñL/r/   