Changeset 586:6e5ba20962e3


Ignore:
Timestamp:
12/21/14 14:33:17 (10 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The deprature METAR is displayed on the takeoff page as well and that and the one on the briefing page are kept in sync (re #235)

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r584 r586  
    751751msgstr "The runway, SID and takeoff speeds logged can be seen below."
    752752
     753msgid "takeoff_metar"
     754msgstr "_METAR:"
     755
    753756msgid "takeoff_runway"
    754757msgstr "Run_way:"
  • locale/hu/mlx.po

    r584 r586  
    752752msgstr "A naplózott futópálya, SID és a sebességek lent olvashatók."
    753753
     754msgid "takeoff_metar"
     755msgstr "_METAR:"
     756
    754757msgid "takeoff_runway"
    755758msgstr "_Futópálya:"
  • src/mlx/gui/flight.py

    r584 r586  
    19381938                                  else gtk.POLICY_AUTOMATIC)
    19391939
    1940         self._uppercasingMETAR = False
     1940        self._updatingMETAR = False
    19411941
    19421942        self._metar = gtk.TextView()
     
    19681968
    19691969    def setMETAR(self, metar):
    1970         """Set the metar."""
     1970        """Set the METAR."""
    19711971        self._metar.get_buffer().set_text(metar)
    19721972        self.metarEdited = False
     1973
     1974    def changeMETAR(self, metar):
     1975        """Change the METAR as a result of an edit on one of the other
     1976        pages."""
     1977        self._updatingMETAR = True
     1978        self._metar.get_buffer().set_text(metar)
     1979        self._updatingMETAR = False
     1980        self.metarEdited = True
    19731981
    19741982    def activate(self):
     
    20032011        self._metarFrame.set_label(xstr("briefing_metar_template") % (icao,))
    20042012        buffer = self._metar.get_buffer()
     2013        self._updatingMETAR = True
    20052014        if metar is None:
    2006             #buffer.set_text(xstr("briefing_metar_failed"))
    20072015            buffer.set_text("")
    20082016            self.setHelp(xstr("briefing_help_nometar"))
    20092017        else:
    20102018            buffer.set_text(metar)
     2019        self._updatingMETAR = False
    20112020        self._updateButton()
    20122021
     
    20342043    def _metarChanged(self, buffer):
    20352044        """Called when the METAR has changed."""
    2036         if not self._uppercasingMETAR:
     2045        print "BriefingPage.metarChanged", self._updatingMETAR
     2046        if not self._updatingMETAR:
    20372047            self.metarEdited = True
    20382048            self._updateButton()
     2049            metar = buffer.get_text(buffer.get_start_iter(),
     2050                                buffer.get_end_iter(), True)
     2051            self._wizard.metarChanged(metar, self)
    20392052
    20402053    def _metarInserted(self, textBuffer, iter, text, length):
     
    20422055
    20432056        It uppercases all characters."""
    2044         if not self._uppercasingMETAR:
    2045             self._uppercasingMETAR = True
     2057        print "BriefingPage.metarInserted", self._updatingMETAR
     2058        if not self._updatingMETAR:
     2059            self._updatingMETAR = True
    20462060
    20472061            iter1 = iter.copy()
     
    20512065            textBuffer.insert(iter, text.upper())
    20522066
    2053             self._uppercasingMETAR = False
     2067            self._updatingMETAR = False
    20542068
    20552069    def _updateButton(self):
     
    20772091                                  xscale = 0.0, yscale = 0.0)
    20782092
    2079         table = gtk.Table(8, 4)
     2093        table = gtk.Table(9, 24)
    20802094        table.set_row_spacings(4)
    20812095        table.set_col_spacings(16)
     
    20842098        self.setMainWidget(alignment)
    20852099
     2100        row = 0
     2101
     2102        label = gtk.Label(xstr("takeoff_metar"))
     2103        label.set_use_underline(True)
     2104        label.set_alignment(0.0, 0.5)
     2105        table.attach(label, 0, 1, row, row+1)
     2106
     2107        self._metar = gtk.Entry()
     2108        self._metar.set_width_chars(40)
     2109        self._metar.connect("changed", self._metarChanged)
     2110        self._metar.connect_after("insert-text", self._metarInserted)
     2111        table.attach(self._metar, 1, 24, row, row+1)
     2112        label.set_mnemonic_widget(self._metar)
     2113
     2114        self._updatingMETAR = False
     2115
     2116        row += 1
     2117
    20862118        label = gtk.Label(xstr("takeoff_runway"))
    20872119        label.set_use_underline(True)
    20882120        label.set_alignment(0.0, 0.5)
    2089         table.attach(label, 0, 1, 0, 1)
     2121        table.attach(label, 0, 1, row, row+1)
    20902122
    20912123        self._runway = gtk.Entry()
     
    20932125        self._runway.set_tooltip_text(xstr("takeoff_runway_tooltip"))
    20942126        self._runway.connect("changed", self._upperChanged)
    2095         table.attach(self._runway, 1, 3, 0, 1)
     2127        table.attach(self._runway, 1, 3, row, row+1)
    20962128        label.set_mnemonic_widget(self._runway)
     2129
     2130        row += 1
    20972131
    20982132        label = gtk.Label(xstr("takeoff_sid"))
    20992133        label.set_use_underline(True)
    21002134        label.set_alignment(0.0, 0.5)
    2101         table.attach(label, 0, 1, 1, 2)
     2135        table.attach(label, 0, 1, row, row+1)
    21022136
    21032137        self._sid = gtk.Entry()
     
    21052139        self._sid.set_tooltip_text(xstr("takeoff_sid_tooltip"))
    21062140        self._sid.connect("changed", self._upperChanged)
    2107         table.attach(self._sid, 1, 3, 1, 2)
     2141        table.attach(self._sid, 1, 3, row, row+1)
    21082142        label.set_mnemonic_widget(self._sid)
     2143
     2144        row += 1
    21092145
    21102146        label = gtk.Label(xstr("takeoff_v1"))
     
    21122148        label.set_use_underline(True)
    21132149        label.set_alignment(0.0, 0.5)
    2114         table.attach(label, 0, 1, 2, 3)
     2150        table.attach(label, 0, 1, row, row+1)
    21152151
    21162152        self._v1 = IntegerEntry()
     
    21182154        self._v1.set_tooltip_markup(xstr("takeoff_v1_tooltip_knots"))
    21192155        self._v1.connect("integer-changed", self._valueChanged)
    2120         table.attach(self._v1, 2, 3, 2, 3)
     2156        table.attach(self._v1, 2, 3, row, row+1)
    21212157        label.set_mnemonic_widget(self._v1)
    21222158
    21232159        self._v1Unit = gtk.Label(xstr("label_knots"))
    21242160        self._v1Unit.set_alignment(0.0, 0.5)
    2125         table.attach(self._v1Unit, 3, 4, 2, 3)
     2161        table.attach(self._v1Unit, 3, 4, row, row+1)
     2162
     2163        row += 1
    21262164
    21272165        label = gtk.Label(xstr("takeoff_vr"))
     
    21292167        label.set_use_underline(True)
    21302168        label.set_alignment(0.0, 0.5)
    2131         table.attach(label, 0, 1, 3, 4)
     2169        table.attach(label, 0, 1, row, row+1)
    21322170
    21332171        self._vr = IntegerEntry()
     
    21352173        self._vr.set_tooltip_markup(xstr("takeoff_vr_tooltip_knots"))
    21362174        self._vr.connect("integer-changed", self._valueChanged)
    2137         table.attach(self._vr, 2, 3, 3, 4)
     2175        table.attach(self._vr, 2, 3, row, row+1)
    21382176        label.set_mnemonic_widget(self._vr)
    21392177
    21402178        self._vrUnit = gtk.Label(xstr("label_knots"))
    21412179        self._vrUnit.set_alignment(0.0, 0.5)
    2142         table.attach(self._vrUnit, 3, 4, 3, 4)
     2180        table.attach(self._vrUnit, 3, 4, row, row+1)
     2181
     2182        row += 1
    21432183
    21442184        label = gtk.Label(xstr("takeoff_v2"))
     
    21462186        label.set_use_underline(True)
    21472187        label.set_alignment(0.0, 0.5)
    2148         table.attach(label, 0, 1, 4, 5)
     2188        table.attach(label, 0, 1, row, row+1)
    21492189
    21502190        self._v2 = IntegerEntry()
     
    21522192        self._v2.set_tooltip_markup(xstr("takeoff_v2_tooltip_knots"))
    21532193        self._v2.connect("integer-changed", self._valueChanged)
    2154         table.attach(self._v2, 2, 3, 4, 5)
     2194        table.attach(self._v2, 2, 3, row, row+1)
    21552195        label.set_mnemonic_widget(self._v2)
    21562196
    21572197        self._v2Unit = gtk.Label(xstr("label_knots"))
    21582198        self._v2Unit.set_alignment(0.0, 0.5)
    2159         table.attach(self._v2Unit, 3, 4, 4, 5)
     2199        table.attach(self._v2Unit, 3, 4, row, row+1)
     2200
     2201        row += 1
    21602202
    21612203        self._derateType = acft.DERATE_NONE
     
    21652207        self._derateLabel.set_markup(xstr("takeoff_derate_tupolev"))
    21662208        self._derateLabel.set_alignment(0.0, 0.5)
    2167         table.attach(self._derateLabel, 0, 1, 5, 6)
     2209        table.attach(self._derateLabel, 0, 1, row, row+1)
    21682210
    21692211        self._derate = gtk.Alignment()
    2170         table.attach(self._derate, 2, 4, 5, 6)
     2212        table.attach(self._derate, 2, 4, row, row+1)
    21712213        self._derateWidget = None
    21722214        self._derateEntry = None
     
    21742216        self._derateButtons = None
    21752217
     2218        row += 1
     2219
    21762220        self._antiIceOn = gtk.CheckButton(xstr("takeoff_antiice"))
    21772221        self._antiIceOn.set_use_underline(True)
    21782222        self._antiIceOn.set_tooltip_text(xstr("takeoff_antiice_tooltip"))
    2179         table.attach(self._antiIceOn, 2, 4, 6, 7)
     2223        table.attach(self._antiIceOn, 2, 4, row, row+1)
     2224
     2225        row += 1
    21802226
    21812227        self._rto = gtk.CheckButton(xstr("takeoff_rto"))
     
    21832229        self._rto.set_tooltip_text(xstr("takeoff_rto_tooltip"))
    21842230        self._rto.connect("toggled", self._rtoToggled)
    2185         table.attach(self._rto, 2, 4, 7, 8, ypadding = 8)
     2231        table.attach(self._rto, 2, 4, row, row+1, ypadding = 8)
    21862232
    21872233        self.addCancelFlightButton()
     
    21902236
    21912237        self._button = self.addNextButton(clicked = self._forwardClicked)
     2238
     2239        self._active = False
    21922240
    21932241    @property
     
    22552303        print "TakeoffPage.activate"
    22562304
     2305        self._updatingMETAR = True
     2306        self._metar.get_buffer().set_text(self._wizard.departureMETAR, -1)
     2307        self._updatingMETAR = False
     2308
    22572309        self._runway.set_text("")
    22582310        self._runway.set_sensitive(True)
     
    22862338        self._forwardAllowed = False
    22872339
     2340        self._active = True
     2341
    22882342    def allowForward(self):
    22892343        """Allow going to the next page."""
     
    23022356        self._hasDerate = False
    23032357        self._antiIceOn.set_active(False)
     2358        self._active = False
    23042359
    23052360    def setRTOEnabled(self, enabled):
     
    23082363            self._rto.set_active(False)
    23092364        self._rto.set_sensitive(enabled)
     2365
     2366    def changeMETAR(self, metar):
     2367        """Change the METAR as a result of an edit on one of the other
     2368        pages."""
     2369        if self._active:
     2370            print "TakeoffPage.changeMETAR"
     2371            self._updatingMETAR = True
     2372            self._metar.get_buffer().set_text(metar, -1)
     2373            self._updatingMETAR = False
    23102374
    23112375    def _updateForwardButton(self):
     
    24502514            self._derateLabel.set_text("")
    24512515            self._derateLabel.set_sensitive(False)
     2516
     2517    def _metarChanged(self, entry):
     2518        """Called when the METAR has changed."""
     2519        print "TakeoffPage.metarChanged", self._updatingMETAR
     2520        if not self._updatingMETAR:
     2521            self._updateForwardButton()
     2522            self._wizard.metarChanged(entry.get_text(), self)
     2523
     2524    def _metarInserted(self, entry, text, length, position):
     2525        """Called when new characters are inserted into the METAR.
     2526
     2527        It uppercases all characters."""
     2528        print "TakeoffPage.metarInserted", self._updatingMETAR
     2529        if not self._updatingMETAR:
     2530            self._updatingMETAR = True
     2531
     2532            position = entry.get_position()
     2533            entry.delete_text(position, position + length)
     2534            entry.insert_text(text.upper(), position)
     2535
     2536            self._updatingMETAR = False
    24522537
    24532538#-----------------------------------------------------------------------------
     
    37293814        """Called when the cruise level is changed."""
    37303815        return self.gui.cruiseLevelChanged()
     3816
     3817    def metarChanged(self, metar, originator):
     3818        """Called when a METER is changed on on of the pages.
     3819
     3820        originator is the page that originated the changed. It will be used to
     3821        determine which METAR (departure or arrival) has changed."""
     3822        metar = metar.upper()
     3823        if originator in [self._departureBriefingPage, self._takeoffPage]:
     3824            self._departureMETARChanged(metar, originator)
     3825        else:
     3826            self._arrivalMETARChanged(metar, originator)
     3827
     3828    def _departureMETARChanged(self, metar, originator):
     3829        """Called when the departure METAR has been edited on one of the
     3830        pages.
     3831
     3832        originator is the page that originated the change. It will not be
     3833        called to set the METAR, while others will be."""
     3834        for page in [self._departureBriefingPage, self._takeoffPage]:
     3835            if page is not originator:
     3836                page.changeMETAR(metar)
     3837
     3838    def _arrivalMETARChanged(self, metar, originator):
     3839        """Called when the arrival METAR has been edited on one of the
     3840        pages.
     3841
     3842        originator is the page that originated the change. It will not be
     3843        called to set the METAR, while others will be."""
     3844        for page in [self._arrivalBriefingPage]:
     3845            if page is not originator:
     3846                page.changeMETAR(metar)
    37313847
    37323848    def _loginResultCallback(self, returned, result):
Note: See TracChangeset for help on using the changeset viewer.