Ignore:
Timestamp:
05/13/12 08:17:00 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Checklist playback seems to work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/soundsched.py

    r170 r176  
    55from sound import startSound
    66import const
     7import fs
    78
    89import threading
     
    211212
    212213#------------------------------------------------------------------------------
     214
     215class 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.