Ignore:
Timestamp:
03/16/18 09:00:12 (6 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Cockpit and cabin crew weight is included in DOW, extra people are calulcated with specific weights, and passenger weight is set to 84 kgs (re #332)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/weighthelp.py

    r303 r899  
    5656
    5757       
    58         self._weightsTable = table = gtk.Table(16, 5)
     58        self._weightsTable = table = gtk.Table(17, 5)
    5959        table.set_homogeneous(False)
    6060        table.set_row_spacings(4)
     
    9191       
    9292
    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)
    9798        table.attach(alignment, 0, 1, 1, 2)
    9899
    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)
     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)
    103104        table.attach(alignment, 1, 2, 1, 2)
    104105       
    105106        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)
    106122
    107123        text = xstr("weighthelp_pax") % ("999",)
     
    112128                                  xscale = 0.0, yscale = 0.0)
    113129        alignment.add(self._paxLabel)
    114         table.attach(alignment, 0, 1, 2, 3)
     130        table.attach(alignment, 0, 1, 3, 4)
    115131
    116132        self._paxWeight = gtk.Label("20000")
     
    118134                                  xscale = 0.0, yscale = 0.0)
    119135        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)
    123139       
    124140        label = gtk.Label(xstr("weighthelp_baggage"))
     
    126142                                  xscale = 0.0, yscale = 0.0)
    127143        alignment.add(label)
    128         table.attach(alignment, 0, 1, 3, 4)
     144        table.attach(alignment, 0, 1, 4, 5)
    129145
    130146        self._bagWeight = gtk.Label("2000")
     
    132148                                  xscale = 0.0, yscale = 0.0)
    133149        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)
    137153       
    138154        label = gtk.Label(xstr("weighthelp_cargo"))
     
    140156                                  xscale = 0.0, yscale = 0.0)
    141157        alignment.add(label)
    142         table.attach(alignment, 0, 1, 4, 5)
     158        table.attach(alignment, 0, 1, 5, 6)
    143159
    144160        self._cargoWeight = gtk.Label("2000")
     
    146162                                  xscale = 0.0, yscale = 0.0)
    147163        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)
    151167       
    152168        label = gtk.Label(xstr("weighthelp_mail"))
     
    154170                                  xscale = 0.0, yscale = 0.0)
    155171        alignment.add(label)
    156         table.attach(alignment, 0, 1, 5, 6)
     172        table.attach(alignment, 0, 1, 6, 7)
    157173
    158174        self._mailWeight = gtk.Label("2000")
     
    160176                                  xscale = 0.0, yscale = 0.0)
    161177        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)
    167183
    168184        label = gtk.Label("<b>" + xstr("weighthelp_payload") + "</b>")
     
    171187                                  xscale = 0.0, yscale = 0.0)
    172188        alignment.add(label)
    173         table.attach(alignment, 0, 1, 7, 8)
     189        table.attach(alignment, 0, 1, 8, 9)
    174190
    175191        self._payload = gtk.Label("<b>32000</b>")
     
    178194                                  xscale = 0.0, yscale = 0.0)
    179195        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)
    183199
    184200        self._fsPayload = gtk.Label("<b>32001</b>")
     
    187203                                  xscale = 0.0, yscale = 0.0)
    188204        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)
    192208
    193209        label = gtk.Label(xstr("weighthelp_dow"))
     
    196212                                  xscale = 0.0, yscale = 0.0)
    197213        alignment.add(label)
    198         table.attach(alignment, 0, 1, 8, 9)
     214        table.attach(alignment, 0, 1, 9, 10)
    199215
    200216        self._dow = gtk.Label("35000")
     
    202218                                  xscale = 0.0, yscale = 0.0)
    203219        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)
    207223
    208224        self._fsDOW = gtk.Label("33012")
     
    210226                                  xscale = 0.0, yscale = 0.0)
    211227        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)
    219235
    220236        label = gtk.Label("<b>" + xstr("weighthelp_zfw") + "</b>")
     
    223239                                  xscale = 0.0, yscale = 0.0)
    224240        alignment.add(label)
    225         table.attach(alignment, 0, 1, 10, 11)
     241        table.attach(alignment, 0, 1, 11, 12)
    226242
    227243        self._zfw = gtk.Label("<b>122000</b>")
     
    230246                                  xscale = 0.0, yscale = 0.0)
    231247        alignment.add(self._zfw)
    232         table.attach(alignment, 1, 2, 10, 11)
    233        
    234         table.attach(gtk.Label("kg"), 2, 3, 10, 11)
     248        table.attach(alignment, 1, 2, 11, 12)
     249       
     250        table.attach(gtk.Label("kg"), 2, 3, 11, 12)
    235251
    236252        self._fsZFW = gtk.Label("<b>124000</b>")
     
    239255                                  xscale = 0.0, yscale = 0.0)
    240256        alignment.add(self._fsZFW)
    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)
     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)
    246262       
    247263        label = gtk.Label(xstr("weighthelp_gross"))
     
    250266                                  xscale = 0.0, yscale = 0.0)
    251267        alignment.add(label)
    252         table.attach(alignment, 0, 1, 12, 13)
     268        table.attach(alignment, 0, 1, 13, 14)
    253269
    254270        self._fsGross = gtk.Label("124000")
     
    256272                                  xscale = 0.0, yscale = 0.0)
    257273        alignment.add(self._fsGross)
    258         table.attach(alignment, 3, 4, 12, 13)
    259        
    260         table.attach(gtk.Label("kg"), 4, 5, 12, 13)
     274        table.attach(alignment, 3, 4, 13, 14)
     275       
     276        table.attach(gtk.Label("kg"), 4, 5, 13, 14)
    261277
    262278        label = gtk.Label(xstr("weighthelp_mzfw"))
     
    265281                                  xscale = 0.0, yscale = 0.0)
    266282        alignment.add(label)
    267         table.attach(alignment, 0, 1, 13, 14)
     283        table.attach(alignment, 0, 1, 14, 15)
    268284
    269285        self._mzfw = gtk.Label("35000")
     
    271287                                  xscale = 0.0, yscale = 0.0)
    272288        alignment.add(self._mzfw)
    273         table.attach(alignment, 1, 2, 13, 14)
    274        
    275         table.attach(gtk.Label("kg"), 2, 3, 13, 14)
     289        table.attach(alignment, 1, 2, 14, 15)
     290       
     291        table.attach(gtk.Label("kg"), 2, 3, 14, 15)
    276292
    277293        label = gtk.Label(xstr("weighthelp_mtow"))
     
    280296                                  xscale = 0.0, yscale = 0.0)
    281297        alignment.add(label)
    282         table.attach(alignment, 0, 1, 14, 15)
     298        table.attach(alignment, 0, 1, 15, 16)
    283299
    284300        self._mtow = gtk.Label("35000")
     
    286302                                  xscale = 0.0, yscale = 0.0)
    287303        alignment.add(self._mtow)
    288         table.attach(alignment, 1, 2, 14, 15)
    289        
    290         table.attach(gtk.Label("kg"), 2, 3, 14, 15)
     304        table.attach(alignment, 1, 2, 15, 16)
     305       
     306        table.attach(gtk.Label("kg"), 2, 3, 15, 16)
    291307
    292308        label = gtk.Label(xstr("weighthelp_mlw"))
     
    295311                                  xscale = 0.0, yscale = 0.0)
    296312        alignment.add(label)
    297         table.attach(alignment, 0, 1, 15, 16)
     313        table.attach(alignment, 0, 1, 16, 17)
    298314
    299315        self._mlw = gtk.Label("35000")
     
    301317                                  xscale = 0.0, yscale = 0.0)
    302318        alignment.add(self._mlw)
    303         table.attach(alignment, 1, 2, 15, 16)
    304        
    305         table.attach(gtk.Label("kg"), 2, 3, 15, 16)
     319        table.attach(alignment, 1, 2, 16, 17)
     320       
     321        table.attach(gtk.Label("kg"), 2, 3, 16, 17)
    306322
    307323        self.show_all()
     
    322338        self._weightsTable.set_sensitive(False)
    323339       
    324         self._crew = -1
     340        self._cockpitCrew = -1
     341        self._cabinCrew = -1
    325342        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
    327348        self._bag = -1
    328349        self._cargo = -1
     
    343364    def _setupCalculated(self):
    344365        """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,))
    352383           
    353384        if self._pax<0:
     
    423454        It returns a tuple with these two items. If any of the items cannot be
    424455        calculated, that is -1."""
    425         if self._crew<0 or self._pax<0 or \
     456        if self._cockpitCrew<0 or self._cabinCrew<0 or self._pax<0 or \
    426457               self._bag<0 or self._cargo<0 or self._mail<0:
    427458            payload = -1
    428459        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
    431467
    432468        if payload<0 or self._dowValue<0:
     
    444480        self._gui.logger.untimedMessage("The weight calculation help function was used by the pilot")
    445481
    446         self._crew = self._gui.numCrew
     482        self._cockpitCrew = self._gui.numCockpitCrew
     483        self._cabinCrew = self._gui.numCabinCrew
    447484        self._pax = self._gui.numPassengers
    448485        self._bag = self._gui.bagWeight
     
    451488       
    452489        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
    453494        self._humanWeight = aircraft.humanWeight
    454495        self._dowValue = aircraft.dow
Note: See TracChangeset for help on using the changeset viewer.