Changeset 1087:73fbd444b7fe for src/mlx
- Timestamp:
- 03/19/23 13:28:59 (20 months ago)
- Branch:
- python3
- Phase:
- public
- amend_source:
- 0d69ca1836814137b601f24493e4d718c56b12b7
- Location:
- src/mlx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/acft.py
r1043 r1087 87 87 class SimBriefData(object): 88 88 """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 """ 91 98 self.climbProfiles = climbProfiles 92 99 self.cruiseProfiles = cruiseProfiles 93 100 self.descentProfiles = descentProfiles 101 self.cruiseParameters = cruiseParameters 94 102 95 103 #--------------------------------------------------------------------------------------- … … 743 751 self.simBriefData = SimBriefData(["250/280/78"], 744 752 ["CI", "M75", "M78", "M79", "M80", "LRC"], 745 ["78/280/250"]) 753 ["78/280/250"], 754 cruiseParameters = {0: (False, "civalue")}) 746 755 747 756 #--------------------------------------------------------------------------------------- … … 760 769 self.simBriefData = SimBriefData(["250/280/78"], 761 770 ["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")}) 763 773 764 774 #--------------------------------------------------------------------------------------- … … 777 787 self.simBriefData = SimBriefData(["250/280/78"], 778 788 ["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")}) 780 791 781 792 #--------------------------------------------------------------------------------------- -
src/mlx/gui/flight.py
r1086 r1087 3380 3380 self._cruiseProfile.add_attribute(renderer, "text", 0) 3381 3381 self._cruiseProfile.set_tooltip_text(xstr("simbrief_cruise_profile_tooltip")) 3382 self._cruiseProfile.connect("changed", self._cruiseProfileChanged) 3382 3383 table.attach(self._cruiseProfile, 1, 2, row, row+1) 3383 3384 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 3384 3393 row += 1 3385 3394 … … 3454 3463 """Update the sensitivity of the forward button.""" 3455 3464 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) 3458 3478 3459 3479 def _backClicked(self, button): … … 3517 3537 self._climbProfile.set_sensitive(False) 3518 3538 self._cruiseProfile.set_sensitive(False) 3539 self._cruiseParameter.set_sensitive(False) 3519 3540 self._descentProfile.set_sensitive(False) 3520 3541 … … 3694 3715 plan[key] = value 3695 3716 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 3696 3724 return plan 3697 3725 … … 3730 3758 should be converted to uppercase.""" 3731 3759 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() 3732 3778 3733 3779 def _getResults(self, link):
Note:
See TracChangeset
for help on using the changeset viewer.