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


Python Loader.loadFile方法代码示例

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


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

示例1: DcFrame

# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import loadFile [as 别名]

#.........这里部分代码省略.........

		self.players = self.res.LoadFrame(None, 'PlayersView')
		self.players.setConf(self.conf)
		self.players.Show(True)
	
	def explore_geo(self, evt):
		pass
		#find all planets which fit requirements of explorables
	
	def upload(self, _):
		
		#swap with empty value, to assure newly added commands will not interfere with sending ones
		tmp = {}
		tmp, self.requeusts_queue = self.requeusts_queue, tmp
		for user_id, actions in tmp.items():
			log.debug('request to send actions from user %d'%(user_id,))
			asyncLoader = AsyncLoader(self, self.conf)
			req = request.RequestMaker()
			for unit_id, action_id in actions:
				log.debug('store action %d %d'%(unit_id,action_id))
				req.store_action( unit_id, action_id)
			
			uname = self.db.get_login(user_id)
			log.debug('send actions %s for user %s'%(req, uname))
			asyncLoader.recvActionsReply( (uname,self.conf.users[uname]), req, self.conf.pathOut)
			asyncLoader.start()
	

	def test_action(self):
		'send all fleets of single acc to a specific pos'
		import request
		req = request.RequestMaker()
		
		l = ''
		player = self.db.getPlayerByLogin(l)
		log.debug('got player %s %s'%(player.id, player.login))
		go_to = (1, 1)
		for pos,id,name,arrival,from_p in self.db.getUserFleets(player.id):
			#log.debug('got fleet %s'%(pos, id, name,,))
			if go_to == pos:
				log.debug('fleet %s is already on destination point'%(name,))
				continue
			if arrival:
				log.debug('fleet %s is flying to %s, arrives at: %d'%(name,pos,arrival))
				continue
			log.info('moving fleet %s standing at %s'%(name, pos))
			req.fleetMove(id, go_to)
		
		p = self.conf.users[l]
		asyncLoader.recvActionsReply((l,p), req, '/tmp/dclord/out')
				
		asyncLoader.start()

	def sync(self, event):
		self.syncMenu.Enable(False)

		asyncLoader = AsyncLoader(self, self.conf)
			
		#req.store_action(16569557, 102)
		
		#req.createNewFleet( '822:978', 'client_generated_16429601')
		#reply <act id="ActionID" result="ok" return-id="fleet_id"/>
		
		for login in self.conf.users.items():
			asyncLoader.recvUserInfo(login, 'all', self.conf.pathArchive)
			asyncLoader.recvUserInfo(login, 'known_planets', self.conf.pathArchive)
		asyncLoader.start()
	
	def objectFocus(self, event):
		pos = event.attr1

		self.status.SetStatusText(str(pos))
		pl,fleets = event.attr2
		
		self.propPlanet.set(pl)
		self.propFleet.set(fleets)
	
	def report(self, event):
		self.status.SetStatusText(event.attr2)
		self.messages.addEvent(event.attr2)
		
	def fileLoad(self, event):
		if not event.attr1:
			self.messages.addEvent('file %s loaded'%(event.attr2,))
			if 'static.zip' == os.path.basename(event.attr2):
				self.conf.unpackStatic()
				return
			
			self.loader.loadFile(event.attr2)
			#self.map.update()
			self.tasks.update()
			return
		
		#all files loaded(or not)
		self.syncMenu.Enable(True)
		
		self.SetStatusText('sync finished')
	
	def setMapPos(self, evt):
		self.map.centerAt(evt.attr1)
开发者ID:bogolt,项目名称:dclord,代码行数:104,代码来源:dclord.py


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