Changeset 176:cb593ff93551
- Timestamp:
- 05/13/12 08:17:00 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/flight.py
r170 r176 3 3 #--------------------------------------------------------------------------------------- 4 4 5 from soundsched import SoundScheduler 5 from soundsched import SoundScheduler, ChecklistScheduler 6 6 7 7 import const … … 34 34 gui.resetFlightStatus() 35 35 36 self._soundScheduler = SoundScheduler(self)37 36 self._pilotHotkeyPressed = False 38 37 self._checklistHotkeyPressed = False … … 66 65 67 66 self._tdRate = None 67 68 self._soundScheduler = SoundScheduler(self) 69 self._checklistScheduler = ChecklistScheduler(self) 68 70 69 71 @property … … 128 130 self._pilotHotkeyPressed) 129 131 self._pilotHotkeyPressed = False 132 133 if self._checklistHotkeyPressed: 134 self._checklistScheduler.hotkeyPressed() 135 self._checklistHotkeyPressed = False 130 136 131 137 def setStage(self, timestamp, stage): -
src/mlx/sound.py
r170 r176 59 59 def requestSound(self, name, finishCallback = None, extra = None): 60 60 """Request the playback of the sound with the given name.""" 61 path = os.path.join(self._soundsDirectory, name) 61 path = name if os.path.isabs(name) \ 62 else os.path.join(self._soundsDirectory, name) 62 63 with self._requestCondition: 63 64 self._requests.append((path, (finishCallback, extra))) … … 167 168 168 169 FIXME: it does not do anything currently, but it should.""" 169 p ass170 print "sound.startSound:", name 170 171 171 172 #------------------------------------------------------------------------------ -
src/mlx/soundsched.py
r170 r176 5 5 from sound import startSound 6 6 import const 7 import fs 7 8 8 9 import threading … … 211 212 212 213 #------------------------------------------------------------------------------ 214 215 class ChecklistScheduler(object): 216 """A scheduler for the checklist sounds""" 217 def __init__(self, flight): 218 """Construct the checklist scheduler for the given flight.""" 219 self._flight = flight 220 self._checklist = None 221 self._itemIndex = 0 222 223 def hotkeyPressed(self): 224 """Called when the checklist hotkey is pressed.""" 225 flight = self._flight 226 config = flight.config 227 if config.enableChecklists and flight.aircraftType is not None: 228 if self._checklist is None: 229 self._checklist = config.getChecklist(flight.aircraftType) 230 231 index = self._itemIndex 232 if index>=len(self._checklist): 233 fs.sendMessage(const.MESSAGETYPE_INFORMATION, 234 "End of checklist") 235 else: 236 startSound(self._checklist[index]) 237 self._itemIndex += 1 238 239 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.