- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/weighthelp.py
r899 r303 56 56 57 57 58 self._weightsTable = table = gtk.Table(1 7, 5)58 self._weightsTable = table = gtk.Table(16, 5) 59 59 table.set_homogeneous(False) 60 60 table.set_row_spacings(4) … … 91 91 92 92 93 self._cockpitCrewLabel = \ 94 gtk.Label(xstr("weighthelp_cockpit_crew") % ("99",)) 95 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 96 xscale = 0.0, yscale = 0.0) 97 alignment.add(self._cockpitCrewLabel) 93 self._crewLabel = gtk.Label(xstr("weighthelp_crew") % ("99",)) 94 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 95 xscale = 0.0, yscale = 0.0) 96 alignment.add(self._crewLabel) 98 97 table.attach(alignment, 0, 1, 1, 2) 99 98 100 self._c ockpitCrewWeight = gtk.Label("0")101 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 102 xscale = 0.0, yscale = 0.0) 103 alignment.add(self._c ockpitCrewWeight)99 self._crewWeight = gtk.Label("0") 100 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 101 xscale = 0.0, yscale = 0.0) 102 alignment.add(self._crewWeight) 104 103 table.attach(alignment, 1, 2, 1, 2) 105 104 106 105 table.attach(gtk.Label("kg"), 2, 3, 1, 2) 107 108 self._cabinCrewLabel = \109 gtk.Label(xstr("weighthelp_cabin_crew") % ("99",))110 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5,111 xscale = 0.0, yscale = 0.0)112 alignment.add(self._cabinCrewLabel)113 table.attach(alignment, 0, 1, 2, 3)114 115 self._cabinCrewWeight = gtk.Label("0")116 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,117 xscale = 0.0, yscale = 0.0)118 alignment.add(self._cabinCrewWeight)119 table.attach(alignment, 1, 2, 2, 3)120 121 table.attach(gtk.Label("kg"), 2, 3, 2, 3)122 106 123 107 text = xstr("weighthelp_pax") % ("999",) … … 128 112 xscale = 0.0, yscale = 0.0) 129 113 alignment.add(self._paxLabel) 114 table.attach(alignment, 0, 1, 2, 3) 115 116 self._paxWeight = gtk.Label("20000") 117 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 118 xscale = 0.0, yscale = 0.0) 119 alignment.add(self._paxWeight) 120 table.attach(alignment, 1, 2, 2, 3) 121 122 table.attach(gtk.Label("kg"), 2, 3, 2, 3) 123 124 label = gtk.Label(xstr("weighthelp_baggage")) 125 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 126 xscale = 0.0, yscale = 0.0) 127 alignment.add(label) 130 128 table.attach(alignment, 0, 1, 3, 4) 131 129 132 self._ paxWeight = gtk.Label("20000")133 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 134 xscale = 0.0, yscale = 0.0) 135 alignment.add(self._ paxWeight)130 self._bagWeight = gtk.Label("2000") 131 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 132 xscale = 0.0, yscale = 0.0) 133 alignment.add(self._bagWeight) 136 134 table.attach(alignment, 1, 2, 3, 4) 137 135 138 136 table.attach(gtk.Label("kg"), 2, 3, 3, 4) 139 137 140 label = gtk.Label(xstr("weighthelp_ baggage"))138 label = gtk.Label(xstr("weighthelp_cargo")) 141 139 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 142 140 xscale = 0.0, yscale = 0.0) … … 144 142 table.attach(alignment, 0, 1, 4, 5) 145 143 146 self._ bagWeight = gtk.Label("2000")147 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 148 xscale = 0.0, yscale = 0.0) 149 alignment.add(self._ bagWeight)144 self._cargoWeight = gtk.Label("2000") 145 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 146 xscale = 0.0, yscale = 0.0) 147 alignment.add(self._cargoWeight) 150 148 table.attach(alignment, 1, 2, 4, 5) 151 149 152 150 table.attach(gtk.Label("kg"), 2, 3, 4, 5) 153 151 154 label = gtk.Label(xstr("weighthelp_ cargo"))152 label = gtk.Label(xstr("weighthelp_mail")) 155 153 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 156 154 xscale = 0.0, yscale = 0.0) … … 158 156 table.attach(alignment, 0, 1, 5, 6) 159 157 160 self._ cargoWeight = gtk.Label("2000")161 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 162 xscale = 0.0, yscale = 0.0) 163 alignment.add(self._ cargoWeight)158 self._mailWeight = gtk.Label("2000") 159 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 160 xscale = 0.0, yscale = 0.0) 161 alignment.add(self._mailWeight) 164 162 table.attach(alignment, 1, 2, 5, 6) 165 163 166 164 table.attach(gtk.Label("kg"), 2, 3, 5, 6) 167 168 label = gtk.Label(xstr("weighthelp_mail")) 169 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 170 xscale = 0.0, yscale = 0.0) 171 alignment.add(label) 172 table.attach(alignment, 0, 1, 6, 7) 173 174 self._mailWeight = gtk.Label("2000") 175 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 176 xscale = 0.0, yscale = 0.0) 177 alignment.add(self._mailWeight) 178 table.attach(alignment, 1, 2, 6, 7) 179 180 table.attach(gtk.Label("kg"), 2, 3, 6, 7) 181 182 table.attach(gtk.HSeparator(), 1, 2, 7, 8) 165 166 table.attach(gtk.HSeparator(), 1, 2, 6, 7) 183 167 184 168 label = gtk.Label("<b>" + xstr("weighthelp_payload") + "</b>") … … 187 171 xscale = 0.0, yscale = 0.0) 188 172 alignment.add(label) 189 table.attach(alignment, 0, 1, 8, 9)173 table.attach(alignment, 0, 1, 7, 8) 190 174 191 175 self._payload = gtk.Label("<b>32000</b>") … … 194 178 xscale = 0.0, yscale = 0.0) 195 179 alignment.add(self._payload) 196 table.attach(alignment, 1, 2, 8, 9)197 198 table.attach(gtk.Label("kg"), 2, 3, 8, 9)180 table.attach(alignment, 1, 2, 7, 8) 181 182 table.attach(gtk.Label("kg"), 2, 3, 7, 8) 199 183 200 184 self._fsPayload = gtk.Label("<b>32001</b>") … … 203 187 xscale = 0.0, yscale = 0.0) 204 188 alignment.add(self._fsPayload) 189 table.attach(alignment, 3, 4, 7, 8) 190 191 table.attach(gtk.Label("kg"), 4, 5, 7, 8) 192 193 label = gtk.Label(xstr("weighthelp_dow")) 194 label.set_use_markup(True) 195 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 196 xscale = 0.0, yscale = 0.0) 197 alignment.add(label) 198 table.attach(alignment, 0, 1, 8, 9) 199 200 self._dow = gtk.Label("35000") 201 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 202 xscale = 0.0, yscale = 0.0) 203 alignment.add(self._dow) 204 table.attach(alignment, 1, 2, 8, 9) 205 206 table.attach(gtk.Label("kg"), 2, 3, 8, 9) 207 208 self._fsDOW = gtk.Label("33012") 209 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 210 xscale = 0.0, yscale = 0.0) 211 alignment.add(self._fsDOW) 205 212 table.attach(alignment, 3, 4, 8, 9) 206 213 207 214 table.attach(gtk.Label("kg"), 4, 5, 8, 9) 208 215 209 label = gtk.Label(xstr("weighthelp_dow")) 210 label.set_use_markup(True) 211 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 212 xscale = 0.0, yscale = 0.0) 213 alignment.add(label) 214 table.attach(alignment, 0, 1, 9, 10) 215 216 self._dow = gtk.Label("35000") 217 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 218 xscale = 0.0, yscale = 0.0) 219 alignment.add(self._dow) 220 table.attach(alignment, 1, 2, 9, 10) 221 222 table.attach(gtk.Label("kg"), 2, 3, 9, 10) 223 224 self._fsDOW = gtk.Label("33012") 225 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 226 xscale = 0.0, yscale = 0.0) 227 alignment.add(self._fsDOW) 228 table.attach(alignment, 3, 4, 9, 10) 229 230 table.attach(gtk.Label("kg"), 4, 5, 9, 10) 231 232 table.attach(gtk.HSeparator(), 1, 2, 10, 11) 233 234 table.attach(gtk.HSeparator(), 3, 4, 10, 11) 216 table.attach(gtk.HSeparator(), 1, 2, 9, 10) 217 218 table.attach(gtk.HSeparator(), 3, 4, 9, 10) 235 219 236 220 label = gtk.Label("<b>" + xstr("weighthelp_zfw") + "</b>") … … 239 223 xscale = 0.0, yscale = 0.0) 240 224 alignment.add(label) 241 table.attach(alignment, 0, 1, 1 1, 12)225 table.attach(alignment, 0, 1, 10, 11) 242 226 243 227 self._zfw = gtk.Label("<b>122000</b>") … … 246 230 xscale = 0.0, yscale = 0.0) 247 231 alignment.add(self._zfw) 248 table.attach(alignment, 1, 2, 1 1, 12)249 250 table.attach(gtk.Label("kg"), 2, 3, 1 1, 12)232 table.attach(alignment, 1, 2, 10, 11) 233 234 table.attach(gtk.Label("kg"), 2, 3, 10, 11) 251 235 252 236 self._fsZFW = gtk.Label("<b>124000</b>") … … 255 239 xscale = 0.0, yscale = 0.0) 256 240 alignment.add(self._fsZFW) 257 table.attach(alignment, 3, 4, 1 1, 12)258 259 table.attach(gtk.Label("kg"), 4, 5, 1 1, 12)260 261 table.attach(gtk.HSeparator(), 0, 5, 1 2, 13)241 table.attach(alignment, 3, 4, 10, 11) 242 243 table.attach(gtk.Label("kg"), 4, 5, 10, 11) 244 245 table.attach(gtk.HSeparator(), 0, 5, 11, 12) 262 246 263 247 label = gtk.Label(xstr("weighthelp_gross")) … … 266 250 xscale = 0.0, yscale = 0.0) 267 251 alignment.add(label) 252 table.attach(alignment, 0, 1, 12, 13) 253 254 self._fsGross = gtk.Label("124000") 255 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 256 xscale = 0.0, yscale = 0.0) 257 alignment.add(self._fsGross) 258 table.attach(alignment, 3, 4, 12, 13) 259 260 table.attach(gtk.Label("kg"), 4, 5, 12, 13) 261 262 label = gtk.Label(xstr("weighthelp_mzfw")) 263 label.set_use_markup(True) 264 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 265 xscale = 0.0, yscale = 0.0) 266 alignment.add(label) 268 267 table.attach(alignment, 0, 1, 13, 14) 269 268 270 self._ fsGross = gtk.Label("124000")271 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 272 xscale = 0.0, yscale = 0.0) 273 alignment.add(self._ fsGross)274 table.attach(alignment, 3, 4, 13, 14)275 276 table.attach(gtk.Label("kg"), 4, 5, 13, 14)277 278 label = gtk.Label(xstr("weighthelp_m zfw"))269 self._mzfw = gtk.Label("35000") 270 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 271 xscale = 0.0, yscale = 0.0) 272 alignment.add(self._mzfw) 273 table.attach(alignment, 1, 2, 13, 14) 274 275 table.attach(gtk.Label("kg"), 2, 3, 13, 14) 276 277 label = gtk.Label(xstr("weighthelp_mtow")) 279 278 label.set_use_markup(True) 280 279 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, … … 283 282 table.attach(alignment, 0, 1, 14, 15) 284 283 285 self._m zfw = gtk.Label("35000")286 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 287 xscale = 0.0, yscale = 0.0) 288 alignment.add(self._m zfw)284 self._mtow = gtk.Label("35000") 285 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 286 xscale = 0.0, yscale = 0.0) 287 alignment.add(self._mtow) 289 288 table.attach(alignment, 1, 2, 14, 15) 290 289 291 290 table.attach(gtk.Label("kg"), 2, 3, 14, 15) 292 291 293 label = gtk.Label(xstr("weighthelp_m tow"))292 label = gtk.Label(xstr("weighthelp_mlw")) 294 293 label.set_use_markup(True) 295 294 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, … … 298 297 table.attach(alignment, 0, 1, 15, 16) 299 298 300 self._m tow = gtk.Label("35000")301 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 302 xscale = 0.0, yscale = 0.0) 303 alignment.add(self._m tow)299 self._mlw = gtk.Label("35000") 300 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 301 xscale = 0.0, yscale = 0.0) 302 alignment.add(self._mlw) 304 303 table.attach(alignment, 1, 2, 15, 16) 305 304 306 305 table.attach(gtk.Label("kg"), 2, 3, 15, 16) 307 308 label = gtk.Label(xstr("weighthelp_mlw"))309 label.set_use_markup(True)310 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5,311 xscale = 0.0, yscale = 0.0)312 alignment.add(label)313 table.attach(alignment, 0, 1, 16, 17)314 315 self._mlw = gtk.Label("35000")316 alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,317 xscale = 0.0, yscale = 0.0)318 alignment.add(self._mlw)319 table.attach(alignment, 1, 2, 16, 17)320 321 table.attach(gtk.Label("kg"), 2, 3, 16, 17)322 306 323 307 self.show_all() … … 338 322 self._weightsTable.set_sensitive(False) 339 323 340 self._cockpitCrew = -1 341 self._cabinCrew = -1 324 self._crew = -1 342 325 self._pax = -1 343 self._dowCockpit = 2 344 self._cockpitCrewMemberWeight = 85.0 345 self._dowCabin = 2 346 self._cabinCrewMemberWeight = 75.0 347 self._humanWeight = 84.0 326 self._humanWeight = 82.0 348 327 self._bag = -1 349 328 self._cargo = -1 … … 364 343 def _setupCalculated(self): 365 344 """Setup the labels for the calculated values.""" 366 if self._cockpitCrew<0: 367 self._cockpitCrewLabel.set_text(xstr("weighthelp_cockpit_crew") % ("-",)) 368 self._cockpitCrewWeight.set_text("-") 369 else: 370 self._cockpitCrewLabel.set_text(xstr("weighthelp_cockpit_crew") % 371 (str(self._cockpitCrew),)) 372 crewWeight = (self._cockpitCrew - self._dowCockpit) * self._cockpitCrewMemberWeight 373 self._cockpitCrewWeight.set_text("%.0f" % (crewWeight,)) 374 375 if self._cabinCrew<0: 376 self._cabinCrewLabel.set_text(xstr("weighthelp_cabin_crew") % ("-",)) 377 self._cabinCrewWeight.set_text("-") 378 else: 379 self._cabinCrewLabel.set_text(xstr("weighthelp_cabin_crew") % 380 (str(self._cabinCrew),)) 381 crewWeight = (self._cabinCrew - self._dowCabin) * self._cabinCrewMemberWeight 382 self._cabinCrewWeight.set_text("%.0f" % (crewWeight,)) 345 if self._crew<0: 346 self._crewLabel.set_text(xstr("weighthelp_crew") % ("-",)) 347 self._crewWeight.set_text("-") 348 else: 349 self._crewLabel.set_text(xstr("weighthelp_crew") % (str(self._crew),)) 350 crewWeight = self._crew * self._humanWeight 351 self._crewWeight.set_text("%.0f" % (crewWeight,)) 383 352 384 353 if self._pax<0: … … 454 423 It returns a tuple with these two items. If any of the items cannot be 455 424 calculated, that is -1.""" 456 if self._c ockpitCrew<0 or self._cabinCrew<0 or self._pax<0 or \425 if self._crew<0 or self._pax<0 or \ 457 426 self._bag<0 or self._cargo<0 or self._mail<0: 458 427 payload = -1 459 428 else: 460 payload = \ 461 (self._cockpitCrew - self._dowCockpit) * \ 462 self._cockpitCrewMemberWeight + \ 463 (self._cabinCrew - self._dowCabin) * \ 464 self._cabinCrewMemberWeight + \ 465 self._pax * self._humanWeight + \ 466 self._bag + self._cargo + self._mail 429 payload = (self._crew + self._pax) * self._humanWeight + \ 430 self._bag + self._cargo + self._mail 467 431 468 432 if payload<0 or self._dowValue<0: … … 480 444 self._gui.logger.untimedMessage("The weight calculation help function was used by the pilot") 481 445 482 self._cockpitCrew = self._gui.numCockpitCrew 483 self._cabinCrew = self._gui.numCabinCrew 446 self._crew = self._gui.numCrew 484 447 self._pax = self._gui.numPassengers 485 448 self._bag = self._gui.bagWeight … … 488 451 489 452 aircraft = self._gui.flight.aircraft 490 self._dowCockpit = aircraft.dowCockpit491 self._cockpitCrewMemberWeight = aircraft.cockpitCrewWeight492 self._dowCabin = aircraft.dowCabin493 self._cabinCrewMemberWeight = aircraft.cabinCrewWeight494 453 self._humanWeight = aircraft.humanWeight 495 454 self._dowValue = aircraft.dow
Note:
See TracChangeset
for help on using the changeset viewer.