Changeset 303:8d5607e36aed for src/mlx/gui
- Timestamp:
- 08/18/12 09:09:38 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r300 r303 1016 1016 table.attach(label, 0, 1, 0, 1) 1017 1017 1018 self._numCrew = gtk.Label()1018 self._numCrew = IntegerEntry(defaultValue = 0) 1019 1019 self._numCrew.set_width_chars(6) 1020 self._numCrew.set_alignment(1.0, 0.5) 1020 self._numCrew.connect("integer-changed", self._weightChanged) 1021 self._numCrew.set_tooltip_text(xstr("payload_crew_tooltip")) 1021 1022 table.attach(self._numCrew, 1, 2, 0, 1) 1023 label.set_mnemonic_widget(self._numCrew) 1022 1024 1023 1025 label = gtk.Label(xstr("payload_pax")) … … 1025 1027 table.attach(label, 0, 1, 1, 2) 1026 1028 1027 self._numPassengers = gtk.Label()1029 self._numPassengers = IntegerEntry(defaultValue = 0) 1028 1030 self._numPassengers.set_width_chars(6) 1029 self._numPassengers.set_alignment(1.0, 0.5) 1031 self._numPassengers.connect("integer-changed", self._weightChanged) 1032 self._numPassengers.set_tooltip_text(xstr("payload_pax_tooltip")) 1030 1033 table.attach(self._numPassengers, 1, 2, 1, 2) 1034 label.set_mnemonic_widget(self._numPassengers) 1031 1035 1032 1036 label = gtk.Label(xstr("payload_bag")) … … 1034 1038 table.attach(label, 0, 1, 2, 3) 1035 1039 1036 self._bagWeight = gtk.Label()1040 self._bagWeight = IntegerEntry(defaultValue = 0) 1037 1041 self._bagWeight.set_width_chars(6) 1038 self._bagWeight.set_alignment(1.0, 0.5) 1042 self._bagWeight.connect("integer-changed", self._weightChanged) 1043 self._bagWeight.set_tooltip_text(xstr("payload_bag_tooltip")) 1039 1044 table.attach(self._bagWeight, 1, 2, 2, 3) 1045 label.set_mnemonic_widget(self._bagWeight) 1040 1046 1041 1047 table.attach(gtk.Label("kg"), 2, 3, 2, 3) … … 1048 1054 self._cargoWeight = IntegerEntry(defaultValue = 0) 1049 1055 self._cargoWeight.set_width_chars(6) 1050 self._cargoWeight.connect("integer-changed", self._ cargoWeightChanged)1056 self._cargoWeight.connect("integer-changed", self._weightChanged) 1051 1057 self._cargoWeight.set_tooltip_text(xstr("payload_cargo_tooltip")) 1052 1058 table.attach(self._cargoWeight, 1, 2, 3, 4) … … 1059 1065 table.attach(label, 0, 1, 4, 5) 1060 1066 1061 self._mailWeight = gtk.Label()1067 self._mailWeight = IntegerEntry(defaultValue = 0) 1062 1068 self._mailWeight.set_width_chars(6) 1063 self._mailWeight.set_alignment(1.0, 0.5) 1069 self._mailWeight.connect("integer-changed", self._weightChanged) 1070 self._mailWeight.set_tooltip_text(xstr("payload_mail_tooltip")) 1064 1071 table.attach(self._mailWeight, 1, 2, 4, 5) 1072 label.set_mnemonic_widget(self._mailWeight) 1065 1073 1066 1074 table.attach(gtk.Label("kg"), 2, 3, 4, 5) … … 1097 1105 1098 1106 @property 1107 def numCrew(self): 1108 """The number of the crew members on the flight.""" 1109 return self._numCrew.get_int() 1110 1111 @property 1112 def numPassengers(self): 1113 """The number of the passengers on the flight.""" 1114 return self._numPassengers.get_int() 1115 1116 @property 1117 def bagWeight(self): 1118 """Get the bag weight entered.""" 1119 return self._bagWeight.get_int() 1120 1121 @property 1099 1122 def cargoWeight(self): 1100 1123 """Get the cargo weight entered.""" 1101 1124 return self._cargoWeight.get_int() 1102 1125 1126 @property 1127 def mailWeight(self): 1128 """Get the bag weight entered.""" 1129 return self._mailWeight.get_int() 1130 1103 1131 def activate(self): 1104 1132 """Setup the information.""" 1105 1133 bookedFlight = self._wizard._bookedFlight 1106 self._numCrew.set_text(str(bookedFlight.numCrew)) 1107 self._numPassengers.set_text(str(bookedFlight.numPassengers)) 1108 self._bagWeight.set_text(str(bookedFlight.bagWeight)) 1134 1135 self._numCrew.set_int(bookedFlight.numCrew) 1136 self._numCrew.set_sensitive(True) 1137 self._numPassengers.set_int(bookedFlight.numPassengers) 1138 self._numPassengers.set_sensitive(True) 1139 1140 self._bagWeight.set_int(bookedFlight.bagWeight) 1141 self._bagWeight.set_sensitive(True) 1109 1142 self._cargoWeight.set_int(bookedFlight.cargoWeight) 1110 1143 self._cargoWeight.set_sensitive(True) 1111 self._mailWeight.set_text(str(bookedFlight.mailWeight)) 1144 self._mailWeight.set_int(bookedFlight.mailWeight) 1145 self._mailWeight.set_sensitive(True) 1146 1112 1147 self._simulatorZFW.set_text("-") 1113 1148 self._simulatorZFWValue = None … … 1117 1152 def finalize(self): 1118 1153 """Finalize the payload page.""" 1154 self._numCrew.set_sensitive(False) 1155 self._numPassengers.set_sensitive(False) 1156 self._bagWeight.set_sensitive(False) 1119 1157 self._cargoWeight.set_sensitive(False) 1158 self._mailWeight.set_sensitive(False) 1120 1159 self._wizard.gui.initializeWeightHelp() 1121 1160 … … 1123 1162 """Calculate the ZFW value.""" 1124 1163 zfw = self._wizard.gui._flight.aircraft.dow 1125 bookedFlight = self._wizard._bookedFlight 1126 zfw += (bookedFlight.numCrew + bookedFlight.numPassengers) * 82 1127 zfw += bookedFlight.bagWeight 1164 zfw += (self._numCrew.get_int() + self._numPassengers.get_int()) * 82 1165 zfw += self._bagWeight.get_int() 1128 1166 zfw += self._cargoWeight.get_int() 1129 zfw += bookedFlight.mailWeight1167 zfw += self._mailWeight.get_int() 1130 1168 return zfw 1131 1169 … … 1142 1180 self._calculatedZFW.set_markup(markupBegin + str(zfw) + markupEnd) 1143 1181 1144 def _ cargoWeightChanged(self, entry, weight):1145 """Called when the cargo weighthas changed."""1182 def _weightChanged(self, entry, weight): 1183 """Called when one of the weight values or humanm counts has changed.""" 1146 1184 self._updateCalculatedZFW() 1147 1185 … … 2849 2887 2850 2888 @property 2889 def numCrew(self): 2890 """Get the number of crew members.""" 2891 return self._payloadPage.numCrew 2892 2893 @property 2894 def numPassengers(self): 2895 """Get the number of passengers.""" 2896 return self._payloadPage.numPassengers 2897 2898 @property 2899 def bagWeight(self): 2900 """Get the baggage weight.""" 2901 return self._payloadPage.bagWeight 2902 2903 @property 2851 2904 def cargoWeight(self): 2852 """Get the ca lculated ZFW value."""2905 """Get the cargo weight.""" 2853 2906 return self._payloadPage.cargoWeight 2907 2908 @property 2909 def mailWeight(self): 2910 """Get the mail weight.""" 2911 return self._payloadPage.mailWeight 2854 2912 2855 2913 @property -
src/mlx/gui/gui.py
r300 r303 223 223 224 224 @property 225 def numCrew(self): 226 """Get the number of crew members.""" 227 return self._wizard.numCrew 228 229 @property 230 def numPassengers(self): 231 """Get the number of passengers.""" 232 return self._wizard.numPassengers 233 234 @property 235 def bagWeight(self): 236 """Get the bag weight.""" 237 return self._wizard.bagWeight 238 239 @property 225 240 def cargoWeight(self): 226 241 """Get the cargo weight.""" 227 242 return self._wizard.cargoWeight 243 244 @property 245 def mailWeight(self): 246 """Get the mail weight.""" 247 return self._wizard.mailWeight 228 248 229 249 @property -
src/mlx/gui/pirep.py
r300 r303 228 228 self._rating.set_text("%.1f %%" % (rating,)) 229 229 230 self._flownNumCrew.set_text("%d" % (pirep.numCrew,)) 231 self._flownNumPassengers.set_text("%d" % (pirep.numPassengers,)) 232 self._flownBagWeight.set_text("%.0f" % (pirep.bagWeight,)) 230 233 self._flownCargoWeight.set_text("%.0f" % (pirep.cargoWeight,)) 234 self._flownMailWeight.set_text("%.0f" % (pirep.mailWeight,)) 231 235 self._flightType.set_text(xstr("flighttype_" + 232 236 flightType2string(pirep.flightType))) … … 526 530 """Build the frame for the miscellaneous data.""" 527 531 (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_miscellaneous")) 528 529 dataBox = gtk.HBox() 530 mainBox.pack_start(dataBox, False, False, 0) 531 532 533 table = gtk.Table(3, 2) 534 mainBox.pack_start(table, False, False, 0) 535 table.set_row_spacings(4) 536 table.set_col_spacings(8) 537 538 self._flownNumPassengers = \ 539 PIREPViewer.tableAttach(table, 0, 0, 540 xstr("pirepView_numPassengers"), 541 width = 4) 542 543 self._flownNumCrew = \ 544 PIREPViewer.tableAttach(table, 1, 0, 545 xstr("pirepView_numCrew"), 546 width = 3) 547 548 self._flownBagWeight = \ 549 PIREPViewer.tableAttach(table, 0, 1, 550 xstr("pirepView_bagWeight"), 551 width = 5) 552 532 553 self._flownCargoWeight = \ 533 PIREPViewer.addLabeledData(dataBox, 534 xstr("pirepView_cargoWeight"), 535 width = 6) 554 PIREPViewer.tableAttach(table, 1, 1, 555 xstr("pirepView_cargoWeight"), 556 width = 6) 557 558 self._flownMailWeight = \ 559 PIREPViewer.tableAttach(table, 2, 1, 560 xstr("pirepView_mailWeight"), 561 width = 5) 536 562 537 563 self._flightType = \ 538 PIREPViewer. addLabeledData(dataBox,539 540 564 PIREPViewer.tableAttach(table, 0, 2, 565 xstr("pirepView_flightType"), 566 width = 15) 541 567 542 568 self._online = \ 543 PIREPViewer. addLabeledData(dataBox,544 545 569 PIREPViewer.tableAttach(table, 1, 2, 570 xstr("pirepView_online"), 571 width = 5) 546 572 547 573 PIREPViewer.addVFiller(mainBox) -
src/mlx/gui/weighthelp.py
r300 r303 444 444 self._gui.logger.untimedMessage("The weight calculation help function was used by the pilot") 445 445 446 bookedFlight = self._gui.bookedFlight 447 self._crew = bookedFlight.numCrew 448 self._pax = bookedFlight.numPassengers 449 self._bag = bookedFlight.bagWeight 446 self._crew = self._gui.numCrew 447 self._pax = self._gui.numPassengers 448 self._bag = self._gui.bagWeight 450 449 self._cargo = self._gui.cargoWeight 451 self._mail = bookedFlight.mailWeight450 self._mail = self._gui.mailWeight 452 451 453 452 aircraft = self._gui.flight.aircraft
Note:
See TracChangeset
for help on using the changeset viewer.