Changeset 1167:73ea9ed7e1da for src/mlx


Ignore:
Timestamp:
07/13/24 12:37:01 (4 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

The approach type can be selected from a list (re #390)

File:
1 edited

Legend:

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

    r1160 r1167  
    6767comboModel.append(("N/A",))
    6868comboModel.append(("VECTORS",))
     69
     70approachModel = Gtk.ListStore(GObject.TYPE_STRING)
     71approachModel.append(("ILS",))
     72approachModel.append(("RNAV",))
     73approachModel.append(("RNAV X",))
     74approachModel.append(("RNAV Y",))
     75approachModel.append(("RNAV Z",))
     76approachModel.append(("RNP",))
     77approachModel.append(("RNP X",))
     78approachModel.append(("RNP Y",))
     79approachModel.append(("RNP Z",))
     80approachModel.append(("LOC",))
     81approachModel.append(("LOC DME",))
     82approachModel.append(("LOC DME X",))
     83approachModel.append(("LOC DME Y",))
     84approachModel.append(("LOC DME Z",))
     85approachModel.append(("LCTR",))
     86approachModel.append(("VOR",))
     87approachModel.append(("VOR DME",))
     88approachModel.append(("VOR DME X",))
     89approachModel.append(("VOR DME Y",))
     90approachModel.append(("VOR DME Z",))
     91approachModel.append(("NDB",))
     92approachModel.append(("VISUAL",))
     93approachModel.append(("OTHER",))
    6994
    7095#-----------------------------------------------------------------------------
     
    54335458        table.attach(label, 1, 2, row, row + 1)
    54345459
    5435         self._approachType = Gtk.Entry()
    5436         self._approachType.set_width_chars(10)
     5460        self._approachType = Gtk.ComboBox(model = approachModel)
     5461        renderer = Gtk.CellRendererText()
     5462        self._approachType.pack_start(renderer, True)
     5463        self._approachType.add_attribute(renderer, "text", 0)
    54375464        self._approachType.set_tooltip_text(xstr("landing_approach_tooltip"))
    5438         self._approachType.connect("changed", self._upperChanged)
     5465        self._approachType.set_sensitive(False)
    54395466        table.attach(self._approachType, 2, 4, row, row + 1)
    54405467        label.set_mnemonic_widget(self._approachType)
     
    54905517    def approachType(self):
    54915518        """Get the approach type."""
    5492         return self._approachType.get_text()
     5519        index = self._approachType.get_active()
     5520        return self._approachType.get_model()[index][0]
    54935521
    54945522    @property
     
    55415569        self._runway.set_sensitive(True)
    55425570
    5543         self._approachType.set_text("")
     5571        self._approachType.set_active(0)
    55445572        self._approachType.set_sensitive(True)
    55455573
     
    55825610                     self.transition is not None) and \
    55835611                    self._runway.get_text()!="" and \
    5584                     self._approachType.get_text()!="" and \
     5612                    self.approachType is not None and \
    55855613                    self.vref is not None
    55865614        self._button.set_sensitive(sensitive)
     
    60306058            self._gate.set_sensitive(False)
    60316059
     6060
     6061    def prepareShow(self):
     6062        """Prepare the page for showing by updating the times and
     6063        the buttons as well."""
    60326064        self._updateTimes()
    60336065
     
    60386070        timesCorrect = not self._tooBigTimeDifference or \
    60396071                       gui.hasComments or gui.hasDelayCode
     6072        otherApproach = self._wizard.approachType=="OTHER" and \
     6073            not gui.hasComments
    60406074        sensitive = gui.flight is not None and \
    60416075                    gui.flight.stage==const.STAGE_END and \
    60426076                    (self._gatesModel.get_iter_first() is None or
    60436077                     self._gate.get_active()>=0) and \
    6044                      faultsExplained and timesCorrect
    6045 
    6046         self._updateHelp(faultsExplained, timesCorrect)
     6078                     faultsExplained and timesCorrect and \
     6079                     not otherApproach
     6080
     6081        self._updateHelp(faultsExplained, timesCorrect, otherApproach)
    60476082
    60486083        wasSensitive = self._saveButton.get_sensitive()
     
    61816216        self.updateButtons()
    61826217
    6183     def _updateHelp(self, faultsExplained, timesCorrect):
     6218    def _updateHelp(self, faultsExplained, timesCorrect, otherApproach):
    61846219        """Update the help text according to the actual situation."""
    61856220        if not faultsExplained:
     
    61876222        elif not timesCorrect:
    61886223            self.setHelp(xstr("finish_help") + xstr("finish_help_wrongtime"))
     6224        elif otherApproach:
     6225            self.setHelp(xstr("finish_help") + xstr("finish_help_otherappr"))
    61896226        else:
    61906227            self.setHelp(xstr("finish_help") + xstr("finish_help_goodtime"))
Note: See TracChangeset for help on using the changeset viewer.