Changeset 89:ef4711a984fe for src/mlx/gui
- Timestamp:
- 04/17/12 18:00:09 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r88 r89 6 6 import mlx.fs as fs 7 7 from mlx.checks import PayloadChecker 8 import mlx.util as util 8 9 9 10 import datetime … … 1477 1478 def activate(self): 1478 1479 """Called when the page is activated.""" 1479 self._flightEnded = False1480 1481 1480 self._starButton.set_sensitive(True) 1482 1481 self._starButton.set_active(False) … … 1516 1515 1517 1516 self._vref.set_sensitive(False) 1517 # FIXME: Perhaps a separate initialize() call which would set up 1518 # defaults? 1519 self._flightEnded = False 1518 1520 1519 1521 def _starButtonClicked(self, button): … … 1557 1559 def _forwardClicked(self, button): 1558 1560 """Called when the forward button is clicked.""" 1559 #self._wizard.nextPage() 1560 self.finalize() 1561 self._wizard.nextPage() 1562 1563 #----------------------------------------------------------------------------- 1564 1565 class FinishPage(Page): 1566 """Flight finish page.""" 1567 def __init__(self, wizard): 1568 """Construct the finish page.""" 1569 help = "There are some statistics about your flight below.\n\n" \ 1570 "Review the data, also on earlier pages, and if you are\n" \ 1571 "satisfied, you can save or send your PIREP." 1572 1573 super(FinishPage, self).__init__(wizard, "Finish", help) 1574 1575 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1576 xscale = 0.0, yscale = 0.0) 1577 1578 table = gtk.Table(5, 2) 1579 table.set_row_spacings(4) 1580 table.set_col_spacings(16) 1581 table.set_homogeneous(True) 1582 alignment.add(table) 1583 self.setMainWidget(alignment) 1584 1585 labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0) 1586 label = gtk.Label("Flight rating:") 1587 labelAlignment.add(label) 1588 table.attach(labelAlignment, 0, 1, 0, 1) 1589 1590 labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0) 1591 self._flightRating = gtk.Label() 1592 self._flightRating.set_width_chars(7) 1593 self._flightRating.set_alignment(0.0, 0.5) 1594 self._flightRating.set_use_markup(True) 1595 labelAlignment.add(self._flightRating) 1596 table.attach(labelAlignment, 1, 2, 0, 1) 1597 1598 labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0) 1599 label = gtk.Label("Flight time:") 1600 labelAlignment.add(label) 1601 table.attach(labelAlignment, 0, 1, 1, 2) 1602 1603 labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0) 1604 self._flightTime = gtk.Label() 1605 self._flightTime.set_width_chars(10) 1606 self._flightTime.set_alignment(0.0, 0.5) 1607 self._flightTime.set_use_markup(True) 1608 labelAlignment.add(self._flightTime) 1609 table.attach(labelAlignment, 1, 2, 1, 2) 1610 1611 labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0) 1612 label = gtk.Label("Block time:") 1613 labelAlignment.add(label) 1614 table.attach(labelAlignment, 0, 1, 2, 3) 1615 1616 labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0) 1617 self._blockTime = gtk.Label() 1618 self._blockTime.set_width_chars(10) 1619 self._blockTime.set_alignment(0.0, 0.5) 1620 self._blockTime.set_use_markup(True) 1621 labelAlignment.add(self._blockTime) 1622 table.attach(labelAlignment, 1, 2, 2, 3) 1623 1624 labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0) 1625 label = gtk.Label("Distance flown:") 1626 labelAlignment.add(label) 1627 table.attach(labelAlignment, 0, 1, 3, 4) 1628 1629 labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0) 1630 self._distanceFlown = gtk.Label() 1631 self._distanceFlown.set_width_chars(10) 1632 self._distanceFlown.set_alignment(0.0, 0.5) 1633 self._distanceFlown.set_use_markup(True) 1634 labelAlignment.add(self._distanceFlown) 1635 table.attach(labelAlignment, 1, 2, 3, 4) 1636 1637 labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0) 1638 label = gtk.Label("Fuel used:") 1639 labelAlignment.add(label) 1640 table.attach(labelAlignment, 0, 1, 4, 5) 1641 1642 labelAlignment = gtk.Alignment(xalign=0.0, xscale=0.0) 1643 self._fuelUsed = gtk.Label() 1644 self._fuelUsed.set_width_chars(10) 1645 self._fuelUsed.set_alignment(0.0, 0.5) 1646 self._fuelUsed.set_use_markup(True) 1647 labelAlignment.add(self._fuelUsed) 1648 table.attach(labelAlignment, 1, 2, 4, 5) 1649 1650 self._saveButton = self.addButton("S_ave PIREP...") 1651 self._saveButton.set_use_underline(True) 1652 #self._saveButton.connect("clicked", self._saveClicked) 1653 1654 self._sendButton = self.addButton("_Send PIREP...", True) 1655 self._sendButton.set_use_underline(True) 1656 #self._sendButton.connect("clicked", self._sendClicked) 1657 1658 def activate(self): 1659 """Activate the page.""" 1660 flight = self._wizard.gui._flight 1661 rating = flight.logger.getRating() 1662 if rating<0: 1663 self._flightRating.set_markup('<b><span foreground="red">NO GO</span></b>') 1664 else: 1665 self._flightRating.set_markup("<b>%.1f %%</b>" % (rating,)) 1666 1667 flightLength = flight.flightTimeEnd - flight.flightTimeStart 1668 self._flightTime.set_markup("<b>%s</b>" % \ 1669 (util.getTimeIntervalString(flightLength),)) 1670 1671 blockLength = flight.blockTimeEnd - flight.blockTimeStart 1672 self._blockTime.set_markup("<b>%s</b>" % \ 1673 (util.getTimeIntervalString(blockLength),)) 1674 1675 self._distanceFlown.set_markup("<b>%.2f NM</b>" % \ 1676 (flight.flownDistance,)) 1677 1678 self._fuelUsed.set_markup("<b>%.0f kg</b>" % \ 1679 (flight.endFuel - flight.startFuel,)) 1561 1680 1562 1681 #----------------------------------------------------------------------------- … … 1588 1707 self._landingPage = LandingPage(self) 1589 1708 self._pages.append(self._landingPage) 1709 self._pages.append(FinishPage(self)) 1590 1710 1591 1711 maxWidth = 0 -
src/mlx/gui/monitor.py
r77 r89 4 4 5 5 import mlx.const as const 6 import mlx.util as util 6 7 7 8 import time … … 170 171 table.attach(label, 4, 5, 6, 7) 171 172 table.attach(self._windDirection, 5, 6, 6, 7) 173 174 (label, self._position) = self._createLabeledEntry("Position:", 25) 175 table.attach(label, 6, 7, 6, 7) 176 table.attach(self._position, 7, 10, 6, 7) 172 177 173 178 alignment.add(table) … … 240 245 self._windSpeed.set_text("-") 241 246 self._windDirection.set_text("-") 247 self._position.set_text("-") 242 248 else: 243 249 self._timestamp.set_text(time.strftime("%H:%M:%S", … … 304 310 self._windSpeed.set_text("%.0f" % (aircraftState.windSpeed,)) 305 311 self._windDirection.set_text("%03.0f" % (aircraftState.windDirection,)) 312 self._position.set_text(util.getCoordinateString((aircraftState.latitude, 313 aircraftState.longitude))) 306 314 307 315 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.