comparison engine/extensions/serializers/xmlanimation.py @ 129:9a1529f9625e

* Indentation patch by GreyGhost
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 07 Aug 2008 15:46:46 +0000
parents 4a0efb7baf70
children 3fddb45c0304
comparison
equal deleted inserted replaced
128:6e1fd3571440 129:9a1529f9625e
7 self.imagepool = imagepool 7 self.imagepool = imagepool
8 self.vfs = vfs 8 self.vfs = vfs
9 self.thisown = 0 9 self.thisown = 0
10 self.filename = '' 10 self.filename = ''
11 self.node = None 11 self.node = None
12 12
13 def loadResource(self, location): 13 def loadResource(self, location):
14 self.filename = location.getFilename() 14 self.filename = location.getFilename()
15 return self.do_load_resource() 15 return self.do_load_resource()
16 16
17 def do_load_resource(self): 17 def do_load_resource(self):
18 f = self.vfs.open(self.filename) 18 f = self.vfs.open(self.filename)
19 f.thisown = 1 19 f.thisown = 1
20 tree = ET.parse(f) 20 tree = ET.parse(f)
21 self.node = tree.getroot() 21 self.node = tree.getroot()
22 22
23 animation = fife.Animation() 23 animation = fife.Animation()
24 common_frame_delay = int(self.node.get('delay', 0)) 24 common_frame_delay = int(self.node.get('delay', 0))
25 x_offset = int(self.node.get('x_offset', 0)) 25 x_offset = int(self.node.get('x_offset', 0))
26 y_offset = int(self.node.get('y_offset', 0)) 26 y_offset = int(self.node.get('y_offset', 0))
27 animation.setActionFrame(int(self.node.get('action', 0))) 27 animation.setActionFrame(int(self.node.get('action', 0)))
28 28
29 frames = self.node.findall('frame') 29 frames = self.node.findall('frame')
30 if not frames: 30 if not frames:
31 raise InvalidFormat('animation without <frame>s') 31 raise InvalidFormat('animation without <frame>s')
32 32
33 for frame in frames: 33 for frame in frames:
34 source = frame.get('source') 34 source = frame.get('source')
35 if not source: 35 if not source:
36 raise InvalidFormat('animation without <frame>s') 36 raise InvalidFormat('animation without <frame>s')
37 37