Changeset 1087:73fbd444b7fe


Ignore:
Timestamp:
03/19/23 13:28:59 (20 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
amend_source:
0d69ca1836814137b601f24493e4d718c56b12b7
Message:

It is possible to provide an extra parameter for the SimBrief cruise profile.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r1085 r1087  
    936936msgid "simbrief_cruise_profile_tooltip"
    937937msgstr "Select the cruise profile."
     938
     939msgid "simbrief_cruise_parameter_tooltip"
     940msgstr ""
     941"A parameter for the cruise profile. For example, "
     942"the Cost Index in case of the Boeing 737NG aircraft, "
     943"if the selected cruise profile is CI."
    938944
    939945msgid "simbrief_descent_profile"
  • locale/hu/mlx.po

    r1085 r1087  
    935935msgid "simbrief_cruise_profile_tooltip"
    936936msgstr "Válaszd ki az utazó profilt"
     937
     938msgid "simbrief_cruise_parameter_tooltip"
     939msgstr ""
     940"Az utazó profile paramétere. Lehet például "
     941"a Cost Index a Boeing 737NG típusnál, "
     942"amennyiben az utazó profil CI."
    937943
    938944msgid "simbrief_descent_profile"
  • src/mlx/acft.py

    r1043 r1087  
    8787class SimBriefData(object):
    8888    """Data to be used when creating SimBrief briefings."""
    89     def __init__(self, climbProfiles, cruiseProfiles, descentProfiles):
    90         """Construct the SimBrief data with the given profiles."""
     89    def __init__(self, climbProfiles, cruiseProfiles, descentProfiles,
     90                 cruiseParameters = {}):
     91        """Construct the SimBrief data with the given profiles.
     92
     93        cruiseParameters is a dictionary keyed by the cruise profile index. It
     94        contains a tuple of:
     95        - a boolean indicating if the parameter is mandatory,
     96        - the name of the parameter for the SimBrief API
     97        """
    9198        self.climbProfiles = climbProfiles
    9299        self.cruiseProfiles = cruiseProfiles
    93100        self.descentProfiles = descentProfiles
     101        self.cruiseParameters = cruiseParameters
    94102
    95103#---------------------------------------------------------------------------------------
     
    743751        self.simBriefData = SimBriefData(["250/280/78"],
    744752                                         ["CI", "M75", "M78", "M79", "M80", "LRC"],
    745                                          ["78/280/250"])
     753                                         ["78/280/250"],
     754                                         cruiseParameters = {0: (False, "civalue")})
    746755
    747756#---------------------------------------------------------------------------------------
     
    760769        self.simBriefData = SimBriefData(["250/280/78"],
    761770                                         ["CI", "M75", "M78", "M79", "M80", "LRC"],
    762                                          ["78/280/250", "78/250/250"])
     771                                         ["78/280/250", "78/250/250"],
     772                                         cruiseParameters = {0: (False, "civalue")})
    763773
    764774#---------------------------------------------------------------------------------------
     
    777787        self.simBriefData = SimBriefData(["250/280/78"],
    778788                                         ["CI", "M76", "M78", "M79", "M80", "LRC"],
    779                                          ["78/280/250", "78/250/250"])
     789                                         ["78/280/250", "78/250/250"],
     790                                         cruiseParameters = {0: (False, "civalue")})
    780791
    781792#---------------------------------------------------------------------------------------
  • src/mlx/gui/flight.py

    r1086 r1087  
    33803380        self._cruiseProfile.add_attribute(renderer, "text", 0)
    33813381        self._cruiseProfile.set_tooltip_text(xstr("simbrief_cruise_profile_tooltip"))
     3382        self._cruiseProfile.connect("changed", self._cruiseProfileChanged)
    33823383        table.attach(self._cruiseProfile, 1, 2, row, row+1)
    33833384        label.set_mnemonic_widget(self._cruiseProfile)
     3385
     3386        self._cruiseParameter = Gtk.Entry()
     3387        self._cruiseParameter.set_width_chars(5)
     3388        self._cruiseParameter.set_tooltip_text(xstr("simbrief_cruise_parameter_tooltip"))
     3389        self._cruiseParameter.set_sensitive(False)
     3390        self._cruiseParameter.connect("changed", self._cruiseParameterChanged)
     3391        table.attach(self._cruiseParameter, 2, 3, row, row+1)
     3392
    33843393        row += 1
    33853394
     
    34543463        """Update the sensitivity of the forward button."""
    34553464        self._button.set_sensitive(True)
    3456         self._button.set_sensitive(len(self._userName.get_text())>0 and
    3457                                    len(self._password.get_text())>0)
     3465
     3466        sensitive = not self._useInternalBrowser.get_active() or \
     3467           (len(self._userName.get_text())>0 and
     3468            len(self._password.get_text())>0)
     3469        if sensitive:
     3470            simBriefData = self._wizard.gui.flight.aircraft.simBriefData
     3471            cruiseProfileIndex = self._cruiseProfile.get_active()
     3472            sensitive = \
     3473                cruiseProfileIndex not in simBriefData.cruiseParameters or \
     3474                not simBriefData.cruiseParameters[cruiseProfileIndex][0] or \
     3475                len(self._cruiseParameter.get_text())>0
     3476
     3477        self._button.set_sensitive(sensitive)
    34583478
    34593479    def _backClicked(self, button):
     
    35173537        self._climbProfile.set_sensitive(False)
    35183538        self._cruiseProfile.set_sensitive(False)
     3539        self._cruiseParameter.set_sensitive(False)
    35193540        self._descentProfile.set_sensitive(False)
    35203541
     
    36943715            plan[key] = value
    36953716
     3717        cruiseParameters = self._wizard.gui.flight.aircraft.simBriefData.cruiseParameters
     3718        cruiseProfileIndex = self._cruiseProfile.get_active()
     3719        if cruiseProfileIndex in cruiseParameters:
     3720            value = self._cruiseParameter.get_text()
     3721            if value:
     3722                plan[cruiseParameters[cruiseProfileIndex][1]] = value
     3723
    36963724        return plan
    36973725
     
    37303758        should be converted to uppercase."""
    37313759        entry.set_text(entry.get_text().upper())
     3760
     3761    def _cruiseProfileChanged(self, comboBox):
     3762        """Called when the cruise profile has changed.
     3763
     3764        It updates the sensitivity of the cruise parameter entry field"""
     3765        simBriefData = self._wizard.gui.flight.aircraft.simBriefData
     3766
     3767        activeIndex = self._cruiseProfile.get_active()
     3768        self._cruiseParameter.set_sensitive(activeIndex in
     3769                                            simBriefData.cruiseParameters)
     3770
     3771        self._updateForwardButton()
     3772
     3773    def _cruiseParameterChanged(self, entry):
     3774        """Called when the cruise parameter has changed.
     3775
     3776        The sensitivty of the Forward button will be updated"""
     3777        self._updateForwardButton()
    37323778
    37333779    def _getResults(self, link):
Note: See TracChangeset for help on using the changeset viewer.