;ò ;Bc@sÕdZdZdkZdkZdkZdkZdkTdklZl Z l Z l Z dk l Z lZdfd„ƒYZdfd„ƒYZd fd „ƒYZd Zd e fd „ƒYZdfd„ƒYZdS(iN(s*(s load_imagesMyErrors import_modules trace_error(sCPSpritesCPinitsImgcBstZdZRS(s! Container to store image objects(s__name__s __module__s__doc__(((s./lib/soundmemory.pysImg s sSndcBstZdZRS(s! Container to store sound objects(s__name__s __module__s__doc__(((s./lib/soundmemory.pysSnd#s sMisccBstZdZRS(s% Container to store all kind of stuff(s__name__s __module__s__doc__(((s./lib/soundmemory.pysMisc&s sÍIt seems that we cannot use the sound card right now and because this game is all about sound, we just quit. This problem can also be caused by another application which uses the soundcard right now.sSndButcBs;tZeZd„Zd„Zd„Zd„Zd„ZRS(NcCscti|ƒ||_|iiƒ|_|iiƒi|ƒ|_ d|_ |i |i tƒdS(Ni(sCPSprites__init__sselfssndsimgsconvertsimagesget_rectsmovespossrectshighsconnect_callbackson_select_buttonsMOUSEBUTTONDOWN(sselfssndspos((s./lib/soundmemory.pys__init__1s    cCs|iiƒdS(N(sselfssndsplay(sself((s./lib/soundmemory.pysplay:scCsg|io|i|_d|_n|i|_d|_tii|i|iƒ}t i i |ƒdS(Nii( sselfshighsimgsimagesimg_highsImgsscreensblitsrectsrspygamesdisplaysupdate(sselfsr((s./lib/soundmemory.pys highlight=s     cGsdS(sg This is called when there's no callback function registered with the connect_callback method.N((sselfsargs((s./lib/soundmemory.pys on_updateGscGsõtodG|G|G|GHnti o%|iƒ|iƒ|t_dSn|itiijodSn|iƒ|iƒt i i dƒtii |i jo-tii ƒ|i ƒtt_dt_n!tiiƒ|iƒtt_dS(sþ This is a callback function used by a CPSprite object, like the callback fuctions in gtk++. A callback function must be connected to the object with a call to the connect_callback method. When this fuction is called by the class it is called with a tuple of arguments. This tuple consist of: 0 - a reference to the connected object. 1 - the event that triggers this call. 2 .. - data which where passed to the connect call. s obj,event,*argsNiÜi(sDEBUGsobjseventsargssSndButsSelectedsplays highlightsrectspygamestimeswaitssnds remove_spritesNonesMiscsscore(sobjseventsargs((s./lib/soundmemory.pyson_select_buttonLs*             ( s__name__s __module__sNonesSelecteds__init__splays highlights on_updateson_select_button(((s./lib/soundmemory.pysSndBut/s   sGamecBsMtZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(s_ soundmemory.py - part of childsplay.py, a suite of educational games for young children. c Cs||_||_ttii|ddƒƒ} t i ddfƒi ƒ}xMt dddƒD]9} x0t dddƒD]} |i| | | fƒqwWq^Wt ii|dddf|iƒd ƒ||_ |it_|it_||_||_||_y dk}Wn=ttfj o+} ti| Id IJd }t|‚nX|iƒ|_ |i i!d ƒ|iƒ|_"|i"i!d ƒddddfddddfddddfdd ddfg|_#t$g|_%t&|i|iƒ|_'|i(ƒdS(Ns SoundMemorys but_back.pngiiÔiiiiis3 This version of childsplay depends on pyassetmlSDLs*Module memory fails to import pyassetmlSDLs*childsplay/sounds-misc/sounds-misc.assetmls6childsplay/childsplay-sounds/childsplay-sounds.assetmliiiÈidii´i<i2i()sscreensselfsbackgrs load_imagesosspathsjoinslibdirsback_imgspygamesSurfacesconvertsssrangesysxsblitsdrawsrectsget_rectsImgsrc_dicsbasepathsbasedirs pyassetmlSDLs ImportErrorsMyErrorsinfossyssstderrstexts AssetmlSDLs Assets_snds set_mldirs Assets_cpsnds gamelevelssNones gameitemssCPinitsgroups_setup( sselfsscreensbackgrsrc_dicsbasepathslibdirs pyassetmlSDLstextsssinfosback_imgsysx((s./lib/soundmemory.pys__init__rs<  (       E cCsetƒ|_tƒ|_df}|ii|ƒ}y|i ƒ}Wn1t j o%}t idI|IJt|‚nXtodG|GdG|GHntiiƒ o"t|ƒt_tt_t‚nt|ƒdjot idIJt|‚n||_todG|iGHnttii|idd ƒd ƒt_ ttii|idd ƒd ƒt_!dS( Ns*.oggsCan't find soundssdictionary from assetmlSDLs/nvalues from dict i s,Not enough sounds found, must be at least 12s snd_objectss SoundMemorysbut_bleu_up.pngisbut_red_down.png("sSndsselfsSoundsImgsImagesfiless Assets_snds get_assetssdsvaluessobjectssAttributeErrorsinfossyssstderrsMyErrorsDEBUGspygamesmixersget_initsstrsnames NOSOUNDTXTsextraslens snd_objectss load_imagesosspathsjoinslibdirsSndButsimgsimg_high(sselfsfilessinfosdsobjects((s./lib/soundmemory.pys_setup–s.        'cCs8|ii|iddfƒ|ii|iddfƒtiiƒdt_ dt_ |\}}} }tiiƒd} tiiƒd} ti|iƒ||d}|i| d}ti|ƒxft|ƒD]X} xOt|ƒD]A} t|iƒ| | | || | fƒ}|i i!|ƒqëWqØWdS(sHit the buttons and find pairsiiiN("sselfsscreensblitsssbackgrspygamesdisplaysupdatesMiscsstopsscoreslsrscsxoffsetsyoffsetsSndButsimgs get_widthsx_offsets get_heightsy_offsetsrandomsshuffles snd_objectssnumsobjectssrangesysxspopsobjsgroupsadd(sselfslsspamscsnumsobjsobjectssyoffsetsrsx_offsetsysxsxoffsetsy_offset((s./lib/soundmemory.pysstart¶s&      +cCsßtdf\}t_x)|D]!}|itjo |}PqqWy*|i i |ƒ}|o dG|GHnWnt ƒGHt ‚nX|i iƒ odt_dt_ntotiodGtiGHntitifSdS(Nisreturn from refreshiÿÿÿÿids self.score(sNonesitemsMiscsscoreseventsseventstypesMOUSEBUTTONDOWNsselfsgroupsrefreshsvs trace_errorsMyErrorsspritessstopsDEBUG(sselfseventsseventsitemsv((s./lib/soundmemory.pysloopÑs&    cCsdSdS(sxMust return the original, not translated, title of this game. It's needed by the high score class of childsplay.s SoundmemoryN((sself((s./lib/soundmemory.pys__str__æscCsdSdS(Ns Soundmemory((sself((s./lib/soundmemory.pys helptitleëscCs8tdƒtdƒdtdƒdtdƒg}|SdS(NsThe aim of the game:s;Classic memory game where you have to find pairs of sounds.s sDifficulty : 2-5 yearssNumber of levels : 4(s_stext(sselfstext((s./lib/soundmemory.pyshelpîs0( s__name__s __module__s__doc__s__init__s_setupsstartsloops__str__s helptitleshelp(((s./lib/soundmemory.pysGamens  $    (sDEBUGsRCFILEsosssyssrandomspygamespygame.constantssutilss load_imagesMyErrors import_modules trace_errors SpriteUtilssCPSpritesCPinitsImgsSndsMiscs NOSOUNDTXTsSndButsGame(s load_imagesCPinitsSndsMyErrorsImgsrandomsMiscsCPSpritessyssGames NOSOUNDTXTspygames trace_errorsDEBUGs import_modulesossRCFILEsSndBut((s./lib/soundmemory.pys?s ?