def Timer(*args, **kwargs):
return _Timer(*args, **kwargs)
def __set_alarm(self, delay):
# Pythons signal.alarm doesn't play well with raw_input() when
# connected to readline, so we must use threads instead
if self.__timer_wait is not None:
self.__timer_wait.cancel()
self.__timer_wait = threading.Timer(delay, self.__got_alarm)
self.__timer_wait.setDaemon(True)
src/c/e/cerebrum-HEAD/cerebrum/clients/examples/bofh.py cerebrum(Download)
def __set_alarm(self, delay):
# Pythons signal.alarm doesn't play well with raw_input() when
# connected to readline, so we must use threads instead
if self.__timer_wait is not None:
self.__timer_wait.cancel()
self.__timer_wait = threading.Timer(delay, self.__got_alarm)
self.__timer_wait.setDaemon(True)
src/p/y/python-drainers-HEAD/examples/simple_kill_sleep.py python-drainers(Download)
timed_out = True
# Start the timer to flip the flag
t = threading.Timer(3.0, time_out)
t.daemon = True
t.start()
src/p/y/python-drainers-HEAD/examples/simple_find.py python-drainers(Download)
def main(self, search_for):
d = drainers.Drainer(['find', '.', '-name', search_for],
read_event_cb=self.handle_line,
should_abort_cb=self.has_timed_out)
t = threading.Timer(10.0, self.time_out)
t.daemon = True
src/d/r/drainers-0.0.3/examples/simple_kill_sleep.py drainers(Download)
timed_out = True
# Start the timer to flip the flag
t = threading.Timer(3.0, time_out)
t.daemon = True
t.start()
src/d/r/drainers-0.0.3/examples/simple_find.py drainers(Download)
def main(self, search_for):
d = drainers.Drainer(['find', '.', '-name', search_for],
read_event_cb=self.handle_line,
should_abort_cb=self.has_timed_out)
t = threading.Timer(10.0, self.time_out)
t.daemon = True
src/c/o/confidentcaptcha-python-HEAD/sample.py confidentcaptcha-python(Download)
def open_browser():
print "Opening webbrowser at http://localhost:8001 ..."
webbrowser.open('http://localhost:8001')
t = threading.Timer(1.0, open_browser)
t.start()
httpd = make_server('', 8001, captcha_app)
src/u/l/ulissegames-HEAD/src/world.py ulissegames(Download)
from direct.fsm import FSM import random, sys, os, math from direct.showbase import Audio3DManager from threading import Timer from direct.gui.OnscreenText import OnscreenText from direct.gui.DirectGui import * from pandac.PandaModules import FontPool
self.soundfsm.playLevelCompleted()
tim=Timer(3.0,self.gamefsm.request, args=["GameOver",self.level+1])
self.timerItems.append(tim)
tim.start()
if(self.x < self.score_from_normal):
tim=Timer(0.2,self.countScore, args=[0])
self.timerItems.append(tim)
tim.start()
else:
if(self.x < self.score_from_mayor):
tim=Timer(0.2,self.countScore, args=[1])
self.timerItems.append(tim)
tim.start()
else:
if(self.x < self.score_from_dorothy):
tim=Timer(0.2,self.countScore, args=[2])
else:
self.x=-50
tim=Timer(0.2,self.countScore, args=[3])
self.timerItems.append(tim)
tim.start()
if(type==3):
self.total_score=self.score_from_normal+self.score_from_mayor+self.score_from_dorothy
tx = OnscreenText(text=(codecs.utf_8_encode("Total Score:.........."+str(self.total_score))[0]), fg=(1,0.7,0.4,1), scale = 0.12, pos=(0,-0.5),font=font, shadow= (0,0,0,1))
self.textItems.append(tx)
tim=Timer(4,self.clearScreenfromText)
def win_or_lose(self):
self.soundfsm.request('Stop')
if self.isCompleted():
if(self.final_level):
tim=Timer(5,self.playFinalVideo, args=[0])
else:
tim=Timer(5,self.levelCompleted, args=[])
else:
tim=Timer(5,self.playFinalVideo, args=[1])
self.level+=1
else:
self.level=3
tim=Timer(10.0,self.gamefsm.request, args=["GameOver", self.level])
self.timerItems.append(tim)
tim.start()
if (self.world.owned_bars_weak % 3 ==2):
self.icon = OnscreenImage(image = 'icons/Mayor_Happy.jpg', pos = (-1.2,0,-0.8), scale=0.15)
self.world.iconItems.append(self.icon)
self.tim=Timer(2,self.icon.destroy)
self.tim.start()
self.world.timerItems.append(self.tim)
self.world.soundfsm.playYeah()
if (self.world.owned_bars_fresh % 3 ==2):
self.icon = OnscreenImage(image = 'icons/Mayor_Happy.jpg', pos = (-1.2,0,-0.8), scale=0.15)
self.world.iconItems.append(self.icon)
self.tim=Timer(2,self.icon.destroy)
self.tim.start()
self.world.timerItems.append(self.tim)
self.world.soundfsm.playYuhu()
self.world.textItems.append(self.tx)
t-=1
if(t >= 0):
tim=Timer(1.0,countdown, args=[t,p])
self.world.timerItems.append(tim)
tim.start()
else:
def enterExplode(self):
if(self.exploded==False):
self.house.pose("Break",5)
if (self.dorothy==True):
self.icon = OnscreenImage(image = 'icons/Dorothy_Sad.jpg', pos = (-1.2,0,-0.4), scale=0.15)
self.world.iconItems.append(self.icon)
self.tim=Timer(2,self.icon.destroy)
self.tim.start()
self.world.timerItems.append(self.tim)
self.world.soundfsm.playAhh()
elif (self.mayor==True):
self.icon = OnscreenImage(image = 'icons/Mayor_Sad.jpg', pos = (-1.2,0,-0.8), scale=0.15)
self.world.iconItems.append(self.icon)
self.tim=Timer(2,self.icon.destroy)
else:
self.icon = OnscreenImage(image = 'icons/Woody_Sad.jpg', pos = (-1.2,0,0), scale=0.15)
self.world.iconItems.append(self.icon)
self.tim=Timer(2,self.icon.destroy)
self.tim.start()
self.world.timerItems.append(self.tim)
self.world.soundfsm.playOh_no()
src/n/e/NeuBot-HEAD/controllers/eventcontroller.py NeuBot(Download)
raise Exception("Only class methods can be registered as timer callbacks")
# Create timer object with associated data
timer = threading.Timer(interval, do_timeout, kwargs = {"data": data})
# Insert timer in list of active timers
if not self.moduleTimers.has_key(callback.im_self):
src/y/a/yac163-HEAD/trunk/yac163-nox/Pic.py yac163(Download)
import tempfile import urlparse import string from threading import Timer import thread import signal
sys.stdout.write("\r%3d%% %s" % (portion*100,"#"*int(portion*50)))
sys.stdout.flush()
read_buffer = ""
t = Timer(10,check,args=[read_buffer])
try:
t.start()
read_buffer = fh.read(buffer_size)
data+=read_buffer
portion = float(len(data))/total_size
read_buffer=""
t = Timer(10,check,args=[read_buffer])
try:
t.start()
read_buffer = fh.read(buffer_size)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next