
PtIc           @   s  d  Z  d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k	 Z	 d d k
 Z
 d d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z d d k Z d d k Z d d k Z d d k Z d e i f d     YZ d S(   s   main.py - Main window.iN(   t   prefst
   MainWindowc           B   s  e  Z d  Z e e d* d d  Z e e d  Z d   Z e 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* d  Z" d* d* d  Z# d    Z$ d!   Z% d"   Z& d#   Z' d$   Z( d%   Z) d&   Z* d'   Z+ d(   Z, d)   Z- RS(+   s[   The Comix main window, is created at start and terminates the
    program when closed.
    i   c      
   C   s  t  i i |  t  i  t |  _ t |  _ t |  _ t |  _ t	 i
 |  _ d  |  _ d  |  _ d |  _ t |  _ t i |   |  _ t i |   |  _ t i   |  _ t i |   |  _ t i |   |  _ t i  |   |  _! t" i# |   |  _$ t% i& |   |  _' |  i' i( d  |  _) |  i' i( d  |  _* |  i' i( d  |  _+ |  i' i,   d |  _- t  i.   |  _/ t  i.   |  _0 t  i1 t d  |  _2 t  i3   |  _4 t5 i6 |   |  _7 |  i4 i8   |  _9 |  i4 i:   |  _; t  i< |  i9  |  _= t  i> |  i;  |  _? |  i@ d  |  iA d d  |  iB tC d	 tC d
  |  i* iD |  i' i( d   |  i* iE t  iF  |  i2 iG |  i/  |  i2 iG |  i0  |  i2 iH   |  i4 iI |  i2 d d  |  iJ tC d  d |  i9 _K d |  i9 _L d |  i; _K d |  i; _L t  iM d d t  } | iN |  i d d d d t  iO t  iO t  iP Bd d 	 | iN |  i4 d d d d t  iO t  iP Bt  iO t  iP Bd d 	 | iN |  i= d d d d t  iO t  iQ Bt  iO t  iQ Bd d 	 | iN |  i? d d d d t  iO t  iQ Bt  iO d d 	 | iN |  i) d d d d t  iO t  iQ Bt  iO d d 	 | iN |  i* d d d d t  iO t  iQ Bt  iO d d 	 | iN |  i d d d d t  iO t  iQ Bt  iO d d 	 tC d o |  i- iR d  iS   n tC d p | o |  i- iR d  iS   n tC d o |  i- iR d  iS   n tC d t	 i
 j o |  i- iR d  iS   n tC d t	 iT j o |  i- iR d  iS   ns tC d t	 iU j o |  i- iR d  iS   nE tC d t	 iV j o0 |  i- iR d  iS   |  i- iR d  iS   n tC d o$ t tC d <|  i- iR d  iS   n tC d  o$ t tC d  <|  i- iR d!  iS   n tC d" o$ t tC d" <|  i- iR d#  iS   n tC d$ o$ t tC d$ <|  i- iR d%  iS   n tC d& o$ t tC d& <|  i- iR d'  iS   n tC d( o$ t tC d( <|  i- iR d(  iS   n tC d) o$ t tC d) <|  i- iR d*  iS   n d tC d+ <t tC d, <t tC d- <|  iG |  | iW   |  i4 iW   |  iX   |  i4 iY t  iZ i[ t  iZ i\ Bt  iZ i] Bt  iZ i^ Bt  iZ i_ B |  i4 i` t  ia d8 g t  iZ ib t  iZ ic B |  id d/ |  ie  |  id d0 |  i7 if  |  id d1 |  i7 ig  |  i4 id d2 |  i7 ih  |  i4 id d3 |  i7 ii  |  i4 id d4 |  i7 ij  |  i4 id d5 |  i7 ik  |  i4 id d6 |  i7 il  |  i' im   |  iW   | d  j	 o |  i in | |  n | o |  i- iR d7  iS   n d  S(9   Nid   s   /Menus   /Tools   /Popupi    i   t   Comixi,  s   window widths   window heights   /Tool/expanders	   bg colouri   i   i   i   i   i   s   default double paget   double_pages   default fullscreent
   fullscreens   default manga modet
   manga_modes   default zoom modet   best_fit_modet   fit_width_modet   fit_height_modet   fit_manual_modes   show toolbart   toolbars   show menubart   menubars   show statusbart	   statusbars   show scrollbart	   scrollbars   show thumbnailst
   thumbnailss   hide alls   keep transformationt   keep_transformationt   rotations   vertical flips   horizontal flips   text/uri-listt   delete_eventt   key_press_eventt   configure_eventt   button_release_eventt   scroll_eventt   button_press_eventt   motion_notify_eventt   drag_data_receivedt   library(   s   text/uri-listi    i    (o   t   gtkt   Windowt   __init__t   WINDOW_TOPLEVELt   Falset   is_fullscreent   is_double_paget   is_manga_modet   is_virtual_double_paget   preferencest   ZOOM_MODE_BESTt	   zoom_modet   Nonet   widtht   heightt   _manual_zoomt   _waiting_for_redrawt   filehandlert   FileHandlert   file_handlert   thumbbart   ThumbnailSidebart   thumbnailsidebart   statust	   StatusbarR   t	   slideshowt	   Slideshowt   cursort   CursorHandlert   cursor_handlert   enhancet   ImageEnhancert   enhancert   lenst   MagnifyingGlasst   glasst   uit   MainUIt
   ui_managert
   get_widgetR   R
   t   popupt   get_action_groupst   actiongroupt   Imaget
   left_imaget   right_imaget   HBoxt
   _image_boxt   Layoutt   _main_layoutt   eventt   EventHandlert   _event_handlert   get_vadjustmentt   _vadjustt   get_hadjustmentt   _hadjustt
   VScrollbart   _vscrollt
   HScrollbart   _hscrollt	   set_titlet   set_size_requestt   resizeR    t   set_focus_childt	   set_stylet   TOOLBAR_ICONSt   addt   show_allt   putt   set_bg_colourt   step_incrementt   page_incrementt   Tablet   attacht   FILLt   EXPANDt   SHRINKt
   get_actiont   activatet   ZOOM_MODE_WIDTHt   ZOOM_MODE_HEIGHTt   ZOOM_MODE_MANUALt   showt   _display_active_widgetst
   set_eventst   gdkt   BUTTON1_MOTION_MASKt   BUTTON2_MOTION_MASKt   BUTTON_PRESS_MASKt   BUTTON_RELEASE_MASKt   POINTER_MOTION_MASKt   drag_dest_sett   DEST_DEFAULT_ALLt   ACTION_COPYt   ACTION_MOVEt   connectt   terminate_programR   t   resize_eventt   mouse_release_eventt   scroll_wheel_eventt   mouse_press_eventt   mouse_move_eventt   drag_n_drop_eventt   set_sensitivitiest	   open_file(   t   selfR   t   show_libraryt	   open_patht	   open_paget   table(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR   !   s   									%%%%%%











	'	
c         C   s:   |  i  p, t |  _  t i |  i | | d t i n d S(   sH   Draw the current page(s) and update the titlebar and statusbar.
        t   priorityN(   R*   t   Truet   gobjectt   idle_addt   _draw_imaget   PRIORITY_HIGH_IDLE(   R   t	   at_bottomt   scroll(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt
   draw_image   s    
	c         C   s  t  |  _ |  i   |  i i p t  Sn |  i   \ } } |  i t i j o
 d } n | } |  i t i	 j o
 d } n | } t
 d } |  i i   |  _ |  i   oK|  i i   \ } }	 |  i o | |	 }	 } n | i   }
 | i   } |	 i   } |	 i   } t
 d } t
 d } t
 d o> | t i |  7} | d } | t i |	  7} | d } n |  i t i j o | d j o |
 } | } n | } |
 } | d j o | | 7} | | 7} n | | 7} | | 7} t |  i | d  } t |  i | d  } t } n t i | |	 | | d	 | d
 | d | \ } }	 t
 d o( | i d t  } |	 i d t  }	 n t
 d o( | i d t   } |	 i d t   }	 n |  i i |  } |  i i |	  }	 |  i i |  |  i i |	  | | i   |	 i   d } | t | i   |	 i    d } | d j o d | i   | } n d | i   |
 } | d j o d |	 i   | } n d |	 i   | } |  i  i! |  i i"   |  i i#   d t |  i  i$ |
 | | f | | | f  n|  i i d t  } | i   } | i   } t
 d } t
 d o! | t i |  7} | d } n |  i t i j oV t |  i | d  } t |  i | d  } | d j o | | } } n t } n t i% | | | d	 | d | } t
 d o | i d t  } n t
 d o | i d t   } n |  i i |  } |  i i |  |  i i&   | | i   d } | | i   d } | d  j o d | i   | } n d | i   | } |  i  i! |  i i"   |  i i#    |  i  i$ | | | f  t
 d o) t i' |  i i(    } |  i) |  n |  i* i+ i,   |  i- i. |  i* t d |  t d |   |  i i/   |  i   o |  i i/   n |  i i0   |  i- i1 |  i* i2     | o; | o |  i3 d d d d  q|  i3 d d d d  n |  i* i+ i4   |  i  i5 |  i i6    |  i  i7   |  i8   x t9 i:   o t9 i; t   q6Wt i< |  i  |  i i=   |  i> i?   t  S(!   Nit   stretchR   s   auto rotate from exifih  iZ   i  id   t   scale_upt	   rotation1t	   rotation2s   horizontal flipt
   horizontals   vertical flipi   g      Y@R   t   singles   smart bgi    t   horizt	   endsecondt   vertt   bottomt
   startfirstt   top(   iZ   i  (   iZ   i  (   iZ   i  (   iZ   i  (   iZ   i  (   iZ   i  (@   R   R*   Rn   R-   t   file_loadedt   get_visible_area_sizeR%   R#   Rk   Rj   R    t   get_virtual_double_pageR"   t   displayed_doublet   get_pixbufsR!   t	   get_widtht
   get_heightt   imaget   get_implied_rotationRl   t   intR)   R   t   fit_2_in_rectanglet   flipR:   R8   RF   t   set_from_pixbufRG   t   maxR   t   set_page_numbert   get_current_paget   get_number_of_pagest   set_resolutiont   fit_in_rectanglet   cleart   get_most_common_edge_colourt
   get_pixbufR`   RI   t   windowt   freeze_updatesRK   t   moveRm   t   hidet   set_sizet   size_requestt   scroll_to_fixedt   thaw_updatest   set_filenamet   get_pretty_current_filenamet   updatet   update_titleR   t   events_pendingt   main_iterationt   draw_histogramt   do_cacheingR0   t   load_thumbnails(   R   R   R   t
   area_widtht   area_heightt   scaled_widtht   scaled_heightR   t   left_pixbuft   right_pixbuft   left_unscaled_xt   left_unscaled_yt   right_unscaled_xt   right_unscaled_yt   left_rotationt   right_rotationt   total_widtht   total_heightt	   x_paddingt	   y_paddingt   left_scale_percentt   right_scale_percentt   pixbuft
   unscaled_xt
   unscaled_yR   t   scale_percentt	   bg_colour(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR      s   	












		

	
	
 c         C   sN   t  d p" d t  d <t t  d <t t  d <n |  i i   |  i d |  d S(   sr   Draw a *new* page correctly (as opposed to redrawing the same
        image with a new size or whatever).
        s   keep transformationi    R   s   horizontal flips   vertical flipR   N(   R    R   R0   t   update_selectR   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   new_pageo  s    

c         G   s"   |  i  i   o |  i   n d  S(   N(   R-   t	   next_pageR   (   R   t   args(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR   z  s    c         G   s(   |  i  i   o |  i d t  n d  S(   NR   (   R-   t   previous_pageR   R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR   ~  s    c         G   s"   |  i  i   o |  i   n d  S(   N(   R-   t
   first_pageR   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR     s    c         G   s"   |  i  i   o |  i   n d  S(   N(   R-   t	   last_pageR   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR     s    c         C   s%   |  i  i |  o |  i   n d  S(   N(   R-   t   set_pageR   (   R   t   num(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR     s    c         G   s$   t  d d d t  d <|  i   d  S(   NR   iZ   ih  (   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt	   rotate_90  s    c         G   s$   t  d d d t  d <|  i   d  S(   NR   i   ih  (   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt
   rotate_180  s    c         G   s$   t  d d d t  d <|  i   d  S(   NR   i  ih  (   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt
   rotate_270  s    c         G   s   t  d t  d <|  i   d  S(   Ns   horizontal flip(   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   flip_horizontally  s    c         G   s   t  d t  d <|  i   d  S(   Ns   vertical flip(   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   flip_vertically  s    c         C   s   | i    |  _ |  i   d  S(   N(   t
   get_activeR    R   (   R   t   toggleaction(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_double_page  s    c         C   s   | i    |  _ |  i   d  S(   N(   R   R!   R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_manga_mode  s    c         C   sO   | i    |  _ |  i o |  i   |  i i   n |  i   |  i i   d  S(   N(   R   R   R   R7   t   auto_hide_ont   unfullscreent   auto_hide_off(   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_fullscreen  s    


c         G   s   |  i  } | i   |  _  |  i  t i j } |  i i d  i |  |  i i d  i |  |  i i d  i |  | |  i  j o |  i   n d  S(   Nt   zoom_int   zoom_outt   zoom_original(   R%   t   get_current_valueR#   Rl   RD   Rh   t   set_sensitiveR   (   R   t   radioactionR   t   old_modet	   sensitive(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_zoom_mode  s    	c         G   s   t  d t  d <|  i   d  S(   Ns   show toolbar(   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_toolbar_visibility  s    c         G   s   t  d t  d <|  i   d  S(   Ns   show menubar(   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_menubar_visibility  s    c         G   s   t  d t  d <|  i   d  S(   Ns   show statusbar(   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_statusbar_visibility  s    c         G   s   t  d t  d <|  i   d  S(   Ns   show scrollbar(   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_scrollbar_visibility  s    c         G   s   t  d t  d <|  i   d  S(   Ns   show thumbnails(   R    R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_thumbnails_visibility  s    c         G   s   t  d t  d <t  d } |  i i d  i |  |  i i d  i |  |  i i d  i |  |  i i d  i |  |  i i d  i |  |  i   d  S(   Ns   hide allR
   R   R   R   R   (   R    RD   Rh   R   R   (   R   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_hide_all  s    c         G   s   t  d t  d <d  S(   Ns   keep transformation(   R    (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   change_keep_transformation  s    c         G   sa   |  i  d } d | j  o
 d j  n o
 d } n | d j o d  Sn | |  _  |  i   d  S(   Ngffffff?i_   ii   id   i  (   R)   R   (   R   R   t   new_zoom(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   manual_zoom_in  s    
	c         G   sa   |  i  d } d | j  o
 d j  n o
 d } n | d j  o d  Sn | |  _  |  i   d  S(   Ngffffff?i_   ii   id   i
   (   R)   R   (   R   R   R  (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   manual_zoom_out  s    
	c         G   s   d |  _  |  i   d  S(   Nid   (   R)   R   (   R   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   manual_zoom_original  s    	c         C   s  |  i  i   } |  i i   } |  i   \ } } t d |  i  i |  } t d |  i i |  }	 d }
 | d j	 o* |  i o  h  d d <d d <| } n | d j o( t d | |  i i	   d d  } n) | d j o |  i
 i	   d d }
 n | | } | | } t |
 |  } t d |  } t | |  } t |	 |  } |  i i |  |  i  i |  | | j p
 | | j S(   sd  Scroll <x> px horizontally and <y> px vertically. If <bound> is
        'first' or 'second', we will not scroll out of the first or second
        page respectively (dependent on manga mode). The <bound> argument
        only makes sense in double page mode.

        Return True if call resulted in new adjustment values, False
        otherwise.
        i    t   secondt   firsti   N(   RR   t	   get_valueRP   R   R   t   upperR&   R!   RG   R   RF   t   mint	   set_value(   R   t   xt   yt   boundt   old_hadjustt   old_vadjustt   visible_widtht   visible_heightt   hadjust_uppert   vadjust_uppert   hadjust_lowert   new_hadjustt   new_vadjust(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR     s,    	 "

c         C   s  |  i  i   } |  i i   } | } | } |  i   \ } } |  i i | }	 |  i  i | }
 | d j o
 d } n3 | d j o |	 d } n | d j o
 |	 } n |  i   p( h  d d <d d <i | |  } n |  i og |  i   oZ | d j	 oM h  d	 d	 <d d <d
 d
 <d d <d d <d d <d d <| } nS |  i oH | d j	 o; h  d	 d	 <d d <d
 d
 <d d <d d <| } n | d	 j o
 d } n | d j o |
 d } n | d
 j o
 |
 } n | d j o
 d } n | d j o2 |  i   o |  i	 i
   d | } q{|
 } n@ | d j o |  i	 i
   d d } n | d j o
 |
 } n t d |  } t d |  } t |
 |  } t |	 |  } |  i i |  |  i  i |  | | j p
 | | j S(   s1  Scroll using one of several fixed values.

        If either <horiz> or <vert> is as below, the display is scrolled as
        follows:

        horiz: 'left'        = left end of display
               'middle'      = middle of the display
               'right'       = right end of display
               'startfirst'  = start of first page
               'endfirst'    = end of first page
               'startsecond' = start of second page
               'endsecond'   = end of second page

        vert:  'top'         = top of display
               'middle'      = middle of display
               'bottom'      = bottom of display

        What is considered "start" and "end" depends on whether we are
        using manga mode or not.

        Return True if call resulted in new adjustment values.
        R   i    t   middlei   R   t   endfirstt   startsecondR   t   leftt   rightR   N(   RR   R  RP   R   R	  R   t   getR!   R&   RF   R   R   R
  R  (   R   R   R   R  R  R  R  R  R  R  R  (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR     sj    

$								




c         C   s   |  i    p t Sn |  i   \ } } |  i oD |  i i   |  i i | j p  |  i i   |  i i   d j Sn; |  i i   d j p$ |  i i   | |  i i   d j Sd S(   s   Return True if we are currently viewing the first page, i.e. if we
        are scrolled as far to the left as possible, or if only the left page
        is visible on the main layout. In manga mode it is the other way
        around.
        i    N(	   R   R   R   R!   RR   R  R	  RF   R   (   R   R'   R(   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   is_on_first_pageg  s    
 $c         C   sc   |  i  i   |  i i   |  i i   |  i d  |  i i d  |  i t d  t	 i
   d S(   s;   Clear the currently displayed data (i.e. "close" the file).R   t    s	   bg colourN(   RF   R   RG   R0   RW   R   t   set_messageR`   R    R8   t   clear_histogram(   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR   x  s    c         C   s1   |  i  o' |  i o |  i i   |  i i   j S(   s1   Return True if two pages are currently displayed.(   R    R"   R-   R   R   (   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR     s    c         C   s  |  i    \ } } t d o^|  i o t d oHt d o | |  i i   d 8} n t d o | |  i i   d 8} n t d o | |  i i   8} n t d o | |  i i   d 8} n t d o |  i	 t
 i j o | |  i i   d	 8} qx|  i	 t
 i j o | |  i i   d 8} qx|  i	 t
 i j o2 | |  i i   d	 8} | |  i i   d 8} qxq|n | | f S(
   sh   Return a 2-tuple with the width and height of the visible part
        of the main layout area.
        s   hide alls   hide all in fullscreens   show toolbari   s   show statusbars   show thumbnailss   show menubars   show scrollbari    (   t   get_sizeR    R   R
   R   R   R0   R   R   R%   R#   Rj   RT   Rk   RV   Rl   (   R   R'   R(   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR     s(    #c         C   sE   |  i  i   \ } } | |  i i   7} | |  i i   7} | | f S(   s~   Return a 2-tuple with the x and y coordinates of the pointer
        on the main layout area, relative to the layout.
        (   RK   t   get_pointerRR   R  RP   (   R   R  R  (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyt   get_layout_pointer_position  s    c         C   s   |  i  i i |  t S(   s   Set the cursor on the main layout area to <mode>. You should
        probably use the cursor_handler instead of using this method
        directly.
        (   RK   R   t
   set_cursorR   (   R   t   mode(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR%    s    c         C   s   |  i    oK t i d |  i i   |  i i   d |  i i   |  i i   f  } n8 t i d |  i i   |  i i   |  i i   f  } |  i i   o d t	 d  | f } n |  i
 |  d S(   s(   Set the title acording to current state.s   [%d,%d / %d]  %s - Comixi   s   [%d / %d]  %s - Comixs   [%s] %st	   SLIDESHOWN(   R   t   encodingt
   to_unicodeR-   R   R   R   R3   t
   is_runningt   _RW   (   R   t   title(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR     s    		c         C   s>   |  i  i t i t i i   i t i i |   t t	   d S(   sx   Set the background colour to <colour>. Colour is a sequence in the
        format (r, g, b). Values are 16-bit.
        N(
   RK   t	   modify_bgR   t   STATE_NORMALRp   t   colormap_get_systemt   alloc_colort   ColorR   R   (   R   t   colour(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR`     s    c         C   s  t  d o|  i o t  d ovt  d o |  i i   n |  i i   t  d o |  i i   n |  i i   t  d o |  i i   n |  i i   t  d o1 |  i t i	 j o |  i
 i   |  i i   n t  d o1 |  i t i j o |  i
 i   |  i i   nW t  d o1 |  i t i j o |  i
 i   |  i i   n |  i
 i   |  i i   t  d o |  i i   q|  i i   nO |  i i   |  i i   |  i i   |  i i   |  i
 i   |  i i   d S(	   sU   Hide and/or show main window widgets depending on the current
        state.
        s   hide alls   hide all in fullscreens   show toolbars   show statusbars   show menubars   show scrollbars   show thumbnailsN(   R    R   R
   R^   t   hide_allR   R   R%   R#   Rj   RT   RV   Rk   Rl   R0   Rm   R   (   R   (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyRn     sD    c         G   s   |  i    t i   d j o t i   n t d o7 |  i i o* |  i i   t d <|  i i   t d <n d t d <d t d <|  i i	   t
 i   |  i i i   x5 t i   D]' } | t i   j	 o | i   q q Wd GHt i d  d S(	   s(   Run clean-up tasks and exit the program.i    s   auto load last files   path to last files   page of last fileR  i   s   Bye!N(   R   R   t
   main_levelt	   main_quitR    R-   R   t   get_real_pathR   t   cleanupR#   t   write_preferences_fileR@   t	   bookmarkst   write_bookmarks_filet	   threadingt	   enumeratet   currentThreadt   joint   syst   exit(   R   R   t   thread(    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR{     s"    



 N(.   t   __name__t
   __module__t   __doc__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  R  R  R   R   R  R   R   R   R$  R%  R   R`   Rn   R{   (    (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pyR      sT   																	
						
						 S		
								-(   RD  R?  t   ost   shutilR;  R   R   t	   constantsR5   R(  R8   RL   R+   R   R;   R#   R    R>   R3   R1   R.   R   R   (    (    (    sD   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/main.pys   <module>   s*   