???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................
^c           @   s   d  Z  d d l Z d d l Z d d l Td d l Z d d l Z d d l Z d Z d d d     YZ d d d     YZ	 d	 d d
     YZ
 d   Z d S(   s   Main Pynche (Pythonically Natural Color and Hue Editor) widget.

This window provides the basic decorations, primarily including the menubar.
It is used to bring up other windows.
iN(   t   *i  t   PyncheWidgetc           B   s   e  Z d g  d   Z d d  Z d d  Z d d  Z d d  Z d   Z d   Z	 d   Z
 d d  Z d d	  Z d d
  Z d   Z d   Z RS(   c         C   s  | |  _  | |  _ d  |  _ d  |  _ d  |  _ d  |  _ i  |  _ | } |  _ | r t	 | d d |  _
 } | j   | j   nd d  } y! d d l m } | } |  _
 Wn t k
 r n X| s t d d  } |  _
 n  | j   t |  } |  _ t | d d }	 |  _ |	 j d d	 d
 |  j d d  | sa|	 j d d d
 |  j d d d d  n  t |  j  |  j
 |  }
 t | d d } x9 |
 D]1 } | j d | j   d
 | j d | j    qWt | d d d d } | j d d d
 |  j d d  | j d d d
 |  j d d  | j d d d |	 d d  | j d d d | d d  | j d d d | d d  t	 | d d d | } |  _ | j d | r|  j  p|  j  | j! d |  | j" d  | s| j# d |  j  | j# d |  j  n t$ | d d d t% } | j& d d d  d d! d" d# d$ d% d&  t' | d' d( d
 |  j( } | j) d) t* d* d  t' | d' d+ d
 |  j+ } | j) d) t* d* d  d  S(,   Nt   class_t   Pynchei(   t   _default_roott	   classNamet   tearoffi    t   labels   Load palette...t   commandt	   underlinet   Quitt   accelerators   Alt-Qt   namet   helps   About Pynche...s   Help...t   Filet   menut   Viewt   Helpt   WM_DELETE_WINDOWs	   Pynche %ss   <Alt-q>s   <Alt-Q>t   borderwidthi   t   relieft   rowi   t   columnt
   columnspani   t   stickyt   EWt   ipadyi   t   textt   Okayt   sidet   expandt   Cancel(,   t   _PyncheWidget__sbt   _PyncheWidget__versiont   Nonet   _PyncheWidget__textwint   _PyncheWidget__listwint   _PyncheWidget__detailswint   _PyncheWidget__helpwint   _PyncheWidget__dialogstatet   _PyncheWidget__modalt   Toplevelt   _PyncheWidget__tkroott   grab_sett   withdrawt   TkinterR   t   ImportErrort   Tkt   Menut   _PyncheWidget__menubart   _PyncheWidget__filemenut   add_commandt   _PyncheWidget__loadt   _PyncheWidget__quitt   make_view_popupst   menutextt   popupR	   t   _PyncheWidget__popup_aboutt   _PyncheWidget__popup_usaget   add_cascadet   _PyncheWidget__roott   protocolt   _PyncheWidget__bellt   titlet   iconnamet   bindt   Framet   RAISEDt   gridt   Buttont   _PyncheWidget__okayt   packt   LEFTt   _PyncheWidget__cancel(   t   selft   versiont   switchboardt   mastert	   extrapatht   modalt   tkrootR   t   menubart   filemenut   viewst   viewmenut   vt   helpmenut   roott   bframet   okayt   cancel(    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __init__   s    							

		
						c         C   s   |  j  j   d  S(   N(   R*   t   quit(   RJ   t   event(    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __quit{   s    c         C   s   |  j  j   d  S(   N(   R*   t   bell(   RJ   R]   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __bell~   s    c         C   s(   |  j  j   |  j j   |  j   d  S(   N(   R    t   withdraw_viewsR*   t   grab_releaseR5   (   RJ   R]   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __okay   s    c         C   s   |  j  j   |  j   d  S(   N(   R    t   canceledRF   (   RJ   R]   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __cancel   s    c         C   s   |  j  j j t |  j  d  S(   N(   R*   t   tkt   createtimerhandlert   KEEPALIVE_TIMERt   _PyncheWidget__keepalive(   RJ   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __keepalive   s    c         C   s'   |  j  s |  j   n  |  j j   d  S(   N(   R(   Ri   R*   t   mainloop(   RJ   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   start   s    	c         C   s   |  j  S(   N(   R<   (   RJ   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   window   s    c         C   s,   d d l  m } t j d | d |  d  S(   Ni(   t   __version__s   About Pynche s}   Pynche %s
The PYthonically Natural
Color and Hue Editor

For information
contact: Barry A. Warsaw
email:   bwarsaw@python.org(   t   MainRn   t   tkMessageBoxt   showinfo(   RJ   R]   Rn   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __popup_about   s    c         C   s5   |  j  s$ t |  j |  j  |  _  n  |  j  j   d  S(   N(   R&   t   HelpwinR<   R5   t	   deiconify(   RJ   R]   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __popup_usage   s    	c         C   s   x t  j j |  j j   j    \ } } t j d d d g d | d |  } | sX d  Sy t j	 |  } Wn( t
 k
 r t j d d	 |  q n X| d  k r t j d
 d |  q n  Pq W|  j j |  d  S(   Nt	   filetypess
   Text filess   *.txts	   All filesR    t
   initialdirt   initialfiles
   Read errors#   Could not open file for reading:
%ss   Unrecognized color file types(   Unrecognized color file type in file:
%s(   s
   Text filess   *.txt(   s	   All filesR    (   t   ost   patht   splitR    t   colordbt   filenamet   tkFileDialogt   askopenfilenamet   ColorDBt   get_colordbt   IOErrorRp   t	   showerrorR"   t   set_colordb(   RJ   R]   t   idirt   ifilet   fileR|   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __load   s*    '					c         C   s   |  j  j   d  S(   N(   R<   R,   (   RJ   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR,      s    c         C   s   |  j  j   d  S(   N(   R<   Rt   (   RJ   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyRt      s    N(   t   __name__t
   __module__R"   R[   R5   R>   RF   RI   Ri   Rl   Rm   R9   R:   R4   R,   Rt   (    (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR      s   g				Rs   c           B   s&   e  Z d    Z d d  Z d   Z RS(   c         C   s  d d l  m } t | d d |  _ } | j d |  j  | j d  | j d  | j d |  | j d |  | j d	 |  j  | j d
 |  j  t	 j
 j t j
 d d  } yk d  } zJ t |  } | j   } | j d  } | d k r
| |  j   } n  Wd  | r!| j   n  XWn* t k
 rOt j j d  |   } n Xt | d t d d d d |  _ }	 |  j j   |	 j d |  t |  }
 |
 j d t d t  |	 j d t d t   |	 j! d |
 d f  |
 j! d |	 d f  d  S(   Ni(   t	   docstringR   R   R   s   Pynche Help Windows   <Alt-q>s   <Alt-Q>s   <Alt-w>s   <Alt-W>i    t   READMEs   s8   Couldn't open Pynche's README, using docstring instead.
R   t   widthiP   t   heighti   g        t   fillR   R   t   yscrollcommandt   setR   t   yview("   Ro   R   R)   t   _Helpwin__rootR=   t   _Helpwin__withdrawR?   R@   RA   Ry   Rz   t   joint   sysR"   t   opent   readt   rfindt   rstript   closeR   t   stderrt   writet   Textt   SUNKENt   _Helpwin__textt	   focus_sett   insertt	   ScrollbarRG   t   Yt   RIGHTt   BOTHt   YESt	   configure(   RJ   RM   t   quitfuncR   RW   t
   readmefilet   fpt   contentst   iR   t	   scrollbar(    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR[      s@    c         C   s   |  j  j   d  S(   N(   R   R,   (   RJ   R]   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt
   __withdraw   s    c         C   s   |  j  j   d  S(   N(   R   Rt   (   RJ   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyRt      s    N(   R   R   R[   R"   R   Rt   (    (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyRs      s   	(t   PopupViewerc           B   s8   e  Z d    Z d   Z d   Z d d  Z d   Z RS(   c         C   s   | |  _  | |  _ | |  _ | |  _ | j |  _ | j j d  } | d k rW d } n | j j d d d  |  _ | |  _ d  |  _
 d  S(   Nt   %ii    t    i   (   t   _PopupViewer__mt   _PopupViewer__namet   _PopupViewer__sbt   _PopupViewer__roott	   ADDTOVIEWt   _PopupViewer__menutextt   findt   replacet   _PopupViewer__underlineR"   t   _PopupViewer__window(   RJ   t   moduleR   RL   RW   R	   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR[      s    						c         C   s   |  j  S(   N(   R   (   RJ   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR7     s    c         C   s   |  j  S(   N(   R   (   RJ   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR	     s    c         C   s]   |  j  sL t |  j |  j  } | |  j |  j  |  _  |  j j |  j   n  |  j  j   d  S(   N(   R   t   getattrR   R   R   R   t   add_viewRt   (   RJ   R]   R   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR8     s
    	c         C   s   t  |  j | j  S(   N(   t   cmpR   (   RJ   t   other(    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   __cmp__  s    N(   R   R   R[   R7   R	   R"   R8   R   (    (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR      s
   			c         C   s
  g  } t  j j t  g | } x | D] } | d k rA d } n  x t  j |  D] } | d d k rQ | d  } y t |  } Wn0 t k
 r t d |  }	 t |	 |  } n Xt | d  r | j	 r t
 | | |  |  }
 | j |
  q qQ qQ Wq& W| j   | S(   NR   t   .is	   Viewer.pyis   pynche.R   (   Ry   Rz   t   dirnamet   __file__t   listdirt
   __import__R.   R   t   hasattrR   R   t   appendt   sort(   RL   RW   RN   t   viewerst   dirst   dirR   R   R   t   pkgRU   (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyR6     s$    	

(    (    (    (   t   __doc__R   Ry   R-   Rp   R~   R   Rh   R   Rs   R   R6   (    (    (    s9   /usr/lib64/python2.7/site-packages/pynche/PyncheWidget.pyt   <module>   s   
1"