Ignore:
File:
1 edited

Legend:

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

    r899 r303  
    5656
    5757       
    58         self._weightsTable = table = gtk.Table(17, 5)
     58        self._weightsTable = table = gtk.Table(16, 5)
    5959        table.set_homogeneous(False)
    6060        table.set_row_spacings(4)
     
    9191       
    9292
    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)
    9897        table.attach(alignment, 0, 1, 1, 2)
    9998
    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)
     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)
    104103        table.attach(alignment, 1, 2, 1, 2)
    105104       
    106105        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)
    122106
    123107        text = xstr("weighthelp_pax") % ("999",)
     
    128112                                  xscale = 0.0, yscale = 0.0)
    129113        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)
    130128        table.attach(alignment, 0, 1, 3, 4)
    131129
    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)
    136134        table.attach(alignment, 1, 2, 3, 4)
    137135       
    138136        table.attach(gtk.Label("kg"), 2, 3, 3, 4)
    139137       
    140         label = gtk.Label(xstr("weighthelp_baggage"))
     138        label = gtk.Label(xstr("weighthelp_cargo"))
    141139        alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5,
    142140                                  xscale = 0.0, yscale = 0.0)
     
    144142        table.attach(alignment, 0, 1, 4, 5)
    145143
    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)
    150148        table.attach(alignment, 1, 2, 4, 5)
    151149       
    152150        table.attach(gtk.Label("kg"), 2, 3, 4, 5)
    153151       
    154         label = gtk.Label(xstr("weighthelp_cargo"))
     152        label = gtk.Label(xstr("weighthelp_mail"))
    155153        alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5,
    156154                                  xscale = 0.0, yscale = 0.0)
     
    158156        table.attach(alignment, 0, 1, 5, 6)
    159157
    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)
    164162        table.attach(alignment, 1, 2, 5, 6)
    165163       
    166164        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)
    183167
    184168        label = gtk.Label("<b>" + xstr("weighthelp_payload") + "</b>")
     
    187171                                  xscale = 0.0, yscale = 0.0)
    188172        alignment.add(label)
    189         table.attach(alignment, 0, 1, 8, 9)
     173        table.attach(alignment, 0, 1, 7, 8)
    190174
    191175        self._payload = gtk.Label("<b>32000</b>")
     
    194178                                  xscale = 0.0, yscale = 0.0)
    195179        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)
    199183
    200184        self._fsPayload = gtk.Label("<b>32001</b>")
     
    203187                                  xscale = 0.0, yscale = 0.0)
    204188        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)
    205212        table.attach(alignment, 3, 4, 8, 9)
    206213       
    207214        table.attach(gtk.Label("kg"), 4, 5, 8, 9)
    208215
    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)
    235219
    236220        label = gtk.Label("<b>" + xstr("weighthelp_zfw") + "</b>")
     
    239223                                  xscale = 0.0, yscale = 0.0)
    240224        alignment.add(label)
    241         table.attach(alignment, 0, 1, 11, 12)
     225        table.attach(alignment, 0, 1, 10, 11)
    242226
    243227        self._zfw = gtk.Label("<b>122000</b>")
     
    246230                                  xscale = 0.0, yscale = 0.0)
    247231        alignment.add(self._zfw)
    248         table.attach(alignment, 1, 2, 11, 12)
    249        
    250         table.attach(gtk.Label("kg"), 2, 3, 11, 12)
     232        table.attach(alignment, 1, 2, 10, 11)
     233       
     234        table.attach(gtk.Label("kg"), 2, 3, 10, 11)
    251235
    252236        self._fsZFW = gtk.Label("<b>124000</b>")
     
    255239                                  xscale = 0.0, yscale = 0.0)
    256240        alignment.add(self._fsZFW)
    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)
     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)
    262246       
    263247        label = gtk.Label(xstr("weighthelp_gross"))
     
    266250                                  xscale = 0.0, yscale = 0.0)
    267251        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)
    268267        table.attach(alignment, 0, 1, 13, 14)
    269268
    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_mzfw"))
     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"))
    279278        label.set_use_markup(True)
    280279        alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5,
     
    283282        table.attach(alignment, 0, 1, 14, 15)
    284283
    285         self._mzfw = gtk.Label("35000")
    286         alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
    287                                   xscale = 0.0, yscale = 0.0)
    288         alignment.add(self._mzfw)
     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)
    289288        table.attach(alignment, 1, 2, 14, 15)
    290289       
    291290        table.attach(gtk.Label("kg"), 2, 3, 14, 15)
    292291
    293         label = gtk.Label(xstr("weighthelp_mtow"))
     292        label = gtk.Label(xstr("weighthelp_mlw"))
    294293        label.set_use_markup(True)
    295294        alignment = gtk.Alignment(xalign = 0.0, yalign = 0.5,
     
    298297        table.attach(alignment, 0, 1, 15, 16)
    299298
    300         self._mtow = gtk.Label("35000")
    301         alignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
    302                                   xscale = 0.0, yscale = 0.0)
    303         alignment.add(self._mtow)
     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)
    304303        table.attach(alignment, 1, 2, 15, 16)
    305304       
    306305        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)
    322306
    323307        self.show_all()
     
    338322        self._weightsTable.set_sensitive(False)
    339323       
    340         self._cockpitCrew = -1
    341         self._cabinCrew = -1
     324        self._crew = -1
    342325        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
    348327        self._bag = -1
    349328        self._cargo = -1
     
    364343    def _setupCalculated(self):
    365344        """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,))
    383352           
    384353        if self._pax<0:
     
    454423        It returns a tuple with these two items. If any of the items cannot be
    455424        calculated, that is -1."""
    456         if self._cockpitCrew<0 or self._cabinCrew<0 or self._pax<0 or \
     425        if self._crew<0 or self._pax<0 or \
    457426               self._bag<0 or self._cargo<0 or self._mail<0:
    458427            payload = -1
    459428        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
    467431
    468432        if payload<0 or self._dowValue<0:
     
    480444        self._gui.logger.untimedMessage("The weight calculation help function was used by the pilot")
    481445
    482         self._cockpitCrew = self._gui.numCockpitCrew
    483         self._cabinCrew = self._gui.numCabinCrew
     446        self._crew = self._gui.numCrew
    484447        self._pax = self._gui.numPassengers
    485448        self._bag = self._gui.bagWeight
     
    488451       
    489452        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
    494453        self._humanWeight = aircraft.humanWeight
    495454        self._dowValue = aircraft.dow
Note: See TracChangeset for help on using the changeset viewer.