Changeset 88:3fdb6ad947ad
- Timestamp:
- 04/16/12 17:53:47 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r86 r88 1373 1373 super(LandingPage, self).__init__(wizard, "Landing", help) 1374 1374 1375 self._flightEnded = False 1376 1375 1377 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1376 1378 xscale = 0.0, yscale = 0.0) … … 1475 1477 def activate(self): 1476 1478 """Called when the page is activated.""" 1479 self._flightEnded = False 1480 1477 1481 self._starButton.set_sensitive(True) 1478 1482 self._starButton.set_active(False) … … 1492 1496 self._vref.set_sensitive(True) 1493 1497 1498 self._updateForwardButton() 1499 1500 def flightEnded(self): 1501 """Called when the flight has ended.""" 1502 self._flightEnded = True 1494 1503 self._updateForwardButton() 1495 1504 … … 1526 1535 def _updateForwardButton(self, widget = None): 1527 1536 """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 \ 1529 1539 self._transitionButton.get_active()) and \ 1530 1540 (self._star.get_text()!="" or … … 1680 1690 if stage==const.STAGE_TAKEOFF: 1681 1691 self._takeoffPage.freezeValues() 1692 elif stage==const.STAGE_END: 1693 self._landingPage.flightEnded() 1682 1694 1683 1695 def _initialize(self): -
src/mlx/gui/gui.py
r86 r88 150 150 gtk.main() 151 151 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() 158 155 159 156 def connected(self, fsType, descriptor): … … 265 262 self._statusIcon.setStage(stage) 266 263 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) 267 270 268 271 def setRating(self, rating): … … 412 415 def startMonitoring(self): 413 416 """Start monitoring.""" 414 self._simulator.startMonitoring() 415 self._monitoring = True 417 if not self._monitoring: 418 self.simulator.startMonitoring() 419 self._monitoring = True 416 420 417 421 def stopMonitoring(self): 418 422 """Stop monitoring.""" 419 self._simulator.stoptMonitoring() 420 self._monitoring = False 423 if self._monitoring: 424 self.simulator.stopMonitoring() 425 self._monitoring = False 421 426 422 427 def _buildLogFrame(self): -
src/mlx/pyuipc_sim.py
r85 r88 351 351 index = 0 352 352 while index<numNotchesM1 and \ 353 self.flapsControl <self.flapsNotches[index]:353 self.flapsControl>self.flapsNotches[index]: 354 354 index += 1 355 355 356 356 if index==numNotchesM1: 357 357 return 16383 358 358 else: 359 return int((self.flapsControl-self.flapsNotches[index]) * \ 360 flapsIncrement / \ 359 return int(index * flapsIncrement + 360 (self.flapsControl-self.flapsNotches[index]) * 361 flapsIncrement / 361 362 (self.flapsNotches[index+1] - self.flapsNotches[index])) 362 363 elif offset==0x0be0 or offset==0x0be4: # Flaps left and right … … 529 530 numNotchesM1 = len(self.flapsNotches) - 1 530 531 flapsIncrement = 16383.0 / numNotchesM1 531 index = value / flapsIncrement532 index = int(value / flapsIncrement) 532 533 if index>=numNotchesM1: 533 534 self.flapsControl = self.flapsNotches[-1] 534 535 else: 535 536 self.flapsControl = self.flapsNotches[index] 536 self.flapsControl += value* \537 self.flapsControl += (value - index * flapsIncrement) * \ 537 538 (self.flapsNotches[index+1] - self.flapsNotches[index]) / \ 538 539 flapsIncrement … … 583 584 elif offset==0x3bfc: # ZFW 584 585 self.zfw = value * const.LBSTOKG / 256.0 585 print "ZFW:", self.zfw586 586 elif offset==0x3c00: # Path of the current AIR file 587 587 self.airPath = value … … 640 640 temperature += 273.15 # Celsius -> Kelvin 641 641 airDensity = pressure / (temperature * 287.05) 642 print "pressure:", pressure, "temperature:", temperature, "airDensity:", airDensity642 #print "pressure:", pressure, "temperature:", temperature, "airDensity:", airDensity 643 643 return self.ias * math.sqrt(1.225 / airDensity) 644 644 -
src/mlx/web.py
r74 r88 337 337 result = Result() 338 338 339 f = urllib2.urlopen(url )339 f = urllib2.urlopen(url, timeout = 10.0) 340 340 341 341 status = readline(f) … … 375 375 url = "http://www.virtualairlines.hu/onlinegates_get.php" 376 376 377 f = urllib2.urlopen(url )377 f = urllib2.urlopen(url, timeout = 10.0) 378 378 result = Result() 379 379 result.fleet = Fleet(f) … … 407 407 ("kapu", gateNumber)]) 408 408 409 f = urllib2.urlopen(url, data )409 f = urllib2.urlopen(url, data, timeout = 10.0) 410 410 line = readline(f) 411 411 … … 434 434 url = "http://notams.euroutepro.com/notams.xml" 435 435 436 f = urllib2.urlopen(url )436 f = urllib2.urlopen(url, timeout = 10.0) 437 437 try: 438 438 xmlParser.parse(f) … … 466 466 ("mostRecentForEachStation", "constraint")]) 467 467 url += data 468 f = urllib2.urlopen(url )468 f = urllib2.urlopen(url, timeout = 10.0) 469 469 try: 470 470 result = Result()
Note:
See TracChangeset
for help on using the changeset viewer.