Changeset 24:cd794f1c6ff0


Ignore:
Timestamp:
02/15/12 20:03:48 (13 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The logger is now reset when connecting.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/logger.py

    r21 r24  
    3737        """Get the string representation of the given timestamp."""
    3838        return time.strftime("%H:%M:%S", time.gmtime(timestamp))
     39
     40    def reset(self):
     41        """Reset the logger.
     42
     43        The faults logged so far will be cleared."""
     44        self._faults.clear()
    3945               
    4046    def message(self, timestamp, msg):
     
    5864        s = Logger._stages[stage] if stage in Logger._stages else "<Unknown>"
    5965        self.message(timestamp, "--- %s ---" % (s,))
     66        if stage==const.STAGE_END:
     67            totalScore = 100
     68            for (id, score) in self._faults.iteritems():
     69                totalScore -= score
     70            self.untimedMessage("Score: %.0f" % (totalScore,))
    6071       
    6172    def fault(self, faultID, timestamp, what, score):
  • src/mlx.py

    r20 r24  
    130130        """Callback for the connection button."""
    131131        if self._connectButton.get_active():
     132            self._logger.reset()
    132133            self._flight = flight.Flight(self._logger)
    133134
     
    141142
    142143            self._flight.zfw = self._zfwSpinButton.get_value_as_int()
    143 
    144             print self._flight.aircraft, self._flight.cruiseAltitude, self._flight.zfw
    145144
    146145            if self._simulator is None:
     
    357356        table.attach(self._groundSpeed, 5, 6, 2, 3)
    358357
    359         (label, self._radioAltitude) = self._createLabeledEntry("Radio alt.:", 4)
     358        (label, self._radioAltitude) = self._createLabeledEntry("Radio alt.:", 6)
    360359        table.attach(label, 6, 7, 2, 3)
    361360        table.attach(self._radioAltitude, 7, 8, 2, 3)
    362361
    363         (label, self._altitude) = self._createLabeledEntry("Altitude:", 4)
     362        (label, self._altitude) = self._createLabeledEntry("Altitude:", 6)
    364363        table.attach(label, 8, 9, 2, 3)
    365364        table.attach(self._altitude, 9, 10, 2, 3)
Note: See TracChangeset for help on using the changeset viewer.