Changeset 24:cd794f1c6ff0
- Timestamp:
- 02/15/12 20:03:48 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/logger.py
r21 r24 37 37 """Get the string representation of the given timestamp.""" 38 38 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() 39 45 40 46 def message(self, timestamp, msg): … … 58 64 s = Logger._stages[stage] if stage in Logger._stages else "<Unknown>" 59 65 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,)) 60 71 61 72 def fault(self, faultID, timestamp, what, score): -
src/mlx.py
r20 r24 130 130 """Callback for the connection button.""" 131 131 if self._connectButton.get_active(): 132 self._logger.reset() 132 133 self._flight = flight.Flight(self._logger) 133 134 … … 141 142 142 143 self._flight.zfw = self._zfwSpinButton.get_value_as_int() 143 144 print self._flight.aircraft, self._flight.cruiseAltitude, self._flight.zfw145 144 146 145 if self._simulator is None: … … 357 356 table.attach(self._groundSpeed, 5, 6, 2, 3) 358 357 359 (label, self._radioAltitude) = self._createLabeledEntry("Radio alt.:", 4)358 (label, self._radioAltitude) = self._createLabeledEntry("Radio alt.:", 6) 360 359 table.attach(label, 6, 7, 2, 3) 361 360 table.attach(self._radioAltitude, 7, 8, 2, 3) 362 361 363 (label, self._altitude) = self._createLabeledEntry("Altitude:", 4)362 (label, self._altitude) = self._createLabeledEntry("Altitude:", 6) 364 363 table.attach(label, 8, 9, 2, 3) 365 364 table.attach(self._altitude, 9, 10, 2, 3)
Note:
See TracChangeset
for help on using the changeset viewer.