ó «‡Uc@s1dZddlZddlZddlZejdƒddlZddlZddlZddlZddl Z ddl Z dZ iZ gZ xe jD] \ZZyejdƒ\ZZWnCek re ejdd„eƒZe jeeefƒq›Xe ejdd„eƒZy$e ejƒjeeefƒWq›ek r¤e jejƒgƒjeeefƒe jedde ejƒfƒq›Xq›Wed ƒ\ZZZZ d Z!d e"fd „ƒYZ#d ej$fd„ƒYZ%e&dkr-dGdej'Gdej(GHe%ƒj)ƒndS(s× $Id$ pygtk-demo.py 2004-07-18: Some enhancements for building the demolist like in gtk-demos of the gtk+ distribution. 2004-07-22: Simple syntaxhighlighting implemented, based on the tokenizer-module. iÿÿÿÿNs2.0s%sDemot/s(\S+) *cCs;|jdƒdjƒr(|jdƒp:|jdƒjƒS(Nii(tgrouptisuppert capitalize(tm((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyt'scCs;|jdƒdjƒr(|jdƒp:|jdƒjƒS(Nii(RRR(R((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyR-siit InputStreamcBs eZdZd„Zd„ZRS(s Simple Wrapper for File-like objects. [c]StringIO doesn't provide a readline function for use with generate_tokens. Using a iterator-like interface doesn't succeed, because the readline function isn't used in such a context. (see /tokenize.py) cCs3g|jƒD]}d|^q |_d|_dS(Ns%s i(t splitlinest_InputStream__datat_InputStream__lcount(tselftdatatx((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyt__init__Fs&cCsJy#|j|j}|jd7_Wn tk rEd}d|_nX|S(Niti(RR t IndexError(R tline((s"/usr/lib/pygtk27/2.0/pygtk-demo.pytreadlineIs  (t__name__t __module__t__doc__R R(((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyR@s t PyGtkDemocBs’eZd Zd ZiZd„Zd„Zd„Zd„Z e d„Z d„Z d„Z d„Zd„Zd „Zd „Zd „Zd „ZRS(cCs¿tjj|ƒ|jdƒ|jdd„ƒ|jddƒtjtdƒ}|j|ƒ|j ƒ}|j |ttƒtj ƒ|_ |j |j dt ƒ|jtƒ\}|_|j|dƒ|jjd ƒ}|jd d ƒ|jt ƒ\}|_|j|d ƒ|jjd ƒ}|jd dƒ|jddƒ|jddƒ|jjddddtjƒ}|jjdddƒ}|jjddddtjƒ}|jƒdS(NsPyGTK Code DemostdestroycSs tjƒS(N(tgtkt main_quit(tw((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyR[si iitexpandt_InfottitletfontsSans 18t_Sourcetsourcet monospacetpixels_above_linesitpixels_below_linestkeywordt foregrounds#00007Ftweighttstrings#7F007Ftcomments#007F00tstyle(RtWindowR t set_titletconnecttset_default_sizetHBoxtFalsetaddt_PyGtkDemo__create_treeviewt pack_starttNotebooktnotebooktTruet_PyGtkDemo__create_textt info_buffert_new_notebook_paget create_tagt set_propertyt source_buffertpangot WEIGHT_BOLDt STYLE_ITALICtshow_all(R thboxttreeviewtscrolled_windowttag((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyR Xs4     cCstjƒdS(N(Rtmain(R ((s"/usr/lib/pygtk27/2.0/pygtk-demo.pytrunzscCs3tjdƒ}|j|ƒ|jj||ƒdS(NR(RtLabeltset_text_with_mnemonicR3t append_page(R twidgettlabeltl((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyR7}s c Cs¡tjtjtjtjtjƒ}tj|ƒ}|jƒ}|jtjƒ|j ddƒxÁt D]¹}|j dƒ}|j |t|tt|tt|tttƒ y_|t}xN|D]F}|j |ƒ}|j |t|tt|tt|tttƒ qÀWWqftk rqfXqfWtjƒ} | jdtjƒtjd| dtdtƒ} |j| ƒ|jd|jƒ|jd|jƒ|jƒ|S( NiÈiÿÿÿÿR(sWidget (double click for demo)ttextt style_settchangeds row-activated(Rt TreeStoretgobjectt TYPE_STRINGt TYPE_BOOLEANtTreeViewt get_selectiontset_modetSELECTION_BROWSEtset_size_requestt testgtk_demostappendtNonetsett TITLE_COLUMNt MODULE_COLUMNt FUNC_COLUMNt ITALIC_COLUMNR.tCHILDREN_COLUMNRtCellRendererTextR9R;R=tTreeViewColumnt append_columnR+tselection_changed_cbtrow_activated_cbt expand_all( R tmodelR@t selectiontmoduletitertchildrent child_modulet child_itertcelltcolumn((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyt__create_treeview‚sH                  cCs™tjƒ}|jtjtjƒ|jtjƒtjƒ}|j|ƒtjdƒ}|j |ƒ|j t ƒ|j t ƒ|j| ƒ||fS(N(RtScrolledWindowt set_policytPOLICY_AUTOMATICtset_shadow_typet SHADOW_INtTextViewR/t TextBufferRYt set_buffert set_editableR.tset_cursor_visiblet set_wrap_mode(R t is_sourceRAt text_viewtbuffer((s"/usr/lib/pygtk27/2.0/pygtk-demo.pyt __create_text´s      c Cs|jƒ}|j|ƒ}|j|tƒ}|j|tƒ}|j|tƒ}|dkratSy|j|j ƒWn…t k rýt t |ƒ} |j |t| ƒd||f} t| ƒ|ƒ} | rþ| jd|j||ƒ| |j| sL               $ (+é