Changeset 899:ec5238c77005 for src/mlx


Ignore:
Timestamp:
03/16/18 09:00:12 (7 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)

Location:
src/mlx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r898 r899  
    128128        self._landingAntiIceLineID = None
    129129
    130         self.humanWeight = 82.0
     130        self.cockpitCrewWeight = 85.0
     131        self.cabinCrewWeight = 75.0
     132        self.humanWeight = 84.0
    131133
    132134        self.initialClimbSpeedAltitude = 1500
  • src/mlx/flight.py

    r846 r899  
    152152
    153153    @property
     154    def numCockpitCrew(self):
     155        """Get the number of cockpit crew members on the flight."""
     156        return self._gui.numCockpitCrew
     157
     158    @property
     159    def numCabinCrew(self):
     160        """Get the number of cabon crew members on the flight."""
     161        return self._gui.numCabinCrew
     162
     163    @property
    154164    def numCrew(self):
    155165        """Get the number of crew members on the flight."""
    156         return self._gui.numCrew
     166        return self.numCockpitCrew + self.numCabinCrew
    157167
    158168    @property
  • src/mlx/gui/flight.py

    r872 r899  
    3232#
    3333# This module implements the main tab of the application, the flight
    34 # wizard. The wizard consists of \ref Page "pages", that come one after the
     34# wizard. The wizard consists of \ref Page "pages", that come one yafter the
    3535# other. As some pages might be skipped, the pages dynamically store the index
    3636# of the previous page so that going back to it is simpler. The \ref
     
    21252125                                  xscale = 0.0, yscale = 0.0)
    21262126
    2127         table = gtk.Table(7, 3)
     2127        table = gtk.Table(8, 3)
    21282128        table.set_row_spacings(4)
    21292129        table.set_col_spacings(16)
     
    21322132        self.setMainWidget(alignment)
    21332133
    2134         label = gtk.Label(xstr("payload_crew"))
     2134        label = gtk.Label(xstr("payload_cockpit_crew"))
    21352135        label.set_use_underline(True)
    21362136        label.set_alignment(0.0, 0.5)
    21372137        table.attach(label, 0, 1, 0, 1)
    21382138
    2139         self._numCrew = IntegerEntry(defaultValue = 0)
    2140         self._numCrew.set_width_chars(6)
    2141         self._numCrew.connect("integer-changed", self._weightChanged)
    2142         self._numCrew.set_tooltip_text(xstr("payload_crew_tooltip"))
    2143         table.attach(self._numCrew, 1, 2, 0, 1)
    2144         label.set_mnemonic_widget(self._numCrew)
     2139        self._numCockpitCrew = IntegerEntry(defaultValue = 0)
     2140        self._numCockpitCrew.set_width_chars(6)
     2141        self._numCockpitCrew.connect("integer-changed", self._weightChanged)
     2142        self._numCockpitCrew.set_tooltip_text(xstr("payload_cockpit_crew_tooltip"))
     2143        table.attach(self._numCockpitCrew, 1, 2, 0, 1)
     2144        label.set_mnemonic_widget(self._numCockpitCrew)
     2145
     2146        label = gtk.Label(xstr("payload_cabin_crew"))
     2147        label.set_use_underline(True)
     2148        label.set_alignment(0.0, 0.5)
     2149        table.attach(label, 0, 1, 1, 2)
     2150
     2151        self._numCabinCrew = IntegerEntry(defaultValue = 0)
     2152        self._numCabinCrew.set_width_chars(6)
     2153        self._numCabinCrew.connect("integer-changed", self._weightChanged)
     2154        self._numCabinCrew.set_tooltip_text(xstr("payload_cabin_crew_tooltip"))
     2155        table.attach(self._numCabinCrew, 1, 2, 1, 2)
     2156        label.set_mnemonic_widget(self._numCabinCrew)
    21452157
    21462158        label = gtk.Label(xstr("payload_pax"))
    21472159        label.set_use_underline(True)
    21482160        label.set_alignment(0.0, 0.5)
    2149         table.attach(label, 0, 1, 1, 2)
     2161        table.attach(label, 0, 1, 2, 3)
    21502162
    21512163        self._numPassengers = IntegerEntry(defaultValue = 0)
     
    21532165        self._numPassengers.connect("integer-changed", self._weightChanged)
    21542166        self._numPassengers.set_tooltip_text(xstr("payload_pax_tooltip"))
    2155         table.attach(self._numPassengers, 1, 2, 1, 2)
     2167        table.attach(self._numPassengers, 1, 2, 2, 3)
    21562168        label.set_mnemonic_widget(self._numPassengers)
    21572169
     
    21592171        label.set_use_underline(True)
    21602172        label.set_alignment(0.0, 0.5)
    2161         table.attach(label, 0, 1, 2, 3)
     2173        table.attach(label, 0, 1, 3, 4)
    21622174
    21632175        self._bagWeight = IntegerEntry(defaultValue = 0)
     
    21652177        self._bagWeight.connect("integer-changed", self._weightChanged)
    21662178        self._bagWeight.set_tooltip_text(xstr("payload_bag_tooltip"))
    2167         table.attach(self._bagWeight, 1, 2, 2, 3)
     2179        table.attach(self._bagWeight, 1, 2, 3, 4)
    21682180        label.set_mnemonic_widget(self._bagWeight)
    21692181
    2170         table.attach(gtk.Label("kg"), 2, 3, 2, 3)
     2182        table.attach(gtk.Label("kg"), 2, 3, 3, 4)
    21712183
    21722184        label = gtk.Label(xstr("payload_cargo"))
    21732185        label.set_use_underline(True)
    21742186        label.set_alignment(0.0, 0.5)
    2175         table.attach(label, 0, 1, 3, 4)
     2187        table.attach(label, 0, 1, 4, 5)
    21762188
    21772189        self._cargoWeight = IntegerEntry(defaultValue = 0)
     
    21792191        self._cargoWeight.connect("integer-changed", self._weightChanged)
    21802192        self._cargoWeight.set_tooltip_text(xstr("payload_cargo_tooltip"))
    2181         table.attach(self._cargoWeight, 1, 2, 3, 4)
     2193        table.attach(self._cargoWeight, 1, 2, 4, 5)
    21822194        label.set_mnemonic_widget(self._cargoWeight)
    21832195
    2184         table.attach(gtk.Label("kg"), 2, 3, 3, 4)
     2196        table.attach(gtk.Label("kg"), 2, 3, 4, 5)
    21852197
    21862198        label = gtk.Label(xstr("payload_mail"))
    21872199        label.set_use_underline(True)
    21882200        label.set_alignment(0.0, 0.5)
    2189         table.attach(label, 0, 1, 4, 5)
     2201        table.attach(label, 0, 1, 5, 6)
    21902202
    21912203        self._mailWeight = IntegerEntry(defaultValue = 0)
     
    21932205        self._mailWeight.connect("integer-changed", self._weightChanged)
    21942206        self._mailWeight.set_tooltip_text(xstr("payload_mail_tooltip"))
    2195         table.attach(self._mailWeight, 1, 2, 4, 5)
     2207        table.attach(self._mailWeight, 1, 2, 5, 6)
    21962208        label.set_mnemonic_widget(self._mailWeight)
    21972209
    2198         table.attach(gtk.Label("kg"), 2, 3, 4, 5)
     2210        table.attach(gtk.Label("kg"), 2, 3, 5, 6)
    21992211
    22002212        label = gtk.Label("<b>" + xstr("payload_zfw") + "</b>")
    22012213        label.set_alignment(0.0, 0.5)
    22022214        label.set_use_markup(True)
    2203         table.attach(label, 0, 1, 5, 6)
     2215        table.attach(label, 0, 1, 6, 7)
    22042216
    22052217        self._calculatedZFW = gtk.Label()
    22062218        self._calculatedZFW.set_width_chars(6)
    22072219        self._calculatedZFW.set_alignment(1.0, 0.5)
    2208         table.attach(self._calculatedZFW, 1, 2, 5, 6)
    2209 
    2210         table.attach(gtk.Label("kg"), 2, 3, 5, 6)
     2220        table.attach(self._calculatedZFW, 1, 2, 6, 7)
     2221
     2222        table.attach(gtk.Label("kg"), 2, 3, 6, 7)
    22112223
    22122224        self._zfwButton = gtk.Button(xstr("payload_fszfw"))
     
    22142226        self._zfwButton.connect("clicked", self._zfwRequested)
    22152227        self._zfwButton.set_tooltip_text(xstr("payload_fszfw_tooltip"))
    2216         table.attach(self._zfwButton, 0, 1, 6, 7)
     2228        table.attach(self._zfwButton, 0, 1, 7, 8)
    22172229
    22182230        self._simulatorZFW = gtk.Label("-")
    22192231        self._simulatorZFW.set_width_chars(6)
    22202232        self._simulatorZFW.set_alignment(1.0, 0.5)
    2221         table.attach(self._simulatorZFW, 1, 2, 6, 7)
     2233        table.attach(self._simulatorZFW, 1, 2, 7, 8)
    22222234        self._simulatorZFWValue = None
    22232235
    2224         table.attach(gtk.Label("kg"), 2, 3, 6, 7)
     2236        table.attach(gtk.Label("kg"), 2, 3, 7, 8)
    22252237
    22262238        self.addCancelFlightButton()
     
    22292241
    22302242    @property
    2231     def numCrew(self):
    2232         """The number of the crew members on the flight."""
    2233         return self._numCrew.get_int()
     2243    def numCockpitCrew(self):
     2244        """The number of the cockpit crew members on the flight."""
     2245        return self._numCockpitCrew.get_int()
     2246
     2247    @property
     2248    def numCabinCrew(self):
     2249        """The number of the cabin crew members on the flight."""
     2250        return self._numCabinCrew.get_int()
    22342251
    22352252    @property
     
    22562273        """Setup the information."""
    22572274        bookedFlight = self._wizard._bookedFlight
    2258 
    2259         self._numCrew.set_int(bookedFlight.numCrew)
    2260         self._numCrew.set_sensitive(True)
     2275        aircraft = self._wizard.gui._flight.aircraft
     2276
     2277        numCrew = bookedFlight.numCrew
     2278        numCockpitCrew = min(numCrew, aircraft.dowCockpit)
     2279        numCabinCrew = numCrew - numCockpitCrew
     2280
     2281        self._numCockpitCrew.set_int(numCockpitCrew)
     2282        self._numCockpitCrew.set_sensitive(True)
     2283        self._numCabinCrew.set_int(numCabinCrew)
     2284        self._numCabinCrew.set_sensitive(True)
    22612285        self._numPassengers.set_int(bookedFlight.numPassengers)
    22622286        self._numPassengers.set_sensitive(True)
     
    22762300    def finalize(self):
    22772301        """Finalize the payload page."""
    2278         self._numCrew.set_sensitive(False)
     2302        self._numCockpitCrew.set_sensitive(False)
     2303        self._numCabinCrew.set_sensitive(False)
    22792304        self._numPassengers.set_sensitive(False)
    22802305        self._bagWeight.set_sensitive(False)
     
    22852310    def calculateZFW(self):
    22862311        """Calculate the ZFW value."""
     2312        aircraft = self._wizard.gui._flight.aircraft
    22872313        zfw = self._wizard.gui._flight.aircraft.dow
    2288         zfw += (self._numCrew.get_int() + self._numPassengers.get_int()) * 82
     2314        zfw += (self.numCockpitCrew - aircraft.dowCockpit) * aircraft.cockpitCrewWeight
     2315        zfw += (self.numCabinCrew - aircraft.dowCabin) * aircraft.cabinCrewWeight
     2316        zfw += (self._numPassengers.get_int()) * aircraft.humanWeight
    22892317        zfw += self._bagWeight.get_int()
    22902318        zfw += self._cargoWeight.get_int()
    22912319        zfw += self._mailWeight.get_int()
     2320        zfw = int(zfw)
    22922321        return zfw
    22932322
     
    55415570
    55425571    @property
    5543     def numCrew(self):
    5544         """Get the number of crew members."""
    5545         return self._payloadPage.numCrew
     5572    def numCockpitCrew(self):
     5573        """Get the number of cockpit crew members."""
     5574        return self._payloadPage.numCockpitCrew
     5575
     5576    @property
     5577    def numCabinCrew(self):
     5578        """Get the number of cabin crew members."""
     5579        return self._payloadPage.numCabinCrew
    55465580
    55475581    @property
     
    58915925                self._loginResult = result
    58925926                self.gui.loginSuccessful()
     5927                acft.setupTypes(result.aircraftTypes)
    58935928            else:
    58945929                if isReload:
  • src/mlx/gui/gui.py

    r869 r899  
    264264
    265265    @property
    266     def numCrew(self):
    267         """Get the number of crew members."""
    268         return self._wizard.numCrew
     266    def numCockpitCrew(self):
     267        """Get the number of cockpit crew members."""
     268        return self._wizard.numCockpitCrew
     269
     270    @property
     271    def numCabinCrew(self):
     272        """Get the number of cabin crew members."""
     273        return self._wizard.numCabinCrew
    269274
    270275    @property
  • 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.