コード例 #1
0
def layout(cell,extra_params=None):
   context.push()
   loadcell(cell)
   global pcell_updates
   for name,value in pcell_updates:
      context.bag[name]['value'] = value
      run(context.props['cbs'][name])
   pcell_updates = []

   #Must be called after pcell updates
   apply_params()

   if extra_params:
      assert(isinstance(extra_params,list))
      for t in extra_params:
         context.params[t[0]] = t[2]

   print "inst params: " + str(context.params)


   p = pickle.dumps(frozenset(context.params.items()))
   h = hashlib.md5(p).hexdigest()
   cell_name = current_cell['cell_name'] + "@" + h[:10]
   
   if cell_name in cell_lib:
     context.pop()
     return cell_lib[cell_name]
   runtime.push_cell(cell_name)
   print skill.procedures[current_cell['func']]({'parameters' : context.params, 'lib' : {'name' : skill.variables['cdfgData']['id']['lib']['name']} , 'cell' : {'name' : skill.variables['cdfgData']['id']['cell']['name']}} )
   context.pop()
   cell_lib[cell_name] = runtime.pop_cell()
   return cell_lib[cell_name]
コード例 #2
0
ファイル: menu.py プロジェクト: pombredanne/Obb
	def finish(self):
		newres = not self.resbuttons.buttonmap[settings.size].selected
		newwin = not self.wbuttons.buttonmap[settings.fullscreen].selected
		for buttonset in self.buttonsets:
			for button in buttonset.buttons:
				if button.selected:
					button.confirm()
		context.pop()
		settings.save()
		settings.load()
		if newres or newwin:
			vista.init()
コード例 #3
0
ファイル: makemap.py プロジェクト: pombredanne/Obb
	def think(self, dt, events, keys, mousepos, buttons):
		if self.active:
			self.cloudticker = min(self.cloudticker + dt, 0.25)
		else:
			self.cloudticker = max(self.cloudticker - dt, 0)
			if not self.cloudticker:
				self.restorestate()
				context.pop()
		
		if self.drawn and self.active:
			self.makeit()
			self.active = False
コード例 #4
0
ファイル: restart.py プロジェクト: pombredanne/Obb
	def think(self, dt, events, keys, mousepos, buttons):
		if self.active:
			self.cloudticker = min(self.cloudticker + dt, 0.25)
		else:
			self.cloudticker = max(self.cloudticker - dt, 0)
			if not self.cloudticker:
				context.pop()
				if self.torestart:
					game.restart()
		
		if self.cloudticker == 0.25 and self.active:
			for event in events:
				if event.type == pygame.KEYUP:
					self.active = False
					self.torestart = event.key == pygame.K_y
コード例 #5
0
ファイル: menu.py プロジェクト: pombredanne/Obb
	def quitgame(self):
		context.pop(2)
		context.push(self)
		self.active = False        
コード例 #6
0
ファイル: syntax.py プロジェクト: bruceg/bglibs
	def execute(self, context):
		context.push()
		dict = context.eval(self.expr)
		context.update(dict)
		self.body.execute(context)
		context.pop()