Ignore:
File:
1 edited

Legend:

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

    r872 r908  
    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        numCockpitCrew = bookedFlight.numCockpitCrew
     2278        numCabinCrew = bookedFlight.numCabinCrew
     2279        numCrew = numCockpitCrew + numCabinCrew
     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:
Note: See TracChangeset for help on using the changeset viewer.