;ò òiýDc@sƒdkTdkZd„Zd„Zd„Zd„Zd„Zd„Zdfd „ƒYZd fd „ƒYZ d fd „ƒYZ dS((s*NcCs8dk}|iitdjo tidptƒSdS(sA Returns the path to the directory containint Gato.py or Gred.py Ns__main__i(sosspathsdirnames__name__ssyssargvs__file__(sos((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pysgatoPath(s cCs'dk}|it|ƒdƒdSdS(s* Return ext if path/filename.ext is given Ns.iÿÿÿÿ(sstringssplits stripPaths pathAndFile(s pathAndFilesstring((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys extension-s cCs!dk}|ii|ƒdSdS(s3 Return filename.ext if path/filename.ext is given Ni(sosspathssplits pathAndFile(s pathAndFilesos((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys stripPath2s cCskdkl}|\}}||d|dƒ}|djo d}n||}||}| |fSdS(sr Return a unit length vector (v1,v2) which has an angle of 90 degrees clockwise to the vector u = (u1,u2) (ssqrtif0.001N(smathssqrtsusu1su2slength(susu1slengthssqrtsu2((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys orthogonal7s      cCsmt|ƒdjo||d}|d}nx3|D]+}|||jo||}|}q6q6W|SdS(s; Returns the element e of list for which val[e] is minimal iN(slenslistsvalsminsminElemse(slistsvalsesminsminElem((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pysArgMinDs cCsmt|ƒdjo||d}|d}nx3|D]+}|||jo||}|}q6q6W|SdS(s; Returns the element e of list for which val[e] is maximal iN(slenslistsvalsmaxsmaxElemse(slistsvalsesmaxsmaxElem((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pysArgMaxPs s MethodLoggercBs)tZdZd„Zd„Zd„ZRS(s Provide logging of method calls with parameters E.g., for regression testing XXX specify output channel (or do it via redirect ?) cCs ||_dS(N(sobjectsself(sselfsobject((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys__init__cscCs/||_t|i|ƒ|_t|dƒSdS(Nscaller(sargsselfs methodNamesgetattrsobjectsmethod(sselfsarg((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys __getattr__fs cGs(|iGdG|GdGHt|i|ƒSdS(Ns(s)(sselfs methodNamesargssapplysmethod(sselfsargs((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pyscallerks(s__name__s __module__s__doc__s__init__s __getattr__scaller(((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys MethodLogger\s   sTimedMethodLoggercBs2tZdZd„Zd„Zd„Zd„ZRS(s Provide logging of method calls with parameters E.g., for regression testing XXX specify output channel (or do it via redirect ?) cCs@||_g|_ddg|_hdd<dd<|_dS(Ns SetEdgeColorsSetVertexColorii(sobjectsselfs tml_callsstml_log_method_namesstml_log_method_argnr(sselfsobject((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys__init__xs  cCs/||_t|i|ƒ|_t|dƒSdS(Nscaller(sargsselfs methodNamesgetattrsobjectsmethod(sselfsarg((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys __getattr__€s cGs~|i|ijoW|i|i}|iitiƒ|it|d|!ƒf||ƒ|idGHnt |i |ƒSdS(Niiÿÿÿÿ( sselfs methodNamestml_log_method_namesstml_log_method_argnrsis tml_callssappendstimestuplesargssapplysmethod(sselfsargssi((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pyscaller…s 7cCs |iSdS(N(sselfs tml_calls(sself((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pysgetLogŒs(s__name__s __module__s__doc__s__init__s __getattr__scallersgetLog(((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pysTimedMethodLoggerqs    s ImageCachecBs/tZdZeZd„Zd„Zd„ZRS(sb Provides a global cache for PhotoImages displayed in the application. Singleton Pattern cCs!titjo ht_ndS(N(s ImageCachesimagessNone(sself((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys__init__–scCs„y?||iiƒjotd|ƒti|tj o2}dk}|i dƒ}|i d|ƒnXdS(sY Given a relative URL to an image file return the corresponding PhotoImage. sfileNs GatoUtil.pysError finding image %s( srelURLsselfsimagesskeyss PhotoImages ImageCaches IndexErrorsIOErrorsloggings getLoggerslogs exception(sselfsrelURLsloggingsIOErrorslog((s5/mnt/gmirror/ports/math/py-gato/work/Gato/GatoUtil.pys __getitem__šs cCstd|ƒti|