当前位置: 首页>>代码示例>>Python>>正文


Python Scheduler.llamar方法代码示例

本文整理汇总了Python中scheduler.Scheduler.llamar方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.llamar方法的具体用法?Python Scheduler.llamar怎么用?Python Scheduler.llamar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scheduler.Scheduler的用法示例。


在下文中一共展示了Scheduler.llamar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import llamar [as 别名]
class Kernel:

	def __init__(self):
		self.scheduler = Scheduler()
		self.running = True
		self.topActive = False

	def run(self,backend_conn,connQueue):
		self.i=0
		while self.running:
			#print str(self.i)
			self.scheduler.run(self.i)
			
			if(self.scheduler.getAskingForInput() ):
				self.scheduler.setWaitingForInput(True)

			if(self.scheduler.getWaitingForInput()):
				backend_conn.send("readyForInput")
				self.scheduler.setWaitingForInput(False)
				self.scheduler.setAskingForInput(False)
				self.scheduler.setWritingInput(True)

			if ( self.scheduler.getEnableInput() ):
				backend_conn.send("enable_input")
				self.scheduler.setEnableInput(False)


			self.checkInput(self.i,connQueue)
			self.i += 1

			if(self.topActive == True):
				self.top()
			
			time.sleep(1)

	def checkInput(self,time, connQueue):
		try:
			input = connQueue.get_nowait()
		except Exception:
			return

		if(input != None):
			if(input == "read"):
				self.readFile(time)
			elif(input == "top"):
				self.topActive = True
			elif(input == "terminateTop"):
				self.topActive = False
			elif(input == "contact_list"):
				self.readContactList(time)
			elif(input == "new_contact"):
				self.newContact(time)
			elif(input == "hacer_llamada"):
				self.hacerLlamada(time)
			elif( input.startswith("new_contact_input") ):
				split = input.split(";")
				contactName =  split[1].rstrip('\r\n')
				contactNumber = split[2].rstrip('\r\n')
				self.scheduler.newContactInput(time,contactName,contactNumber)
			elif(input == "calls_history"):
				self.callsHistory()
			elif(input == "messages_history"):
				self.messagesHistory()
			elif(input.startswith('hllamada_input')):
				split = input.split(';')
				numero = split[1]
				tejec = int(split[2])
				self.scheduler.llamar(time,numero,tejec)
			elif(input.startswith('emsje')):
				split = input.split(';')
				numero = split [1]
				mensaje = split [2]
				self.scheduler.mensaje(time,numero,mensaje)
			elif(input == "quit" ):
				self.running = False
			elif(input == "enviar_msje"):
				self.enviarMsje(time)
	def enviarMsje(self,time):
		print "Waiting to run send msg..."
		process = sendMessage("enviar_msje",0,"","")
		self.scheduler.schedule(time,process,1)

				
	def hacerLlamada(self,time):
		print "Waiting to run make call..."
		processl = Llamar('hacer_llamada',0,"")
		self.scheduler.schedule(time, processl,1)

	def newContact(self,time):
		print "Wating to run new contact ..."
		
		# 1 default priority
		process = StoreContact ( 1 , "nuevo_contacto" , "" , "" )
		# 0 delay
		self.scheduler.schedule(time,process,1)

	def top(self):
		os.system('cls' if os.name=='nt' else 'clear')
		print self.scheduler.printProcesses(self.i)

#.........这里部分代码省略.........
开发者ID:agrass,项目名称:IIC2333-,代码行数:103,代码来源:kernel.py


注:本文中的scheduler.Scheduler.llamar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。