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

Made the sending of the closing message more reliable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/gui.py

    r151 r152  
    399399        self._logView.get_buffer().set_text("")
    400400
    401     def _disconnect(self):
     401    def _disconnect(self, closingMessage = None, duration = 3):
    402402        """Disconnect from the simulator if connected."""
    403403        self.stopMonitoring()
    404404
    405405        if self._connected:
    406             self._flight.simulator.disconnect()
     406            if closingMessage is None:
     407                self._flight.simulator.disconnect()
     408            else:
     409                fs.sendMessage(const.MESSAGETYPE_ENVIRONMENT,
     410                               closingMessage, duration,
     411                               disconnect = True)
    407412            self._connected = False
    408413
     
    455460        self._wizard.setStage(stage)
    456461        if stage==const.STAGE_END:
    457             # FIXME: perhaps a more elegant method, e.g.
    458             # the simulator should provide a function disconnect
    459             # with a final message
    460             gobject.timeout_add(1000, self._disconnect)
     462            self._disconnect(closingMessage =
     463                             "Flight plan closed. Welcome to %s" % \
     464                             (self.bookedFlight.arrivalICAO,),
     465                             duration = 5)
    461466
    462467    def setRating(self, rating):
Note: See TracChangeset for help on using the changeset viewer.