
RMXPc           @   s  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z y d  d l	 Z	 e
 Z Wn e Z n Xd Z e e j k o e j e d k Z d  d l Z d  d l Z d  d l Z d d
 d     YZ d d d     YZ d d d	     YZ d S(   iNt   XDG_CURRENT_DESKTOPt   Unityt	   InfoModelc           B   st   e  Z d  Z d   Z d   Z d   Z d   Z e d  Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z RS(   s   Holds the informationc         C   sj   t  j   |  _ t j t j t j t j t j	 t j t j  |  _
 t   |  _ t   |  _ t   |  _ d S(   s'   Sets up and populates the gtk.ListStoreN(   t   gconft   client_get_defaultt   gconf_clientt   gtkt	   ListStoret   gobjectt   TYPE_BOOLEANt
   TYPE_ULONGt   TYPE_STRINGt   TYPE_PYOBJECTt	   liststoret   sett   process_picklistt   process_blacklistt   process_whitelist(   t   self(    (    s   modules/core.pyt   __init__)   s    c         C   sj  |  j  j   g  } t j d t j t j  x1 t d t j j	  D] } | j
 t j |  qB Wd } t j d t j t j  t t j  t k r d } d GHn t j d } t j j   } xQ| D]I} t j |  r q n  t j d | t j  t t j  rt j d } n d GH| } |  j j t j t j  t j k rs| | k s t j t j t j |  rsq n  |  j j t j t j  t j k rt j |  rq n  t j d | t j  d	 }	 t t j  t k r4d
 GHt j d | t j  t t j  t k rd GHqFt  j! t j  }	 d |	 GHn t  j! t j  }	 |	 t j" k r[q n  t j# |  }
 |
 r|
 j$ d d t j j%  }
 n  t j d | t j  d } d } t t j  t k rd GHn t j d } t j& |  } t' |  d k r| d d k rq n  | t j( k r&q n  t j) |  r;q n  |  j* j+ |  | |  j, k r | j- t j j. |   } | d k rd } n d } | |  j0 k rt } n t1 } | d k r|  j  j2 | | |	 |
 t | g  n" |  j  j
 | | |	 |
 t | g  | d 7} q q W| d k rf|  j  j3   } x6 | d k rbt1 |  j  | d <|  j  j4 |  } q0Wn  d S(   s   Populates the gtk.ListStoret   _NET_CLIENT_LISTi    t   _NET_CURRENT_DESKTOPis1   DEBUG warning _NET_CURRENT_DESKTOP improperly sett   _NET_WM_DESKTOPs,   DEBUG warning _NET_WM_DESKTOP improperly sett   _NET_WM_NAMEs   ???s8   DEBUG warning _NET_WM_NAME improperly set by applicationt   WM_NAMEs,   DEBUG warning WM_NAME not set by applications   class i   t   _NET_WM_PIDt   UNKNOWNs.   DEBUG warning can't get PID _NET_WM_PID failedi   is   x-tilet   grayi   i   N(5   R   t   cleart   supportt   get_propertyt   globt   roott	   XA_WINDOWt   ranget	   num_itemst   valuet   appendt   ret_pointert   XA_CARDINALt   boolt   FalseR   t   gdkt   screen_get_defaultt   is_window_stickyR   t
   get_stringt   const   GCONF_ONLY_CURR_DESKt   screen_indext   STR_TRUEt   is_window_in_curr_viewportt   desktop_widtht   desktop_heightt   GCONF_NOT_MINIMIZEDt   is_window_hiddent   str_atomt	   str2_atomt   ctypest	   string_att   WINNAMES_BLACKLISTt   get_icont   scale_simplet   INTERP_BILINEARt   get_process_namet   lent   PROCESSES_BLACKLISTt   is_candidate_compiz_desktopR   t   addR   t   get_monitor_at_windowt   window_foreign_newt   NoneR   t   Truet   prependt   get_iter_firstt	   iter_next(   R   t	   appletobjt   clientst   it   rows_numt   curr_workspace_numt   screent   clientt   workspace_numt   titlet   pxbt   pidt   process_namet   win_curr_monitort   cell_backgroundt   flaggedt   iter(    (    s   modules/core.pyt
   load_model7   s      %(%  "    	 	 %"c         C   s   t  j d k rm t } |  j j   } xL | d k ri |  j | d t k rT t } Pn  |  j j |  } q' Wn t } |  j j   } xo | d k r | s t |  j | d <t |  j | d <n" t |  j | d <t |  j | d <|  j j |  } q Wd S(   s   Flags All Rowsi   i    i   N(   R   t   num_monitorsRG   R   RI   RF   R)   RJ   (   R   t   all_rows_flagged_on_monitor_1RZ   (    (    s   modules/core.pyt   flag_all_rows   s"    c         C   sZ   |  j  j   } xD | d k rU t |  j  | d <t |  j  | d <|  j  j |  } q Wd S(   s   Unflags All Rowsi    i   N(   R   RI   RF   R)   RJ   (   R   RZ   (    (    s   modules/core.pyt   unflag_all_rows   s
    c         C   s  g  g  g } | r g  } n  |  j  j   } xC| d k ro|  j  | d } |  j  | d t k ru | d j |  n+ |  j  | d t k r | d j |  n  | rZ|  j  | d s |  j  | d rZt j |  s t j |  r d } n d } t j |  } | j t	 |  t	 |  t	 | d  t	 | d  t	 | d  t	 | d  g  n  |  j  j
 |  } q- W| r| rt j |  j |  n  | S(   s'   Returns the list of the checked windowsi   i    i   i   i   N(   R   RI   RF   RG   R%   R   t   is_window_Vmaxt   is_window_Hmaxt   get_geomt   strRJ   t   undo_snap_writeR   (   R   t
   undo_readyt   checked_windows_listt   undo_snap_vect	   tree_itert   win_idt   is_maximizedt   win_geom(    (    s   modules/core.pyt   get_checked_windows_list   s2    	( 		c      	   C   s   |  j  j   } x | d k r |  j  j |  } |  j  | d t k s^ |  j  | d t k r t j |  j  | d d d d d d d  t j j	 t j
 t  |  j  j |  n  | } q Wd S(   s>   Closes the checked windows and removes the rows from the modeli    i   i   t   _NET_CLOSE_WINDOWN(   R   RI   RF   RJ   RG   R   t
   client_msgR   t   x11t   XSynct   dispR)   t   remove(   R   RZ   t	   next_iter(    (    s   modules/core.pyt   close_checked_windows   s    .*c         C   s5   |  j  |  } | d k r1 |  j j | |  n  d S(   s   Row up one positionN(   t   get_tree_iter_prev_siblingRF   R   t   swap(   R   RZ   t	   prev_iter(    (    s   modules/core.pyt   row_up   s     c         C   s8   |  j  j |  } | d k r4 |  j  j | |  n  d S(   s   Row down one positionN(   R   RJ   RF   Rv   (   R   RZ   t   subseq_iter(    (    s   modules/core.pyt   row_down   s     c         C   s   |  j  j |  d S(   s
   Row removeN(   R   Rr   (   R   RZ   (    (    s   modules/core.pyt
   row_delete   s    c         C   s   |  j  j |  } t |  d } d } xZ | d k r | | d k r t |  } | | c d 8<t |  } |  j  j |  } q+ W| S(   sH   Returns the previous sibling iter or None if the given iter is the firsti   i    N(   R   t   get_pathR@   RF   t   listt   tuplet   get_iter(   R   t	   node_itert	   node_patht   sibling_indexRw   t   node_path_listt	   prev_path(    (    s   modules/core.pyRu      s    c         C   s   |  j  S(   s   Returns the model(   R   (   R   (    (    s   modules/core.pyt	   get_model   s    (   t   __name__t
   __module__t   __doc__R   R[   R^   R_   R)   Rl   Rt   Rx   Rz   R{   Ru   R   (    (    (    s   modules/core.pyR   &   s   		K							t   GladeWidgetsWrapperc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s&   Handles the retrieval of glade widgetsc         C   sY   yF t  j   |  _ |  j j t j  |  j j |  |  j j |  Wn d GHn Xd  S(   Ns   Failed to load the glade file(   R   t   Buildert   glade_widgetst   set_translation_domainR.   t   APP_NAMEt   add_from_filet   connect_signals(   R   t   glade_file_patht   gui_instance(    (    s   modules/core.pyR      s     c         C   s   |  j  j |  S(   s;   Gives us the ability to do: wrapper['widget_name'].action()(   R   t
   get_object(   R   t   key(    (    s   modules/core.pyt   __getitem__   s    c         C   sB   |  j  j |  } | d k r. t d |  n  t |  | |  | S(   s8   Gives us the ability to do: wrapper.widget_name.action()s   Widget %r not foundN(   R   R   RF   t   AttributeErrort   setattr(   R   t   attrt
   new_widget(    (    s   modules/core.pyt   __getattr__   s
     (   R   R   R   R   R   R   (    (    (    s   modules/core.pyR      s   		t   XTilec           B   s  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 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z dc d  Z dc 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- d+   Z. d,   Z/ d-   Z0 d.   Z1 d/   Z2 d0   Z3 d1   Z4 d2   Z5 d3   Z6 d4   Z7 d5   Z8 d6   Z9 d7   Z: d8   Z; d9   Z< d:   Z= d;   Z> d<   Z? d=   Z@ d>   ZA d?   ZB d@   ZC dA   ZD dB   ZE dC   ZF dD   ZG dE   ZH dF   ZI dG   ZJ dH   ZK dI   ZL dJ   ZM dK   ZN dL   ZO dc dM  ZP dN   ZQ dc dO  ZR dc dP  ZS dQ   ZT dR   ZU dS   ZV dT   ZW dU   ZX dV   ZY dW   ZZ dX   Z[ dY   Z\ dZ   Z] d[   Z^ d\   Z_ d]   Z` d^   Za d_   Zb d`   Zc da   Zd db   Ze RS(d   s   The application's main windowc         C   sN  | |  _  t j   } xd t j D]Y } | d  } t j j t j |  } t j	 j
 |  } t j |  } | j | |  q W| j   y0 t j   } | j d t  | j d t  Wn n Xd t j d <t |  _ t t j d |   |  _ t j d  }	 |	 j t j |    t j   |  _ |  j j |	 d  |  j j j |  j j    |  j j t j   |  j j! j" |  j j# d	  t t  |  j j! j$ |  j j# d	  d  |  j j! j" |  j j# d
  t t  |  j j! j$ |  j j# d
  d  |  j j# d
  j% t j&  t j' | j(    |  _) |  j) j* t  t j+   |  _, |  j, j d t  |  j, j- d |  j. |  j  j/  t j+   |  _0 |  j0 j d t  |  j0 j- d |  j1 |  j  j/  t j2   |  _3 t j4   |  _5 d g d |  _7 t j8 d |  j, d d |  j7 d <|  j7 d j9 |  j, d d  t j8 d |  j0 d d |  j7 d <|  j7 d j9 |  j0 d d  t j8 d |  j3  |  j7 d <|  j7 d j: |  j3 |  j;  |  j7 d j9 |  j3 d d  t j8 d |  j5 d d |  j7 d <|  j7 d j9 |  j5 d d  x+ t< d  D] }
 |  j) j= |  j7 |
  qWt> j? d k  rN|  j7 d j@ t  n  |  j) jA t  |  j) jB tC d   |  j) j- d |  jD  t |  _E |  j) jF   |  _G |  j jH j |  j)  |  j jI j- d |  jJ  |  j jK jL t jM  |  j j jN |  j j jO   d t jM  tP jQ   |  _R |  jR jS d t> jT tP jU  |  jV   d S(   s   Instantiate the Glade Widgets Wrapper, create the view,
        retrieves and stores the information about the running desktop self.geometryis   gtk-button-imagess   gtk-menu-imagest   0t   UBUNTU_MENUPROXYs   x-tile.gladet   Actionsi    s   /MenuBars   /ToolBari   t   activatablet   toggledi   t   Tilet   actives   cell-backgroundi   t   Logoi   s   Window Descriptiont   texti   s"   Use Drag and Drop to Sort the Rowss   button-press-eventt   key_press_eventt    s   /apps/x-tile/%sN(W   t   storeR   t   IconFactoryR.   t   ICONS_FILENAMESt   ost   patht   joint
   GLADE_PATHR*   t   pixbuf_new_from_filet   IconSetRC   t   add_defaultt   settings_get_defaultt   set_propertyRG   t   environR)   t   cmd_line_onlyR   t   gladet   ActionGroupt   add_actionst   get_entriest	   UIManagert   uit   insert_action_groupt   windowt   add_accel_groupt   get_accel_groupt   add_ui_from_stringt   UI_INFOt	   vbox_maint
   pack_startt
   get_widgett   reorder_childt	   set_stylet   TOOLBAR_ICONSt   TreeViewR   t   viewt   set_headers_visiblet   CellRendererTogglet   renderer_checkboxt   connectt   toggle_activeR   t   renderer_checkbox2t   toggle_active2t   CellRendererPixbuft   renderer_pixbuft   CellRendererTextt   renderer_textRF   t   columnst   TreeViewColumnt   add_attributet   set_cell_data_funct   make_pixbufR"   t   append_columnR   R\   t   set_visiblet   set_reorderablet   set_tooltip_textt   _t   on_mouse_button_clicked_listt   no_toggling_signalst   get_selectiont   viewselectiont   scrolledwindowt   processadddialogt   on_key_press_processadddialogt   aboutdialogt   set_versiont   VERSIONt	   set_titlet	   get_titleR   R   R   t   add_dirR0   t   CLIENT_PRELOAD_NONEt   combobox_country_lang_init(   R   R   t   factoryt   filenamet
   stock_namet   filepatht   pixbuft   iconsett   gtk_settingst   actionst   n(    (    s   modules/core.pyR      s    	

 	%"%""""  	*c         C   s   |  j  j } t j t  |  _ | j |  j  t j   } | j | t	  | j
 | d d  x$ t j D] } |  j j | g  qg W| j |  j |  j j t j    |  j  j j d |  j  d S(   s2   Init The Programming Languages Syntax HighlightingR   i    t   changedN(   R   t   combobox_country_languageR   R   Rc   t   country_lang_liststoret	   set_modelR   R   RG   R   R.   t   AVAILABLE_LANGSR%   t   set_active_itert   get_combobox_country_lang_iterR   R-   t
   GCONF_LANGR   t$   on_combobox_country_language_changed(   R   t   comboboxt   cellt   country_lang(    (    s   modules/core.pyR   I  s    %c         C   s`   |  j  j   } xJ | d k rN |  j  | d | k r9 Pq |  j  j |  } q W|  j  j   S| S(   s1   Returns the Language iter Given the Language Namei    N(   R   RI   RF   RJ   (   R   t   country_languaget	   curr_iter(    (    s   modules/core.pyR   V  s     c         C   s   |  j  j j   } |  j | d } | |  j j t j  k r| | |  _ t	 j
 t d  |  j  j  |  j j t j |  n  d S(   s   New Country Language Choosedi    s?   The New Language will be Available Only After Restarting X TileN(   R   R   t   get_active_iterR   R   R-   R.   R   R   R   t   dialog_infoR   R   t
   set_string(   R   R   t   new_itert   new_lang(    (    s   modules/core.pyR   _  s    	c         C   s   |  j    r t j d d t j  |  _ |  j j t j  |  j j t j	  |  j j
 d  |  j j d  |  j j |  j j d   nK t j   |  _ |  j j d  |  j j d |  j  |  j j t d   d S(	   s   Creates the Stats Icons   x-tiles   indicator-messagess   indicator-messages-news	   tile-quads   /SysTrayMenus   button-press-events$   Tile the Windows Upon your X DesktopN(   t   use_appindicatort   appindicatort	   Indicatort   CATEGORY_APPLICATION_STATUSt   indt   set_icon_theme_pathR.   R   t
   set_statust   STATUS_ACTIVEt   set_attention_icont   set_icont   set_menuR   R   R   t
   StatusIcont   status_icont   set_from_stockR   t   on_mouse_button_clicked_systrayt   set_tooltipR   (   R   (    (    s   modules/core.pyt   status_icon_enableh  s    c         C   s]   | j  d k r |  j   n= | j  d k rY |  j j d  j d d d | j  | j  n  d S(   s6   Catches mouse buttons clicks upon the system tray iconi   i   s   /SysTrayMenuN(   t   buttont   toggle_show_hide_main_windowR   R   t   popupRF   t   time(   R   t   widgett   event(    (    s   modules/core.pyR  w  s      c         G   sG   |  j  r |  j   n- |  j   |  j j j   |  j   t |  _  d  S(   N(   t   win_on_screent   window_hidet   window_position_restoreR   R   t   showt   reload_windows_listRG   (   R   t   args(    (    s   modules/core.pyR  |  s    	 

c         C   s   |  j  j j   r. t } |  j  j j t  n t } | j   rc |  j j t j	 t
 j t j  n  |  j j t j	 t
 j t j  | r |  j  j j t  n  d S(   s!   Use AppIndicator Toggled HandlingN(   R   t   checkbutton_systray_dockingt
   get_activeRG   t
   set_activeR)   R   R  R.   t   GCONF_USE_APPINDR   R0   R1   t	   STR_FALSE(   R   t   checkbuttont   former_active(    (    s   modules/core.pyt!   on_checkbutton_use_appind_toggled  s    # c         C   s  | j    |  _ |  j r|  j   sY d t |   k rL |  j j d t  q |  j   n2 d t |   k r |  j j	 t
 j  n
 |  j   |  j j d  j d t  |  j j j t  |  j j t j t j  t j k r|  j j t j t j t j  qn |  j   sFd t |   k r0|  j   n  |  j j d t  n2 d t |   k re|  j   n  |  j j	 t
 j  |  j j d  j d t  |  j j j t  |  j j t j t j  t j k r|  j j t j t j t j  n  d S(   s   SysTray Toggled HandlingR  t   visibleR  s   /MenuBar/FileMenu/ExitAppN(   R&  t
   systray_onR  t   dirR  R   RG   R  R  R  R	  R  R   R   R   t   checkbutton_start_minimizedt   set_sensitiveR   R-   R.   t   GCONF_SYSTRAY_ENABLER   R0   R1   R  R)   t   STATUS_PASSIVER)  (   R   R*  (    (    s   modules/core.pyt&   on_checkbutton_systray_docking_toggled  s0    	  
%&  %c         C   s   | j    rW |  j j t j t j  t j k r |  j j t j t j t j  q nH |  j j t j t j  t j	 k r |  j j t j t j t j	  n  d S(   s+   Start Minimized on SysTray Toggled HandlingN(
   R&  R   R-   R.   t   GCONF_SYSTRAY_STARTR   R0   R1   R  R)  (   R   R*  (    (    s   modules/core.pyt&   on_checkbutton_start_minimized_toggled  s
    %&%c         C   s  | j    r d t _ n d t _ t j   t j d d t _ t j d d t _ t j d d t _ t j d d t _	 |  j
 j j t j  |  j
 j j t j  |  j
 j j t j  |  j
 j j t j	  |  j j t j t j t j  |  j
 j j t j d k  d S(   s$   Override Area 1 Checkbox was Toggledi   i    i   i   N(   R&  R.   t
   OVERRIDE_1R   t   read_monitors_areast   monitors_areast   X1t   Y1t   W1t   H1R   t   spinbutton_x1t	   set_valuet   spinbutton_y1t   spinbutton_w1t   spinbutton_h1R   t   set_intt   GCONF_OVERRIDE_1R0   t   vbox_override_area_1R1  (   R   R*  (    (    s   modules/core.pyt.   on_checkbutton_override_monitor_1_area_toggled  s     	
 c         C   s  | j    r d t _ n d t _ t j   t j d d t _ t j d d t _ t j d d t _ t j d d t _	 |  j
 j j t j  |  j
 j j t j  |  j
 j j t j  |  j
 j j t j	  |  j j t j t j t j  |  j
 j j t j d k  d S(   s$   Override Area 1 Checkbox was Toggledi   i    i   i   N(   R&  R.   t
   OVERRIDE_2R   R8  R9  t   X2t   Y2t   W2t   H2R   t   spinbutton_x2R?  t   spinbutton_y2t   spinbutton_w2t   spinbutton_h2R   RC  t   GCONF_OVERRIDE_2R0   t   vbox_override_area_2R1  (   R   R*  (    (    s   modules/core.pyt.   on_checkbutton_override_monitor_2_area_toggled  s     	
 c         C   sy	  t  j   |  j j j d t  j j  |  j j j d t  j j  g  |  _ |  j	 j
 t j t  j  } | r | j d  } x` | D]U } | j d  \ } } } } |  j j t |  t |  t |  t |  g  q Wn  g  |  _ |  j	 j
 t j t  j  } | r|| j d  } x` | D]U } | j d  \ } } } } |  j j t |  t |  t |  t |  g  q Wn  |  j	 j
 t j t  j  d k r|  j	 j t j t  j t j  n  |  j	 j
 t j t  j  d k r|  j	 j t j t  j t j  n  |  j	 j
 t j t  j  d k rK|  j	 j t j t  j t j  n  t st|  j	 j t j t  j t j  n) t s|  j	 j t j t  j t j  n  |  j	 j
 t j t  j  d k r|  j	 j t j t  j t j  n  |  j	 j
 t j t  j  d k r'|  j	 j t j t  j t j  n  |  j	 j
 t j t  j  t j k r~|  j   t  |  _! |  j" j# d  j d t   n% t$ |  _! |  j" j# d  j d t$  |  j j% j& |  j	 j
 t j t  j  t j k  |  j	 j' t j( t  j  d k rd t _) |  j	 j' t j* t  j  t _+ |  j	 j' t j, t  j  t _- |  j	 j' t j. t  j  t _/ |  j	 j' t j0 t  j  t _1 t j+ t j- t j/ t j1 g t  j2 d <nP t  j2 d d t _+ t  j2 d d t _- t  j2 d d	 t _/ t  j2 d d
 t _1 t  j3 d k r%|  j	 j' t j4 t  j  d k rd t _5 |  j	 j' t j6 t  j  t _7 |  j	 j' t j8 t  j  t _9 |  j	 j' t j: t  j  t _; |  j	 j' t j< t  j  t _= t j7 t j9 t j; t j= g t  j2 d <q%t  j2 d d t _7 t  j2 d d t _9 t  j2 d d	 t _; t  j2 d d
 t _= n  |  j	 j' t j> t  j  } | rS| t _? n  |  j	 j' t j@ t  j  }	 |	 r|	 t _A n  |  j	 j' t jB t  j  }
 |
 t jC k r|  j	 jD t jB t  j d
  n  |  j" j# d  j d t jC |  j	 j' t jB t  j   |  j	 j
 t jE t  j  } | d k rZx* | j   D] } |  jF jG jH |  q:Wn  |  j	 j
 t jI t  j  } | d k rx* | j   D] } |  jF jJ jH |  qWn  |  j jK j& t j) d k  |  j jL j& t j5 d k  |  j jM jN t j+  |  j jO jN t j-  |  j jP jN t j/  |  j jQ jN t j1  |  j jR jN t j7  |  j jS jN t j9  |  j jT jN t j;  |  j jU jN t j=  |  j jV jW t j) d k  |  j jX jW t j5 d k  |  j jL jW t  j3 d k  i  |  _Y |  j	 j' t jZ t  j  |  j	 j' t j[ t  j  g |  jY d <d |  jY d k ru	|  j j\ j] |  jY d d |  jY d d  n  d S(   s%   Init the geometry and the spinbuttonss   width-requests   height-requestR   t   ,s   /MenuBar/FileMenu/ExitAppR-  i   i    i   i   s   /ToolBars	   icon-sizet    t   win_sizeN(   NRT  (   NRT  (^   R   R8  R   t   drawingareaR   t   drawing_rectt   widtht   heightt   custom_geoms_1R   R-   R.   t   GCONF_CUSTOM_1R0   t   splitR%   t   intt   custom_geoms_2t   GCONF_CUSTOM_2t   GCONF_EXIT_AFTER_TILERF   R  R1   R5   R)  R/   t   HAS_SYSTRAYR(  t   HAS_APPINDICATORR2  R5  R  RG   R.  R   R   R)   t   exit_after_tile_checkbuttonR'  t   get_intRD  R7  t   GCONF_X1R:  t   GCONF_Y1R;  t   GCONF_W1R<  t   GCONF_H1R=  R9  R\   RP  RG  t   GCONF_X2RH  t   GCONF_Y2RI  t   GCONF_W2RJ  t   GCONF_H2RK  t   GCONF_GRID_ROWSt	   GRID_ROWSt   GCONF_GRID_COLSt	   GRID_COLSt   GCONF_TOOLBAR_ICON_SIZEt
   ICONS_SIZERC  t   GCONF_PROCESS_BLACKLISTR   R   RC   t   GCONF_PROCESS_WHITELISTR   t#   checkbutton_override_monitor_1_areat#   checkbutton_override_monitor_2_areaR>  R?  R@  RA  RB  RL  RM  RN  RO  RE  R1  RQ  t   win_size_n_post   GCONF_WIN_SIZE_Wt   GCONF_WIN_SIZE_HR   t   resize(   R   t   custom_geoms_strt   custom_geoms_vect   custom_geomt   xt   yRX  RY  t	   grid_rowst	   grid_colsR   t	   blacklistt   elementt	   whitelist(    (    s   modules/core.pyt   init_from_gconf  s    
	;	;"#"#"# # #"#"#%
		2"	("	(    $	&c         C   so   |  j  j t j t j  |  j  j t j t j  g |  j d <|  j j	 j
 |  j d d |  j d d  d S(   s    Restore window size and positiont   win_positioni    i   N(   R   Rd  R.   t   GCONF_WIN_POSITION_XR   R0   t   GCONF_WIN_POSITION_YRw  R   R   t   move(   R   (    (    s   modules/core.pyR!  A  s    &c         G   s   |  j  j t j t j  } | d k rH t j t d  |  j	 j
  d S| d 7} |  j  j t j t j |  |  j j d  j d t j |  d S(   s&   Increase the Size of the Toolbar Iconsi   s=   The Size of the Toolbar Icons is already at the Maximum ValueNi   s   /ToolBars	   icon-size(   R   Rd  R.   Rq  R   R0   R   R  R   R   R   RC  R   R   R   Rr  (   R   R$  t   toolbar_icon_size(    (    s   modules/core.pyt   toolbar_icons_size_increaseG  s    
c         G   s   |  j  j t j t j  } | d k rH t j t d  |  j	 j
  d S| d 8} |  j  j t j t j |  |  j j d  j d t j |  d S(   s&   Decrease the Size of the Toolbar Iconsi   s=   The Size of the Toolbar Icons is already at the Minimum ValueNs   /ToolBars	   icon-size(   R   Rd  R.   Rq  R   R0   R   R  R   R   R   RC  R   R   R   Rr  (   R   R$  R  (    (    s   modules/core.pyt   toolbar_icons_size_decreaseQ  s    
c         C   s)   | | d | | d <t  | | d <d S(   s   Toggles the Active statei    i   N(   R)   (   R   R   R   t   model(    (    s   modules/core.pyR   [  s    c         C   s)   | | d | | d <t  | | d <d S(   s   Toggles the Active statei   i    N(   R)   (   R   R   R   R  (    (    s   modules/core.pyR   `  s    c         G   sx   |  j  st |  j j t j t j  t j k rQ |  j j t j t j t j	  qt |  j j t j t j t j  n  d S(   s    Toggles the flag Exit After TileN(
   R   R   R-   R.   R`  R   R0   R1   R  R)  (   R   R$  (    (    s   modules/core.pyt   toggle_exit_after_tilee  s    	%#c         G   s   |  j  s |  j j t j t j  t j k rQ |  j j t j t j t j	  n  |  j j t j t j t j  |  j
 j |   n  d S(   s6   Toggles the flag Do Not List Minimized Windows in ListN(   R   R   R-   R.   R5   R   R0   R1   R  R)  R   R[   (   R   R$  (    (    s   modules/core.pyt   toggle_do_not_list_minimizedl  s
    	%# c         G   s   |  j  s |  j j t j t j  t j k rQ |  j j t j t j t j	  n  |  j j t j t j t j  |  j
 j |   n  d S(   s7   Toggles the flag Only Current Workspace Windows in ListN(   R   R   R-   R.   R/   R   R0   R1   R  R)  R   R[   (   R   R$  (    (    s   modules/core.pyt   toggle_only_curr_workspacet  s
    	%# c         C   s   |  j  j j d  S(   s6   Returns True if the window is visible, False otherwiseR-  (   R   R   R   (   R   (    (    s   modules/core.pyt   is_window_visible|  s    c         G   s   |  j  j   d S(   s   Flags All RowsN(   R   R^   (   R   R$  (    (    s   modules/core.pyR^     s    c         G   s   |  j  j   d S(   s   Unflags All RowsN(   R   R_   (   R   R$  (    (    s   modules/core.pyR_     s    c         C   s"   | | d } | j  d |  d S(   s5   Function to associate the pixbuf to the cell rendereri   R   N(   R   (   R   t   treeviewcolumnR   R  RZ   R   (    (    s   modules/core.pyR     s    c         C   s   |  j    t S(   s.   Before close the application: no checks needed(   t   quit_applicationRG   (   R   R  R  t   data(    (    s   modules/core.pyt   on_window_delete_event  s    
c         C   s   |  j    t S(   s   Destroy the config window(   t!   on_configwin_close_button_clickedRG   (   R   R  R  R  (    (    s   modules/core.pyt   on_configwindow_delete_event  s    
c         G   s  |  j  j j d  t k r d St |  _ |  j  j j |  j j t	 j
 t j  t	 j k  |  j  j j |  j j t	 j t j  t	 j k  |  j  j j |  j j t	 j t j  t	 j k  |  j  j j |  j j t	 j t j  t	 j k  |  j  j j |  j j t	 j t j  t	 j k  t s0t rF|  j  j j t  n  |  j  j j |  j j t	 j t j  t	 j k  t |  _ |  j  j j   d S(   s   Open the Config WindowR-  N(   R   t   configwindowR   RG   R   t   current_workspace_checkbuttonR'  R   R-   R.   R/   R   R0   R1   t!   do_not_list_minimized_checkbuttonR5   R%  R2  R0  R5  t   checkbutton_use_appindR(  Rb  Ra  R1  R)   t   show_toolbar_checkbuttont   GCONF_SHOW_TOOLBARt   show_all(   R   R$  (    (    s   modules/core.pyt   dialog_preferences  s     	222222	c         G   sl  |  j  j j   t |  j  j j    t _ t |  j  j j    t _	 t |  j  j
 j    t _ t |  j  j j    t _ t j d k r3t j t j	 t j t j g t j d <|  j j t j t j t j  |  j j t j t j t j	  |  j j t j t j t j  |  j j t j t j t j  n  t j d k rht |  j  j j    t _ t |  j  j j    t _ t |  j  j j    t _ t |  j  j j    t _  t j! d k rht j t j t j t j  g t j d <|  j j t j" t j t j  |  j j t j# t j t j  |  j j t j$ t j t j  |  j j t j% t j t j   qhn  d S(   s   Hide the Dialogi   i    N(&   R   R  t   hideR]  R>  t	   get_valueR.   R:  R@  R;  RA  R<  RB  R=  R7  R   R9  R   RC  Re  R0   Rf  Rg  Rh  R\   RL  RH  RM  RI  RN  RJ  RO  RK  RG  Ri  Rj  Rk  Rl  (   R   R$  (    (    s   modules/core.pyR    s,    %   #%   c         G   sU   |  j  j   \ } } | d k rA t j t d  |  j j  d S|  j j	 |  d S(   s(   Move the selected row up of one positions   No Row is SelectedN(
   R   t   get_selectedRF   R   t   dialog_warningR   R   R   R   Rx   (   R   R$  R  RZ   (    (    s   modules/core.pyt   on_button_row_up_clicked  s
    c         G   sU   |  j  j   \ } } | d k rA t j t d  |  j j  d S|  j j	 |  d S(   s(   Move the selected row up of one positions   No Row is SelectedN(
   R   R  RF   R   R  R   R   R   R   Rz   (   R   R$  R  RZ   (    (    s   modules/core.pyt   on_button_row_down_clicked  s
    c         G   sU   |  j  j   \ } } | d k rA t j t d  |  j j  d S|  j j	 |  d S(   s   Remove the selected rows   No Row is SelectedN(
   R   R  RF   R   R  R   R   R   R   R{   (   R   R$  R  RZ   (    (    s   modules/core.pyt   on_button_row_delete_clicked  s
    c         G   s   |  j    |  j j   x' |  j j D] } |  j j | g  q$ W|  j j j   } |  j j j	   | d k rs d S|  j
 j   \ } } | d k r d S|  j j j | | d  |  j   d S(   s   Application Filter Addi   Ni    (   t    process_add_list_exist_or_createt   process_add_liststoreR   R   R   R%   R   R   t   runR  t   process_add_treeviewselectionR  RF   R   RC   t   filter_list_update(   R   R$  R  t   responseR  RZ   (    (    s   modules/core.pyt   on_button_add_filter_clicked  s    
  c         G   sj   |  j  j   \ } } | d k rA t j t d  |  j j  d S|  j j	 j
 | | d  |  j   d S(   s   Application Filter Removes   No Application Selected!Ni    (   t   filter_treeviewselectionR  RF   R   R  R   R   R   R   R   Rr   R  (   R   R$  R  RZ   (    (    s   modules/core.pyt   on_button_remove_filter_clicked  s    c         C   s   |  j    |  j   |  j j j   |  j j j   t |  j j  d k r{ |  j	 j
 t j t j d j |  j j   n |  j	 j
 t j t j d  |  j   d S(   s   Application's Filter Dialogi    R   RT  N(   t   filter_list_exist_or_createR  R   t   filterdialogR  R  R@   R   R   R   R  R.   Rs  R   R0   R   R#  (   R   t   action(    (    s   modules/core.pyt   dialog_filter  s    

/c         G   s   |  j    |  j j   x' |  j j D] } |  j j | g  q$ W|  j j j   } |  j j j	   | d k rs d S|  j
 j   \ } } | d k r d S|  j j j | | d  |  j   d S(   s   Application Whitelist Addi   Ni    (   R  R  R   R   R   R%   R   R   R  R  R  R  RF   R   RC   t   white_list_update(   R   R$  R  R  R  RZ   (    (    s   modules/core.pyt   on_button_add_white_clicked  s    
  c         G   sj   |  j  j   \ } } | d k rA t j t d  |  j j  d S|  j j	 j
 | | d  |  j   d S(   s   Application Whitelist Removes   No Application Selected!Ni    (   t   white_treeviewselectionR  RF   R   R  R   R   R   R   R   Rr   R  (   R   R$  R  RZ   (    (    s   modules/core.pyt   on_button_remove_white_clicked  s    c         C   s   |  j    |  j   |  j j j   |  j j j   t |  j j  d k r{ |  j	 j
 t j t j d j |  j j   n |  j	 j
 t j t j d  |  j   d S(   s;   Dialog to select a list of windows to be flagged by Defaulti    R   RT  N(   t   white_list_exist_or_createR  R   t   whitedialogR  R  R@   R   R   R   R  R.   Rt  R   R0   R   R#  (   R   R  (    (    s   modules/core.pyt   dialog_selected_by_default  s    

/c         C   s;   |  j  j   x' |  j j D] } |  j  j | g  q Wd S(   s   Updates the Process Filter ListN(   t   filter_liststoreR   R   R   R%   (   R   R  (    (    s   modules/core.pyR    s    c         C   s;   |  j  j   x' |  j j D] } |  j  j | g  q Wd S(   s   Updates the Process White ListN(   t   white_liststoreR   R   R   R%   (   R   R  (    (    s   modules/core.pyR  !  s    c         C   s   d t  |   k r t j t  |  _ t j |  j  |  _ |  j j t  t j	   |  _
 t j d |  j
 d d |  _ |  j j |  j  |  j j   |  _ |  j j j |  j  |  j j j   n  d S(   s/   If The List Was Never Used, this will Create ItR  t   ApplicationR   i    N(   R/  R   R   Rc   R  R   t   filter_treeviewR   R)   R   t   filter_renderer_textR   t   filter_columnR   R   R  R   t   scrolledwindow_filterRC   R  (   R   (    (    s   modules/core.pyR  '  s    c         C   s   d t  |   k r t j t  |  _ t j |  j  |  _ |  j j t  t j	   |  _
 t j d |  j
 d d |  _ |  j j |  j  |  j j   |  _ |  j j j |  j  |  j j j   n  d S(   s/   If The List Was Never Used, this will Create ItR  R  R   i    N(   R/  R   R   Rc   R  R   t   white_treeviewR   R)   R   t   white_renderer_textR   t   white_columnR   R   R  R   t   scrolledwindow_whiteRC   R  (   R   (    (    s   modules/core.pyR  4  s    c         C   s   d t  |   k r t j t  |  _ t j |  j  |  _ |  j j t  t j	   |  _
 t j d |  j
 d d |  _ |  j j |  j  |  j j   |  _ |  j j d |  j  |  j j j |  j  |  j j j   n  d S(   s/   If The List Was Never Used, this will Create ItR  R  R   i    s   button-press-eventN(   R/  R   R   Rc   R  R   t   process_add_treeviewR   R)   R   t   process_add_renderer_textR   t   process_add_columnR   R   R  R   t#   on_mouse_button_clicked_process_addR   t   scrolledwindow_process_addRC   R  (   R   (    (    s   modules/core.pyR  A  s    c         C   s?   | j  d k r d S| j t j j k r; |  j j j   n  d S(   s   Catches mouse buttons clicksi   N(   R  t   typeR   R*   t   _2BUTTON_PRESSR   t   processadddialog_button_okt   clicked(   R   R  R  (    (    s   modules/core.pyR  O  s      c         C   s8   t  j j | j  } | d k r4 |  j j j   n  d S(   s'   Catches AnchorHandle Dialog key pressest   ReturnN(   R   R*   t   keyval_namet   keyvalR   R  R  (   R   R  R  t   keyname(    (    s   modules/core.pyR   T  s     c            s6  t  j d t d  d |  j j d t  j t  j Bd t  j t  j t  j	 t  j
 f      j t  j    j   } t  j   } t  j t d   } t  j   } | j   } | j t j d d d d	 d	  | j |  | j |  t  j   } t  j t d
   } t  j   }	 |	 j   }
 |
 j t j d d d d	 d	  | j |  | j |	  | j |  | j |    f d   }   j d |    j     j   } t | j    t _ t |	 j    t _   j   | t  j
 k rd S|  j j t j t  j! t j  |  j j t j" t  j! t j  |  j#   d S(   s   Open the Grid DialogRS   s   Grid Detailst   parentt   flagst   buttonst   Rowsi   id   i    t   Columnsc            sH   t  j j | j  d k rD   j   } | j   } | d j   n  d  S(   NR  i    (   R   R*   R  R  t   get_action_areat   get_childrenR  (   R  R  t
   button_boxR  (   t   dialog(    s   modules/core.pyt"   on_key_press_enter_password_dialogr  s    R   N($   R   t   DialogR   R   R   t   DIALOG_MODALt   DIALOG_DESTROY_WITH_PARENTt   STOCK_CANCELt   RESPONSE_REJECTt   STOCK_OKt   RESPONSE_ACCEPTt   set_positiont   WIN_POS_CENTER_ON_PARENTt   get_content_areat   HBoxt   Labelt
   SpinButtont   get_adjustmentt   set_allR.   Rn  R   Rp  R   R  R  R]  R  t   destroyR   RC  Rm  R   R0   Ro  t	   tile_grid(   R   R$  t   content_areat	   hbox_rowst
   label_rowst   spinbutton_rowst   adj_rowst	   hbox_colst
   label_colst   spinbutton_colst   adj_colsR  R  (    (   R  s   modules/core.pyt   dialog_gridY  sF    

   c         C   s#   |  j  j t j t j  t j k S(   s   Will we use AppIndicator?(   R   R-   R.   R(  R   R0   R1   (   R   (    (    s   modules/core.pyR    s    c         G   sZ   |  j    r2 d t |   k r2 |  j j t  n  |  j   |  j j j   t	 j
   d S(   s   The process is Shut DownR  N(   R  R/  R  R   R)   t   save_win_pos_n_sizeR   R   R  R   t	   main_quit(   R   R$  (    (    s   modules/core.pyt   quit_application_totally  s
    
c         C   s  t  |  j j j    } t  |  j j j    } | |  j d k r | |  j d <|  j j t j	 t
 j |  j d d  |  j j t j t
 j |  j d d  n  | |  j d k r| |  j d <|  j j t j t
 j |  j d d  |  j j t j t
 j |  j d d  n  d S(   s   Destroy the windowRU  i    i   R  N(   R}   R   R   t   get_sizet   get_positionRw  R   RC  R.   Rx  R   R0   Ry  R  R  (   R   t   actual_win_sizet   actual_win_pos(    (    s   modules/core.pyR    s    (+(c         C   s'   |  j    |  j j j   t |  _ d S(   s   Hide the WindowN(   R  R   R   R  R)   R  (   R   (    (    s   modules/core.pyR     s    
c         G   s$   |  j  s |  j   n
 |  j   d S(   s   Hide the windowN(   R.  R  R   (   R   R$  (    (    s   modules/core.pyR    s    	 c         C   sh  |  j    |  j   |  j j j   t j rc |  j j j t	  |  j j j
   |  j j j
   n  |  j j t j t j  } | d k r |  j j t j t j t j  n( | t j k r |  j j d  j
   n  t |  _ |  j j t j t j  t j k r#|  j j d  j d t	  nA |  j j t j t j  t j k rd|  j j j
   t	 |  _ n  d S(   s*   Show the main window and all child widgetss   /ToolBars   /MenuBar/FileMenu/ExitAppR-  N(   R  R!  R   R   R  R   t   is_compiz_runningt   checkbutton_dest_workspaceR'  R)   R  t   spinbutton_dest_workspaceR   R-   R.   R  R0   RF   R  R1   R)  R   R   RG   R  R2  R   R5  (   R   t   show_toolbar(    (    s   modules/core.pyt   launch_application  s$    

	 # 	%%c         G   s   |  j  j |   d S(   s   Reloads the Windows ListN(   R   R[   (   R   R$  (    (    s   modules/core.pyR#    s    c         G   sQ   t  |  j j    } | d k  r@ t j t d  |  j j  n |  j j   d S(   s   Closes the Checked Windowsi   s   No Windows CheckedN(	   R@   R   Rl   R   R  R   R   R   Rt   (   R   R$  t   number_of_windows(    (    s   modules/core.pyRt     s     c         G   s   |  j  j t  } | d | d } t |  } | d k  r[ t j t d  |  j j  n( x | D] } t j	 |  qb W|  j
   d S(   s   Maximizes the Checked Windowsi    i   s   No Windows CheckedN(   R   Rl   RG   R@   R   R  R   R   R   t   maximizet   check_exit_after_tile(   R   R$  t   checked_windows_listsRf   R  t   checked_window(    (    s   modules/core.pyt   maximize_checked_windows  s      c         G   s   |  j  j t  } | d | d } t |  } | d k  r[ t j t d  |  j j  n( x | D] } t j	 |  qb W|  j
   d S(   s   Unmaximizes the Checked Windowsi    i   s   No Windows CheckedN(   R   Rl   RG   R@   R   R  R   R   R   t
   unmaximizeR  (   R   R$  R  Rf   R  R  (    (    s   modules/core.pyt   unmaximize_checked_windows  s      c         G   sY   |  j  j t j t j d  |  j j t  } t	 j
 | t j |  j    |  j   d S(   s#   Tile the Checked Windows Verticallyt   vN(   R   R  R.   t   GCONF_LATEST_TILINGR   R0   R   Rl   RG   t   tilingst   tile_verticallyR9  t   get_dest_wsR  (   R   R$  Rf   (    (    s   modules/core.pyR    s    c         G   sY   |  j  j t j t j d  |  j j t  } t	 j
 | t j |  j    |  j   d S(   s%   Tile the Checked Windows Horizontallyt   hN(   R   R  R.   R  R   R0   R   Rl   RG   R  t   tile_horizontallyR9  R  R  (   R   R$  Rf   (    (    s   modules/core.pyR    s    c         G   sY   |  j  j t j t j d  |  j j t  } t	 j
 | t j |  j    |  j   d S(   s   Tile the Checked Windows Quadt   qN(   R   R  R.   R  R   R0   R   Rl   RG   R  t	   tile_quadR9  R  R  (   R   R$  Rf   (    (    s   modules/core.pyR    s    c         C   se   |  j  j t j t j d  |  j j t  } t	 j
 t j t j | t j |  j    |  j   d S(   s/   Tile the Checked Windows in a rows by cols gridt   gN(   R   R  R.   R  R   R0   R   Rl   RG   R  R  Rn  Rp  R9  R  R  (   R   Rf   (    (    s   modules/core.pyR    s    c         G   s   d |  _  |  j j j t d  d  |  j j j   } |  j j j   | d k rX d Sd } x; |  j D]0 } | d | d | d | d | d	 f 7} qh W| d k r | d } n  |  j j	 t
 j t j |  d S(
   s.   The User Wants to Set/Update the Custom Tilingi   s   Edit Custom Tile Settingss    1NRT  s    %s,%s,%s,%si    i   i   (   t   last_customR   t   customsetdialogR   R   R  R  RZ  R   R  R.   R[  R   R0   (   R   R$  R  R{  Rk   (    (    s   modules/core.pyt   tile_custom_1_set  s    	 . c         G   s   d |  _  |  j j j t d  d  |  j j j   } |  j j j   | d k rX d Sd } x; |  j D]0 } | d | d | d | d | d	 f 7} qh W| d k r | d } n  |  j j	 t
 j t j |  d S(
   s.   The User Wants to Set/Update the Custom Tilingi   s   Edit Custom Tile Settingss    2i   NRT  s    %s,%s,%s,%si    i   (   R  R   R  R   R   R  R  R^  R   R  R.   R_  R   R0   (   R   R$  R  R{  Rk   (    (    s   modules/core.pyt   tile_custom_2_set  s    	 . c         C   s`   |  j  d k r. |  j r\ |  j |  j  q\ n. |  j  d k r\ |  j r\ |  j |  j  q\ n  d S(   s   Drawing Area was Exposedi   i   N(   R  RZ  t   custom_geoms_drawR^  (   R   R  R  (    (    s   modules/core.pyt   on_drawingarea_expose_event  s    	 	 c         C   sA   | j  d k r= |  j j d  j d d d | j  | j  n  d S(   s   Catches mouse buttons clicksi   s	   /ListMenuN(   R  R   R   R  RF   R  (   R   R  R  (    (    s   modules/core.pyR     s    c         C   s  |  j  j   } |  j d k r g  |  _ xU | d | d D]A } t j |  } |  j j | d | d | d | d g  q: W|  j |  j  n |  j d k rg  |  _ xU | d | d D]A } t j |  } |  j j | d | d | d | d g  q W|  j |  j  n  d S(   s3   Let's Get Positions and Size of the Flagged Windowsi   i    i   i   N(	   R   Rl   R  RZ  R   Rb   R%   R  R^  (   R   R  Rf   Ri   Rk   (    (    s   modules/core.pyt&   on_button_update_custom_tiling_clicked  s    	0	0c         C   sK  |  j  j j j   } d } x)t |  D]\ } } | j t j |   | j | d t j	 | d t j	 | d t j	 | d t j	  | j
   | j d d d  | j d  | j | d t j	 | d d t j	 | d t j	 | d d t j	  | j t | d   | d t t j  k  r=| d 7} q( d } q( Wd S(   s   Draw Custom Geometriesi    i   i   i   i   N(   R   RV  R   t   cairo_createt	   enumeratet   set_source_rgbR.   t	   DRAW_RGBSt	   rectanglet
   DRAW_SCALEt   fillt   set_font_sizet   move_tot	   show_textRc   R@   (   R   t   custom_geomst   crt   rgb_idxRM   Rk   (    (    s   modules/core.pyR  -  s    " 
'% c         C   s0   |  j  j j   r, t |  j  j j   d  Sd S(   s   Get Destination Desktopi   i(   R   R   R&  R]  R  R  (   R   (    (    s   modules/core.pyR  >  s    c      	   G   s  g  } |  j  j t j t j  } | s, d S| j d  } g  } x_ | D]W } | j d  \ } } }	 }
 } } t j t	 |   } | j
 i | d 6| d 6 qH Wg  } xE t |  D]7 \ } } | j
 i | d d 6| d | d d 6 q Wx | D] } | j
 t j t	 | d    t j t	 | d  t	 | d d  t	 | d d  t	 | d d	  t	 | d d
  |  j    q W| rt j |  j  |  n  |  j   d S(   s/   Invert the order of the latest tiling operationNR   RS  Ri   Rk   ii    i   i   i   (   R   R-   R.   t
   GCONF_UNDOR   R0   R\  R   Rb   R]  R%   R  t   get_undo_element_from_win_idt
   moveresizeR  Rd   R  (   R   R$  t   latest_tiling_geomst   undo_snap_strRg   t   doubleundo_snap_vecR  Ri   Rj   R~  R  RX  RY  Rk   t   next_tiling_geomsRM   (    (    s   modules/core.pyt   invert_tilingD  s2     ! c      	   G   s  g  } |  j  j t j t j  } | s, d S| j d  } g  } x_ | D]W } | j d  \ } } }	 }
 } } t j t	 |   } | j
 i | d 6| d 6 qH Wg  } xO t |  D]A \ } } | j
 i | d d 6| | d t |  d d 6 q Wx | D] } | j
 t j t	 | d    t j t	 | d  t	 | d d  t	 | d d  t	 | d d  t	 | d d	  |  j    qW| rt j |  j  |  n  |  j   d S(
   s.   Cycle the order of the latest tiling operationNR   RS  Ri   Rk   i   i    i   i   (   R   R-   R.   R*  R   R0   R\  R   Rb   R]  R%   R  R@   R+  R,  R  Rd   R  (   R   R$  R-  R.  Rg   R/  R  Ri   Rj   R~  R  RX  RY  Rk   R0  RM   (    (    s   modules/core.pyt   cycle_tilingd  s2     !% c         G   s  |  j  j t j t j  } | s& d S| j d  } g  } x | D] } | j d  \ } } } }	 }
 } t |  } | j t	 j
 |   t |  d k r t	 j |  qB t	 j | t |  t |	  t |
  t |  |  j    qB W| rt	 j |  j  |  n  |  j   d S(   s    Undo the Latest Tiling OperationNR   RS  i   (   R   R-   R.   R*  R   R0   R\  R]  R%   R   R+  R  R,  R  Rd   R  (   R   R$  R.  Rg   R/  R  Ri   Rj   R~  R  RX  RY  t
   win_id_int(    (    s   modules/core.pyt   undo_tiling  s     ! >c         G   s4  |  j  j t j t j  } | sB t j t d  |  j	 j
  d S|  j  j t j t j d  | j d  } |  j j t  } | d | d } d } x | D] } | | j d  \ } } }	 }
 t j | t |  t |  t |	  t |
  |  j    | d t |  k  r!| d 7} q Pq W|  j   d S(   s3   Tile N Windows According to the User Defined TilingsP   The Custom Tile 1 was Not Set Yet: Click the Menu Item 'Tile->Custom Tile 1 Set'Nt   1R   i    i   RS  (   R   R-   R.   R[  R   R0   R   R  R   R   R   R  R  R\  R   Rl   RG   R,  R]  R  R@   R  (   R   R$  R{  R|  t   windows_listt   win_numR  R~  R  RX  RY  (    (    s   modules/core.pyt   tile_custom_1_run  s     : c         G   s4  |  j  j t j t j  } | sB t j t d  |  j	 j
  d S|  j  j t j t j d  | j d  } |  j j t  } | d | d } d } x | D] } | | j d  \ } } }	 }
 t j | t |  t |  t |	  t |
  |  j    | d t |  k  r!| d 7} q Pq W|  j   d S(   s3   Tile N Windows According to the User Defined TilingsP   The Custom Tile 2 was Not Set Yet: Click the Menu Item 'Tile->Custom Tile 2 Set'Nt   2R   i    i   RS  (   R   R-   R.   R_  R   R0   R   R  R   R   R   R  R  R\  R   Rl   RG   R,  R]  R  R@   R  (   R   R$  R{  R|  R6  R7  R  R~  R  RX  RY  (    (    s   modules/core.pyt   tile_custom_2_run  s     : c         G   sY   |  j  j t j t j d  |  j j t  } t	 j
 | t j |  j    |  j   d S(   s$   Tile 3 Windows in Triangle Up Schemet   uN(   R   R  R.   R  R   R0   R   Rl   RG   R  t   tile_triangle_upR9  R  R  (   R   R$  Rf   (    (    s   modules/core.pyR<    s    c         G   sY   |  j  j t j t j d  |  j j t  } t	 j
 | t j |  j    |  j   d S(   s&   Tile 3 Windows in Triangle Down Schemet   dN(   R   R  R.   R  R   R0   R   Rl   RG   R  t   tile_triangle_downR9  R  R  (   R   R$  Rf   (    (    s   modules/core.pyR>    s    c         G   sY   |  j  j t j t j d  |  j j t  } t	 j
 | t j |  j    |  j   d S(   s&   Tile 3 Windows in Triangle Left Schemet   lN(   R   R  R.   R  R   R0   R   Rl   RG   R  t   tile_triangle_leftR9  R  R  (   R   R$  Rf   (    (    s   modules/core.pyR@    s    c         G   sY   |  j  j t j t j d  |  j j t  } t	 j
 | t j |  j    |  j   d S(   s'   Tile 3 Windows in Triangle Right Schemet   rN(   R   R  R.   R  R   R0   R   Rl   RG   R  t   tile_triangle_rightR9  R  R  (   R   R$  Rf   (    (    s   modules/core.pyRB    s    c         C   s   |  j  s |  j j d  j d  t k rc |  j j d  j   |  j j t j	 t
 j t j  q |  j j d  j   |  j j t j	 t
 j t j  n  d S(   s   Show/Hide the Toolbars   /ToolBarR-  N(   R   R   R   R   RG   R  R   R  R.   R  R   R0   R)  R"  R1   (   R   t   menuitemR  (    (    s   modules/core.pyt   show_hide_toolbar  s    	!#c         C   sC   |  j  r d S|  j j t j t j  t j k r? |  j   n  d S(   s:   Check if the Exit After Tile is Active and Eventually QuitN(	   R   R   R-   R.   R`  R   R0   R1   R  (   R   (    (    s   modules/core.pyR    s    	 %c         C   s$   |  j  j j   |  j  j j   d S(   s:   Show the About Dialog and hide it when a button is pressedN(   R   R   R  R  (   R   RC  R  (    (    s   modules/core.pyt   dialog_about  s    c         C   s   t  j d  d S(   s#   Show the application's Instructionss   http://www.giuspen.com/x-tile/N(   t
   webbrowsert   open(   R   RC  R  (    (    s   modules/core.pyt   on_help_menu_item_activated  s    c         C   s-   |  j  r |  j   n  t j | d t d S(   s;   Hide the X Tile Window if Visible, then Process the Commandt   shellN(   R  R   t
   subprocesst   callRG   (   R   t   command_str(    (    s   modules/core.pyt   hide_and_process  s    	 c         G   s   |  j  d  d S(   s%   Just Undo the Latest Tiling Operations
   x-tile z &N(   RM  (   R   R$  (    (    s   modules/core.pyt   undo_tiling_all  s    c         G   s   |  j  d  d S(   s/   Invert the Order of the Latest Tiling Operations
   x-tile i &N(   RM  (   R   R$  (    (    s   modules/core.pyt   invert_tiling_all  s    c         G   s   |  j  d  d S(   s.   Cycle the Order of the Latest Tiling Operations
   x-tile y &N(   RM  (   R   R$  (    (    s   modules/core.pyt   cycle_tiling_all  s    c         G   s   |  j  d  d S(   s'   Just tile Vertically all opened windowss
   x-tile v &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_vertically   s    c         G   s   |  j  d  d S(   s)   Just tile Horizontally all opened windowss
   x-tile h &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_horizontally  s    c         G   s   |  j  d  d S(   s(   Just tile Triangle Up all opened windowss
   x-tile u &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_triangle_up  s    c         G   s   |  j  d  d S(   s*   Just tile Triangle Down all opened windowss
   x-tile d &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_triangle_down  s    c         G   s   |  j  d  d S(   s*   Just tile Triangle Left all opened windowss
   x-tile l &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_triangle_left  s    c         G   s   |  j  d  d S(   s+   Just tile Triangle Right all opened windowss
   x-tile r &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_triangle_right  s    c         G   s   |  j  d  d S(   s!   Just tile Quad all opened windowss
   x-tile q &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_quad  s    c         G   s   |  j  d  d S(   s!   Just tile Grid all opened windowss
   x-tile g &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_grid  s    c         G   s   |  j  d  d S(   s%   Just tile Custom 1 all opened windowss
   x-tile 1 &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_custom_1   s    c         G   s   |  j  d  d S(   s%   Just tile Custom 2 all opened windowss
   x-tile 2 &N(   RM  (   R   R$  (    (    s   modules/core.pyt   tile_all_custom_2$  s    c         G   s   |  j  d  d S(   s   Maximize all opened windowss
   x-tile m &N(   RM  (   R   R$  (    (    s   modules/core.pyt   maximize_all(  s    c         G   s   |  j  d  d S(   s   Unmaximize all opened windowss
   x-tile M &N(   RM  (   R   R$  (    (    s   modules/core.pyt   unmaximize_all,  s    c         G   s   |  j  d  d S(   s   Close all opened windowss
   x-tile c &N(   RM  (   R   R$  (    (    s   modules/core.pyt	   close_all0  s    c         G   sJ   t  t j d |   } | j j t j  | j j   | j j   ~ d S(   s:   Show the About Dialog and hide it when a button is presseds   x-tile.gladeN(   R   R.   R   R   R   R   R  R  (   R   R$  R   (    (    s   modules/core.pyt   dialog_about_all4  s
    N(f   R   R   R   R   R   R   R   R  R  R  R,  R4  R6  RF  RR  R  R!  R  R  R   R   R  R  R  R  R^   R_   R   RF   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#  Rt   R	  R  R  R  R  R  R  R  R  R   R  R  R  R1  R2  R4  R8  R:  R<  R>  R@  RB  RD  R  RE  RH  RM  RN  RO  RP  RQ  RR  RS  RT  RU  RV  RW  RX  RY  RZ  R[  R\  R]  R^  (    (    (    s   modules/core.pyR      s   	J															k		
	
																														)									
	
												 	 							
																		(    (    (    (   R   R   R   R   t   sysR9   RF  R  RJ  R	  RG   Rb  R)   R    R   Ra  R.   R   R  R   R   R   (    (    (    s   modules/core.pyt   <module>   s   $H
 
#$