; κDc@sdkZdkZdkZdkZdkZdklZdkZdkZea dZ dZ dZ dfdYZ eadZdad Zd fd YZd fd YZdS(N(stkintercCs"ttjo tantSdS(s|Retrieve the eventhandler. No arguments. Returns: Throws: nothing N(s _evhandlersNones _EventHandler(((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pysGetEventHandler3s   cCst}|i|dS(s4Sets up the event handler to use Tkinter's mainloop. TOP = Returns: void Throws: nothing Call this when you want to use the event handler in a program that uses Tkinter. The argument is expected to be the object that's returned by a call to Tkinter.Tk(). N(sGetEventHandlers evhandlers _SetStateTkstop(stops evhandler((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pysSetEventHandlerStateTkAs  cCst}|idS(sSets up the event handler to use its own mainloop. This is the default. No arguments Returns: void Throws: nothing N(sGetEventHandlers evhandlers_SetStateStandAlone(s evhandler((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pysSetEventHandlerStateStandalonePs s EVCallbackcBs)tZdZdZdZdZRS(smThis class is intended to be used by the _EventHandler class. It differs from erl_common.VCallback in that it does not tack on any extra arguments to the front. This is because tkinter sends some extra arguments to the callback, so the arguments to callbacks would have been depended on whether the event handler is in tkinter-state or not. cCs||_||_||_dS(N(scallbacksselfsoptArgss namedArgs(sselfscallbacksoptArgss namedArgs((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys__init__fs  cGsRyt|i|i|iSWn.tj o nd|iGHnXdS(NsError in EVCallback %s(sapplysselfscallbacksoptArgss namedArgssKeyboardInterrupts__repr__(sselfs extraArgs((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys__call__kscCsd|i SdS(Ns(sselfscallback(sself((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys__repr__ts(s__name__s __module__s__doc__s__init__s__call__s__repr__(((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys EVCallback^s   cCs(ttjotiiantSdS(N(s_tksNonesTkintersFramestk(((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys_GetTkxs icCst}tda|SdS(Ni(s _nextTimerIds idToReturn(s idToReturn((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys GetNewTimerIds s _TimerEventcBstZdZdZRS(NcCs8ti|_t|_|i||_||_dS(N(stimesselfs addedWhens GetNewTimerIdsidstimeLefts timeOutTimescb(sselfstimeLeftscb((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys__init__s cCs>|i|ijodSn |i|ijodSndSdS(Niii(sselfs timeOutTimesother(sselfsother((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys__cmp__s (s__name__s __module__s__init__s__cmp__(((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys _TimerEvents s _EventHandlercBstZdZdZdZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZRS(NiiicCs=h|_h|_h|_g|_|i|_t|_dS(N( sselfs readEventss writeEventss exceptEventss timerEventssSTATE_STANDALONEsstatesNones tkTopLevel(sself((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys__init__s      cCs|i|_||_dS(s{State that we are using eventhandler in Tkinter. Note: When using the Tkinter eventhandler, you cannot delete timer-events.N(sselfsSTATE_TKsstatestopLevels tkTopLevel(sselfstopLevel((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys _SetStateTks cCs|i|_dS(s4State that we are implementing our own eventhandler.N(sselfsSTATE_STANDALONEsstate(sself((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pysSetStateStandAlonescOst|||}|ii|o|i|}ng}|i ||}||i|<|i |i jo|i|i|ndS(sRegister a callback to be called when there's data to read on a connection. Or really, push the the callback onto the stack of read-callbacks for the connection. Only the first callback on the stack is called. CONNECTION = CB-FUNCTION = OPT-ARG ... = NAMED-ARG ... = Returns: void Throws: nothing N(s EVCallbacks cbfunctionsoptArgss namedArgsscbsselfs readEventsshas_keys connectionshandlerss _PushHandlers newHandlerssstatesSTATE_TKs_TkPushFileHandlersREAD(sselfs connections cbfunctionsoptArgss namedArgss newHandlersshandlersscb((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys PushReadEvents  cCsx|i|}|i|}t|djo|i|=n||i|<|i|ijo|i |i |ndS(sUnregister a read callback for a connection. Or really, pop it from the stack of callbacks. CONNECTION = Returns: void Throws: nothing iN( sselfs readEventss connectionshandlerss _PopHandlers newHandlersslensstatesSTATE_TKs_TkPopFileHandlersREAD(sselfs connections newHandlersshandlers((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys PopReadEvents  cOst|||}|ii|o|i|}ng}|i ||}||i|<|i |i jo|i|i|ndS(sRegister a callback to be called when there's data to write to a connection. Or really, push the the callback onto the stack of write-callbacks for the connection. Only the first callback on the stack is called. CONNECTION = CB-FUNCTION = OPT-ARG ... = NAMED-ARG ... = Returns: void Throws: nothing N(s EVCallbacks cbfunctionsoptArgss namedArgsscbsselfs writeEventsshas_keys connectionshandlerss _PushHandlers newHandlerssstatesSTATE_TKs_TkPushFileHandlersWRITE(sselfs connections cbfunctionsoptArgss namedArgss newHandlersshandlersscb((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pysPushWriteEvents  cCsx|i|}|i|}t|djo|i|=n||i|<|i|ijo|i |i |ndS(sUnregister a write callback for a connection. Or really, pop it from the stack of callbacks. CONNECTION = Returns: void Throws: nothing iN( sselfs writeEventss connectionshandlerss _PopHandlers newHandlersslensstatesSTATE_TKs_TkPopFileHandlersWRITE(sselfs connections newHandlersshandlers((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys PopWriteEvents  cOst|||}|ii|o|i|}ng}|i ||}||i|<|i |i jo|i|i|ndS(sRegister a callback to be called when there's an exception on a connection. Or really, push the the callback onto the stack of exception-callbacks for the connection. Only the first callback on the stack is called. CONNECTION = CB-FUNCTION = OPT-ARG ... = NAMED-ARG ... = Returns: void Throws: nothing N(s EVCallbacks cbfunctionsoptArgss namedArgsscbsselfs exceptEventsshas_keys connectionshandlerss _PushHandlers newHandlerssstatesSTATE_TKs_TkPushFileHandlersEXCEPT(sselfs connections cbfunctionsoptArgss namedArgss newHandlersshandlersscb((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pysPushExceptEvents  cCsx|i|}|i|}t|djo|i|=n||i|<|i|ijo|i |i |ndS(sUnregister an exception callback for a connection. Or really, pop it from the stack of callbacks. CONNECTION = Returns: void Throws: nothing iN( sselfs exceptEventss connectionshandlerss _PopHandlers newHandlersslensstatesSTATE_TKs_TkPopFileHandlersEXCEPT(sselfs connections newHandlersshandlers((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pysPopExceptEvent&s  cOst|||}|i|ijo7t||}|i i ||i i |iSn;|i|ijo'titt|d|SndS(szRegister a callback to be called after a certain amount of time. TIME-LEFT = integer | float Timeout (in seconds) for the timer CB-FUNCTION = OPT-ARG ... = NAMED-ARG ... = Returns: timer-id Throws: nothing iN(s EVCallbacks cbfunctionsoptArgss namedArgsscbsselfsstatesSTATE_STANDALONEs _TimerEventstimeLefts newTimerEvents timerEventssappendssortsidsSTATE_TKs_GetTkscreatetimerhandlersintsround(sselfstimeLefts cbfunctionsoptArgss namedArgss newTimerEventscb((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys AddTimerEvent9s   cCs|i|ijo dnt}tttt|i|i}x/|D]'\}}|i |jo |}PqNqNW|tjo|i|=ndS(sUnregister a timer callback. TIMER-ID = timer-id Returns: nothing Throws: "Cannot delete timer events when using tk" Note that it is not possible to unregister timer events when using Tk. s(Cannot delete timer events when using tkN( sselfsstatesSTATE_TKsNones indexForIdsmapsrangeslens timerEventssitsisevsid(sselfsidsisits indexForIdsev((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys DelTimerEventNs  $   cCsF|i|ijo|in"|i|ijo|indS(sgStart the event handler. No arguments: Returns: void Throws: nothing N(sselfsstatesSTATE_TKs_EventHandler__LoopTksSTATE_STANDALONEs_EventHandler__LoopStandalone(sself((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pysLoopds cCs|iidS(N(sselfs tkTopLevelsmainloop(sself((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys__LoopTkqscCs8d|_x(|io|ii}|ii}|ii}t }t |i djo*|i d} ti}| i|}n|t jody"ti|||\}}} WqDtij o,}|\}} |djoq qqDXnK|djogggf\}}} n"ti||||\}}} x&|D]}|i|d}|qKWx&|D]}|i|d}|qtWx&| D]} |i| d}|qWxmnoettid|i } t | djoPnx(| D] }|i|i |i!qWqWq WdS(NiiicCs |i|jS(N(sevs timeOutTimesnow(sevsnow((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pyss("sselfscontinueLoopings readEventsskeyssrLists writeEventsswLists exceptEventsseListsNonestimeoutslens timerEventss firstTimerEvstimesnows timeOutTimesselectsreadsswritessexceptsserrorsinfoserrnoserrTextsreadablescbswritables exceptablesfilters expiredTimerss expiredTimers DelTimerEventsid(sselfscbswritablesreadss expiredTimersrListseListserrnosreadables expiredTimerssexceptsserrTexts exceptables firstTimerEvsnowsinfostimeoutswritesswList((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys__LoopStandalonetsZ     "         cCs d|_dS(sStart the event handler. No arguments: Returns: void Throws: nothing This can use in e.g. callbacks to stop the event handler loop.iN(sselfscontinueLooping(sself((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys StopLoopingscCs|g|SdS(N(scbshandlers(sselfscbshandlers((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys _PushHandlerscCs |dSdS(Ni(shandlers(sselfshandlers((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys _PopHandlerscCs|i}||ijo.|i|d}ti |t i |n}||i jo.|i |d}ti |t i|n?||ijo.|i|d}ti |t i|ndS(Ni(s connectionsfilenosfileNums eventTypesselfsREADs readEventsscbs_GetTkscreatefilehandlerstkintersREADABLEsWRITEs writeEventssWRITABLEsEXCEPTs exceptEventss EXCEPTION(sselfs eventTypes connectionscbsfileNum((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys_TkPushFileHandlers cCs|i}ti||ii|o.|i|d}ti |t i |n|i i|o.|i |d}ti |t i |n|ii|o.|i|d}ti |t i|ndS(Ni(s connectionsfilenosfileNums_GetTksdeletefilehandlersselfs readEventsshas_keyscbscreatefilehandlerstkintersREADABLEs writeEventssWRITABLEs exceptEventss EXCEPTION(sselfs eventTypes connectionscbsfileNum((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys_TkPopFileHandlers (s__name__s __module__sSTATE_STANDALONEsSTATE_TKsREADsWRITEsEXCEPTs__init__s _SetStateTksSetStateStandAlones PushReadEvents PopReadEventsPushWriteEvents PopWriteEventsPushExceptEventsPopExceptEvents AddTimerEvents DelTimerEventsLoops_EventHandler__LoopTks_EventHandler__LoopStandalones StopLoopings _PushHandlers _PopHandlers_TkPushFileHandlers_TkPopFileHandler(((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys _EventHandlers0             @   (sosssyssstringsselectstimesTkinterstkinters erl_commonsNones _evhandlersGetEventHandlersSetEventHandlerStateTksSetEventHandlerStateStandalones EVCallbacks_tks_GetTks _nextTimerIds GetNewTimerIds _TimerEvents _EventHandler(stkintersstrings EVCallbacksSetEventHandlerStateStandalonesSetEventHandlerStateTksGetEventHandlers_GetTks _TimerEventssyss _EventHandlerstimesTkinters erl_commonsossselects GetNewTimerId((sT/mnt/gmirror/ports/devel/py_otp_interface/work/py_interface-0.93/erl_eventhandler.pys?#s$