ó
‹²,]c           @   së   d  Z  d d l m Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z
 m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z d d l m Z d	 Z d
 Z d e
 f d „  ƒ  YZ d „  Z e d k rç e ƒ  n  d S(   s   Shortcut Summary dialogiÿÿÿÿ(   t
   itemgetter(   t   groupby(   t   Qt(   t   QFont(	   t   QDialogt   QLabelt   QGridLayoutt	   QGroupBoxt   QVBoxLayoutt   QHBoxLayoutt   QDesktopWidgett   QScrollAreat   QWidget(   t   _(   t   iter_shortcutsi   i   t   ShortcutsSummaryDialogc           B   s#   e  Z d  Z d d „ Z d „  Z RS(   s  
    Dialog window listing the spyder and plugins shortcuts.

    It contains all the shortcuts avalaible through iter_shortcuts
    function

    The shortcuts are dysplayed in different columns, and grouped by
    context (global, editor, console...)
    c         C   s¥  t  j |  d | ƒt d ƒ |  _ |  j ƒ  \ } } | d } t t | t ƒ t ƒ } | d | | d } d } |  j	 | ƒ t
 ƒ  } | j | ƒ | j t ƒ t
 ƒ  } | j | ƒ t
 ƒ  }	 |	 j | d ƒ |	 j t ƒ t |  j ƒ }
 |
 j t j ƒ |
 j |	 ƒ t ƒ  } d } d  } t t t ƒ  ƒ d	 t d ƒ ƒ} xŒ| D]„\ } } xut | ƒ D]g\ } \ } } } | d k rŽt ƒ  } n  | d k r¶| d k r¶| j | ƒ n  | d k sÎ| d k r%| d
 k rãd } n  t | j ƒ  ƒ } | j | ƒ t ƒ  } | j | ƒ | d 7} n  t | j ƒ  j  d
 d ƒ ƒ } | j | ƒ t | ƒ } | j | ƒ | j | | d ƒ | j | | d ƒ | d 7} | | k ra| j | ƒ | j! | ƒ d } qaqaWqHW| j | ƒ | j" ƒ  | j! | ƒ t# ƒ  |  _$ |  j$ j | ƒ t% ƒ  |  _& |  j& j' |  j$ ƒ |  j( t j) ƒ |  j* d ƒ t ƒ  |  _+ |  j+ j |
 ƒ |  j+ j |  j& ƒ |  j |  j+ ƒ |  j, d d | | ƒ d  S(   Nt   parents   Spyder Keyboard ShortCutsiP   i   i   s{   
            QDialog {
              margin:0px;
              padding:0px;
              border-radius: 2px;
            }i   i    t   keyR   t   Globali   t    gffffffî?(-   R   t   __init__R   t   _shortcuts_summary_titlet   get_screen_resolutiont   maxt   mint   MAX_FONT_SIZEt   MIN_FONT_SIZEt   setStyleSheetR   t   setPointSizet   setBoldt   TrueR   t   setAlignmentR   t   AlignCentert   setFontR	   t   NoneR   t   sortedR   R    t	   enumerateR   t	   addWidgetR   t
   capitalizeR   t	   setLayoutt   replacet	   addLayoutt
   addStretchR   t   scroll_widgetR   t   scroll_areat	   setWidgett   setWindowFlagst   FramelessWindowHintt   setWindowOpacityt   _layoutt   setGeometry(   t   selfR   t   widtht   heightt	   font_sizet   shortcuts_columnt   stylet
   font_namest   font_keystrt
   font_titlet   title_labelt   columns_layoutt   added_shortcutst   groupt	   shortcutst   contextt   group_shortcutst   it   namet   keystrt   column_layoutt   group_layoutt
   label_namet   label_keystr(    (    s>   lib/python2.7/site-packages/spyder/widgets/shortcutssummary.pyR   '   s|    
				!" 		

c         C   s4   t  ƒ  } | j | j ƒ  ƒ } | j ƒ  | j ƒ  f S(   s3   Return the screen resolution of the primary screen.(   R
   t   availableGeometryt   primaryScreenR4   R5   (   R3   t   widgett   geometry(    (    s>   lib/python2.7/site-packages/spyder/widgets/shortcutssummary.pyR   ‘   s    	N(   t   __name__t
   __module__t   __doc__R"   R   R   (    (    (    s>   lib/python2.7/site-packages/spyder/widgets/shortcutssummary.pyR      s   	jc          C   s=   d d l  m }  |  ƒ  } t d  ƒ } | j ƒ  | j ƒ  d  S(   Niÿÿÿÿ(   t   qapplication(   t   spyder.utils.qthelpersRQ   R   R"   t   showt   exec_(   RQ   t   appt   dlg_shortcuts(    (    s>   lib/python2.7/site-packages/spyder/widgets/shortcutssummary.pyt   test˜   s
    	
t   __main__N(   RP   t   operatorR    t	   itertoolsR   t   qtpy.QtCoreR   t
   qtpy.QtGuiR   t   qtpy.QtWidgetsR   R   R   R   R   R	   R
   R   R   t   spyder.config.baseR   t   spyder.config.guiR   R   R   R   RW   RN   (    (    (    s>   lib/python2.7/site-packages/spyder/widgets/shortcutssummary.pyt   <module>   s   @{	