Ignore:
Timestamp:
04/16/12 17:53:47 (13 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The logger disconnects from the simulator if the flight has ended and the Forward button on the landing page can be activated only then.

Location:
src/mlx/gui
Files:
2 edited

Legend:

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

    r86 r88  
    13731373        super(LandingPage, self).__init__(wizard, "Landing", help)
    13741374
     1375        self._flightEnded = False
     1376
    13751377        alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
    13761378                                  xscale = 0.0, yscale = 0.0)
     
    14751477    def activate(self):
    14761478        """Called when the page is activated."""
     1479        self._flightEnded = False
     1480       
    14771481        self._starButton.set_sensitive(True)
    14781482        self._starButton.set_active(False)
     
    14921496        self._vref.set_sensitive(True)
    14931497
     1498        self._updateForwardButton()
     1499
     1500    def flightEnded(self):
     1501        """Called when the flight has ended."""
     1502        self._flightEnded = True
    14941503        self._updateForwardButton()
    14951504
     
    15261535    def _updateForwardButton(self, widget = None):
    15271536        """Update the sensitivity of the forward button."""
    1528         sensitive = (self._starButton.get_active() or \
     1537        sensitive = self._flightEnded and \
     1538                    (self._starButton.get_active() or \
    15291539                     self._transitionButton.get_active()) and \
    15301540                    (self._star.get_text()!="" or
     
    16801690        if stage==const.STAGE_TAKEOFF:
    16811691            self._takeoffPage.freezeValues()
     1692        elif stage==const.STAGE_END:
     1693            self._landingPage.flightEnded()
    16821694
    16831695    def _initialize(self):
  • src/mlx/gui/gui.py

    r86 r88  
    150150        gtk.main()
    151151
    152         if self._flight is not None:
    153             simulator = self._flight.simulator
    154             if self._monitoring:
    155                 simulator.stopMonitoring()
    156                 self._monitoring = False
    157             simulator.disconnect()                       
     152        if self._flight is not None and self._connected:
     153            self.stopMonitoring()
     154            self._flight.simulator.disconnect()                       
    158155
    159156    def connected(self, fsType, descriptor):
     
    265262        self._statusIcon.setStage(stage)
    266263        self._wizard.setStage(stage)
     264        if stage==const.STAGE_END:
     265            self.stopMonitoring()
     266            self.simulator.disconnect()
     267            self._connecting = False
     268            self._connected = False
     269            self._statusbar.updateConnection(self._connecting, self._connected)
    267270
    268271    def setRating(self, rating):
     
    412415    def startMonitoring(self):
    413416        """Start monitoring."""
    414         self._simulator.startMonitoring()
    415         self._monitoring = True
     417        if not self._monitoring:
     418            self.simulator.startMonitoring()
     419            self._monitoring = True
    416420
    417421    def stopMonitoring(self):
    418422        """Stop monitoring."""
    419         self._simulator.stoptMonitoring()
    420         self._monitoring = False
     423        if self._monitoring:
     424            self.simulator.stopMonitoring()
     425            self._monitoring = False
    421426
    422427    def _buildLogFrame(self):
Note: See TracChangeset for help on using the changeset viewer.