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