;ò M/Ec@sdZdkZdkZdklZlZlZlZdZdZdZ dZ dZ dZ d Z d Zd „Zdd „Zd eifd„ƒYZd„Zd„Zeeeed„ZedƒZeeed„Zeeed„Zeed„Zeied„ZdS(sËThis module allows applications to set themselves as the default handler for a particular MIME type. This is generally not a good thing to do, because it annoys users if programs fight over the defaults.N(s_smimeschoicessbasedirsrox.sourceforge.netiiiiiiicCsOt}y7ti|||ƒ}| oti||ƒ}nWnnX|SdS(N( sNonespathsbasedirsload_first_configssitesdirsleafschoicessload(ssitesdirsleafspath((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys load_pathscCsttitdƒ}|otii|ƒo+ti||ƒ}tii ||ƒ}nt i |||ƒ}|SdS(Ns ROX-Filer(sbasedirsload_first_configsSITEsfilersosspathsisdirssave_config_pathssitesdirsjoinsleafschoicesssavescreate(ssitesdirsleafscreatesfilerspath((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys save_paths s InstallListcBsMtZdZeeed„Zd„Zd„Zd„Z d„Z d„Z RS(s3Dialog to select installation of MIME type handlersc Cs+tii|dtdƒ|dtiitiitii tii fƒ||_||_ ||_ ||_ ||_tii|ƒ|_||_|i}tiiƒ} | iddƒ| idƒ| itiitiiƒ| itiiƒ|i| t t dƒtii!t"t"t"t#tii$i%t#t#ƒ|_&tii'|i&ƒ}||_(| i)|ƒ|i*dƒtii+ƒ} tii-d | d t.ƒ} |i0| ƒtii1ƒ} tii-td ƒ| d t2ƒ} |i0| ƒ| i3t2ƒtii1ƒ} tii-td ƒ| d t4ƒ} |i0| ƒ| i3t4ƒ|oNtii1ƒ} tii-tdƒ| d t5ƒ} |i0| ƒ| i3t5ƒntii6ƒ} | i7dt ƒ| i8d|i9|i&ƒtii-tdƒ| dt:ƒ} |i0| ƒ| i3t:ƒtii6ƒ} | i8d|i;|i&ƒtii-tdƒ| dt<dt=ƒ} |i0| ƒ| i3t<ƒ|i>ƒi?tii@ƒ|o€tiiBddƒ}tiiDtiiEtiiFƒ} |i| ƒtiiH|ƒ} | iJt ƒ|i| ƒ|i|ƒn|iKƒ|iLƒdS(s:Create the install list dialog. application - path to application to install itype - string describing the type of action to install dir - directory in Choices to store links in types - list of MIME types info - optional message to display below list check - if true (the default), check for existing entriesstitles Install %ssbuttonsiÿÿÿÿi iiisspixbufsTypestextsNamesCurrents activatablestoggledsInstall?sactives Uninstall?sspacingN(MsroxsDialogs__init__sselfs_sitypesgs STOCK_CANCELsRESPONSE_CLOSEsSTOCK_OKsRESPONSE_ACCEPTsdirssitestypess applicationsappsosspathsbasenamesanameschecksvboxsScrolledWindowsswinsset_size_requestsset_border_widths set_policys POLICY_NEVERs POLICY_ALWAYSsset_shadow_types SHADOW_INs pack_startsTrues ListStoresstrsintsgdksPixbufsmodelsTreeViewsviewsaddsset_search_columnsCellRendererPixbufscellsTreeViewColumns_ICONscolumns append_columnsCellRendererTexts_TNAMEsset_sort_column_ids_COMMENTs_CURRENTsCellRendererToggles set_propertysconnectsinstall_toggleds_INSTALLsuninstall_toggleds _UNINSTALLs_IS_OURSs get_selectionsset_modesSELECTION_NONEsinfosHBoxshboxsimage_new_from_stocksSTOCK_DIALOG_INFOsICON_SIZE_DIALOGsimgsLabelslbls set_line_wrapsshow_alls load_types(sselfs applicationsitypesdirstypessinfoscheckssiteshboxsimgscellsswinslblscolumnsvboxsview((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys__init__+s~.        !    !  !  ! !         cCst|ƒtjo|itt|ƒƒ}n|i|ƒ}|i |t |i ƒ ƒ|i ƒ o|i |t dƒndS(s9Handle the CellRedererToggle stuff for the install columniN(stypespathsstrsmodelsiter_nth_childsNonesintstitersget_iters set_values_INSTALLscells get_actives _UNINSTALL(sselfscellspathsmodelstiter((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pysinstall_toggled„scCs±t|ƒtjo|itt|ƒƒ}n|i|ƒ}|i |t ƒ}|oC|i |t |iƒ ƒ|iƒ o|i |tdƒq­n|i |t dƒdS(s;Handle the CellRedererToggle stuff for the uninstall columniN(stypespathsstrsmodelsiter_nth_childsNonesintstitersget_iters get_values_IS_OURSsavails set_values _UNINSTALLscells get_actives_INSTALL(sselfscellspathsmodelsavailstiter((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pysuninstall_toggledsc Cs˜|iiƒx„|iD]y}ti|ƒ}|io®t |i |i d|i |i fƒ}|otii|ƒo%ti|ƒ}tii|ƒ}n|o d}nd}||ijot}t}qöt}t}nt}t}d}|itiƒ}|iiƒ}|ii|t |t!|i"ƒt#|t$tt%|ƒ |io|ii|t&|ƒn|o|ii|t'|ƒqqWdS(sLoad list of types into windows%s_%ssscriptsN((sselfsmodelsclearstypesstnamesmimeslookups mime_typeschecks load_pathssitesdirsmediassubtypesoldsosspathsislinksreadlinksbasenamesonamesappsFalsesdinstallsTruescan_unsget_iconsICON_SIZE_SMALLsiconsappendstiterssets_TNAMEs_COMMENTs get_comments_INSTALLs _UNINSTALLs_IS_OURSs_CURRENTs_ICON( sselfstitersoldsdinstallscan_unstnamesicons mime_typesoname((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys load_typesžs@        cCst|iiƒ}g}xT|oL|ii|tƒo |i|ii|tƒƒn|ii |ƒ}qW|SdS(s,Return list of types selected for installingN( sselfsmodelsget_iter_firststitersactives get_values_INSTALLsappends_TNAMEs iter_next(sselfsactivestiter((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys get_activeÈs cCsŠ|iiƒ}g}xj|ob|ii|tƒo|ii|tƒo |i|ii|t ƒƒn|ii |ƒ}qW|SdS(s.Return list of types selected for uninstallingN( sselfsmodelsget_iter_firststiters uninstalls get_values _UNINSTALLs_IS_OURSsappends_TNAMEs iter_next(sselfstiters uninstall((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys get_uninstallÓs, ( s__name__s __module__s__doc__sNonesTruesSITEs__init__sinstall_toggledsuninstall_toggleds load_typess get_actives get_uninstall(((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys InstallList)s Y  * cCsyygdkl}xS|iD]H}tii|ƒdjotSqtii|ƒdjotSqqWWnnXt SdS(sInternal function.(sbasediriN( szeroinstall.injectorsbasedirsxdg_cache_dirssdsroxsapp_dirsfindsTrues _roxlib_dirsFalse(sbasedirsd((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys_run_by_injectorÞs  cCs¾|dtiƒ}|o t|ƒoKt|dƒ}|i dƒ|i d|ƒ|i ƒti |dƒnti ||ƒti |tiƒoti|ƒnti||ƒdS(s!Internal function. Set one type.s.tmp%dsws #!/bin/sh s0launch -c "%s" "$@" iíN(spathsossgetpidstmpsinjints_run_by_injectorsapp_dirsfilesfswritescloseschmodssymlinksaccesssF_OKsremovesrename(spathsapp_dirsinjintstmpsf((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys _install_atïs  c Csot|ƒdjodSn| o ti}n|ddjotii|ƒ}nt|||||ƒ}|i ƒttiiƒjo|iƒdSnz½|iƒ}xO|D]G} ti| ƒ} tt|d| i| ifƒ}t|||ƒq¶W|iƒ}xL|D]D} ti| ƒ} tt|d| i| ifƒ}ti|ƒqWWd|iƒXdS(sEInternal function. Does the work of setting MIME-types or MIME-thumbiNis/s%s_%s( slenstypess applicationsroxsapp_dirsosspathsabspaths InstallListsdescsdirsinfoswinsrunsintsgsRESPONSE_ACCEPTsdestroys get_activestnamesmimeslookups mime_types save_pathsSITEsmediassubtypessnames _install_atsinjints get_uninstallsremove( stypessdirsdescs applications overwritesinfosinjintssnameswinstnames mime_type((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys_install_type_handlerÿs8      s…Run actions can be changed by selecting a file of the appropriate type in the Filer and selecting the menu option 'Set Run Action...'cCs&t|dtdƒ||t|ƒdS(s@Install application as the run action for 1 or more types. application should be the full path to the AppDir. If application is None then it is the running program which will be installed. If overwrite is False then existing run actions will not be changed. The user is asked to confirm the setting for each type.s MIME-typess run actionN(s_install_type_handlerstypess_s applications overwritesrun_action_msgsinjint(stypess applications overwritesinjint((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pysinstall_run_action&s cCs,t|dtdƒ||tdƒ|ƒdS(sIInstall application as the thumbnail handler for 1 or more types. application should be the full path to the AppDir. If application is None then it is the running program which will be installed. If overwrite is False then existing thumbnailerss will not be changed. The user is asked to confirm the setting for each type.s MIME-thumbsthumbnail handlersÑThumbnail handlers provide support for creating thumbnail images of types of file. The filer can generate thumbnails for most types of image (JPEG, PNG, etc.) but relies on helper applications for the others.N(s_install_type_handlerstypess_s applications overwritesinjint(stypess applications overwritesinjint((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pysinstall_thumbnailer1scCst|ƒdjodSn| o ti}n|ddjotii|ƒ}nt|t dƒd|t dƒdt ƒ}|i ƒt tiiƒjo|iƒdSn|iƒ}xR|D]J}ti|ƒ}ttd |i|if|iƒ}t|||ƒqÅW|iƒ}xO|D]G}ti|ƒ}ttd |i|if|iƒ}ti|ƒq&W|iƒdS( súInstall application in the SendTo menu for 1 or more types. application should be the full path to the AppDir. If application is None then it is the running program which will be installed. The user is asked to confirm the setting for each type.iNis/s type handlersSendTos“The application can handle files of these types. Click on OK to add it to the SendTo menu for the type of file, and also the customized File menu.schecks SendTo/.%s_%s( slenstypess applicationsroxsapp_dirsosspathsabspaths InstallLists_sFalseswinsrunsintsgsRESPONSE_ACCEPTsdestroys get_activestnamesmimeslookups mime_types save_pathsSITEsmediassubtypesanamessnames _install_atsinjints get_uninstallsremove(stypess applicationsinjintssnameswinstnames mime_type((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pysinstall_send_to_types<s8        cCsždk}tii|dƒ}|ii|ƒ}|i ƒ}|i ƒ}|p|o4t |||ƒt|||ƒt|||ƒntd|ƒ‚dS(s>Read the AppInfo file from the AppDir and perform the installations indicated. The elements to use are and , each containing a number of elements. appdir - Path to application (defaults to current app) injint - Zero install injector interface, or None if none Ns AppInfo.xmls>Internal error: No actions found in %s. Check your namespaces!(s rox.AppInfosroxsosspathsjoinsappdirs app_info_pathsAppInfosainfos getCanRunscan_runsgetCanThumbnails can_thumbnailsinstall_run_actionsinjintsinstall_thumbnailersinstall_send_to_typess Exception(sappdirsinjintscan_runsroxsainfos can_thumbnails app_info_path((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pysinstall_from_appinfohs   (s__doc__sossroxs_smimeschoicessbasedirsSITEs_TNAMEs_COMMENTs_CURRENTs_INSTALLs_ICONs _UNINSTALLs_IS_OURSs load_paths save_pathsDialogs InstallLists_run_by_injectors _install_atsNonesTrues_install_type_handlersrun_action_msgsinstall_run_actionsinstall_thumbnailersinstall_send_to_typessapp_dirsinstall_from_appinfo(s_COMMENTsroxs InstallLists_install_type_handlers_ICONs _UNINSTALLs_run_by_injectorsbasedirs load_paths_s save_pathsinstall_run_actionsinstall_send_to_typessrun_action_msgsSITEs _install_atsmimes_CURRENTs_IS_OURSs_TNAMEsinstall_from_appinfoschoicess_INSTALLsossinstall_thumbnailer((sZ/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/mime_handler.pys?s,   µ  &   ,