Changeset 1063
- Timestamp:
- 11/18/08 16:37:46 (5 years ago)
- File:
-
- 1 edited
-
trunk/papywizard/model/scan.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/papywizard/model/scan.py
r1060 r1063 63 63 64 64 Scan is the base object for shooting object. 65 66 >>> scan = Scan()67 >>> for yaw, pitch in scan.iterPositions():68 ... print yaw, pitch69 65 """ 70 66 def __init__(self, model): … … 92 88 totalNbPicts = property(__getTotalNbPicts) 93 89 90 # Helpers 91 def _iterPositions(self): 92 """ Real iteration over all shooting positions. 93 """ 94 self._index = 0 95 while True: 96 try: 97 yield self._index + 1, self._positions[self._index] 98 except IndexError: 99 raise StopIteration 100 self._index += 1 101 102 94 103 # Interface 95 104 def iterPositions(self): 96 105 """ Iterate over all (yaw, pitch) positions. 106 107 We first generate all positions, and then iterate over that list. 108 This way, it is possible to change the current index, to change 109 the sequence. 97 110 """ 98 111 raise NotImplementedError … … 248 261 #Interface 249 262 def iterPositions(self): 250 """ Iterate over all (yaw, pitch) positions.251 252 We first generate all positions, and then iterate over that list.253 This way, it is possible to change the current index, to change254 the sequence.255 """256 263 257 264 # Generate all positions … … 348 355 349 356 # Iterate over positions 350 self._index = 0 351 while True: 352 try: 353 yield self._index + 1, self._positions[self._index] 354 except IndexError: 355 raise StopIteration 356 self._index += 1 357 return self._iterPositions() 357 358 358 359 … … 387 388 # Interface 388 389 def iterPositions(self): 390 391 # Generate positions 392 self._positions = [] 389 393 preset = self.__presets.getByName(self.name) 390 394 Logger().debug("PresetScan.__init__(): preset=%s" % preset) 391 positions = preset.getPositions()392 for yaw, pitch in positions: 393 yield yaw, pitch394 r aise StopIteration395 self._positions = preset.getPositions() 396 397 # Iterate over positions 398 return self._iterPositions()
Note: See TracChangeset
for help on using the changeset viewer.
