Ignore:
File:
1 edited

Legend:

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

    r908 r872  
    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 yafter the
     34# wizard. The wizard consists of \ref Page "pages", that come one after 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(8, 3)
     2127        table = gtk.Table(7, 3)
    21282128        table.set_row_spacings(4)
    21292129        table.set_col_spacings(16)
     
    21322132        self.setMainWidget(alignment)
    21332133
    2134         label = gtk.Label(xstr("payload_cockpit_crew"))
     2134        label = gtk.Label(xstr("payload_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._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"))
     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)
     2145
     2146        label = gtk.Label(xstr("payload_pax"))
    21472147        label.set_use_underline(True)
    21482148        label.set_alignment(0.0, 0.5)
    21492149        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)
    2157 
    2158         label = gtk.Label(xstr("payload_pax"))
    2159         label.set_use_underline(True)
    2160         label.set_alignment(0.0, 0.5)
    2161         table.attach(label, 0, 1, 2, 3)
    21622150
    21632151        self._numPassengers = IntegerEntry(defaultValue = 0)
     
    21652153        self._numPassengers.connect("integer-changed", self._weightChanged)
    21662154        self._numPassengers.set_tooltip_text(xstr("payload_pax_tooltip"))
    2167         table.attach(self._numPassengers, 1, 2, 2, 3)
     2155        table.attach(self._numPassengers, 1, 2, 1, 2)
    21682156        label.set_mnemonic_widget(self._numPassengers)
    21692157
     
    21712159        label.set_use_underline(True)
    21722160        label.set_alignment(0.0, 0.5)
    2173         table.attach(label, 0, 1, 3, 4)
     2161        table.attach(label, 0, 1, 2, 3)
    21742162
    21752163        self._bagWeight = IntegerEntry(defaultValue = 0)
     
    21772165        self._bagWeight.connect("integer-changed", self._weightChanged)
    21782166        self._bagWeight.set_tooltip_text(xstr("payload_bag_tooltip"))
    2179         table.attach(self._bagWeight, 1, 2, 3, 4)
     2167        table.attach(self._bagWeight, 1, 2, 2, 3)
    21802168        label.set_mnemonic_widget(self._bagWeight)
    21812169
    2182         table.attach(gtk.Label("kg"), 2, 3, 3, 4)
     2170        table.attach(gtk.Label("kg"), 2, 3, 2, 3)
    21832171
    21842172        label = gtk.Label(xstr("payload_cargo"))
    21852173        label.set_use_underline(True)
    21862174        label.set_alignment(0.0, 0.5)
    2187         table.attach(label, 0, 1, 4, 5)
     2175        table.attach(label, 0, 1, 3, 4)
    21882176
    21892177        self._cargoWeight = IntegerEntry(defaultValue = 0)
     
    21912179        self._cargoWeight.connect("integer-changed", self._weightChanged)
    21922180        self._cargoWeight.set_tooltip_text(xstr("payload_cargo_tooltip"))
    2193         table.attach(self._cargoWeight, 1, 2, 4, 5)
     2181        table.attach(self._cargoWeight, 1, 2, 3, 4)
    21942182        label.set_mnemonic_widget(self._cargoWeight)
    21952183
    2196         table.attach(gtk.Label("kg"), 2, 3, 4, 5)
     2184        table.attach(gtk.Label("kg"), 2, 3, 3, 4)
    21972185
    21982186        label = gtk.Label(xstr("payload_mail"))
    21992187        label.set_use_underline(True)
    22002188        label.set_alignment(0.0, 0.5)
    2201         table.attach(label, 0, 1, 5, 6)
     2189        table.attach(label, 0, 1, 4, 5)
    22022190
    22032191        self._mailWeight = IntegerEntry(defaultValue = 0)
     
    22052193        self._mailWeight.connect("integer-changed", self._weightChanged)
    22062194        self._mailWeight.set_tooltip_text(xstr("payload_mail_tooltip"))
    2207         table.attach(self._mailWeight, 1, 2, 5, 6)
     2195        table.attach(self._mailWeight, 1, 2, 4, 5)
    22082196        label.set_mnemonic_widget(self._mailWeight)
    22092197
    2210         table.attach(gtk.Label("kg"), 2, 3, 5, 6)
     2198        table.attach(gtk.Label("kg"), 2, 3, 4, 5)
    22112199
    22122200        label = gtk.Label("<b>" + xstr("payload_zfw") + "</b>")
    22132201        label.set_alignment(0.0, 0.5)
    22142202        label.set_use_markup(True)
    2215         table.attach(label, 0, 1, 6, 7)
     2203        table.attach(label, 0, 1, 5, 6)
    22162204
    22172205        self._calculatedZFW = gtk.Label()
    22182206        self._calculatedZFW.set_width_chars(6)
    22192207        self._calculatedZFW.set_alignment(1.0, 0.5)
    2220         table.attach(self._calculatedZFW, 1, 2, 6, 7)
    2221 
    2222         table.attach(gtk.Label("kg"), 2, 3, 6, 7)
     2208        table.attach(self._calculatedZFW, 1, 2, 5, 6)
     2209
     2210        table.attach(gtk.Label("kg"), 2, 3, 5, 6)
    22232211
    22242212        self._zfwButton = gtk.Button(xstr("payload_fszfw"))
     
    22262214        self._zfwButton.connect("clicked", self._zfwRequested)
    22272215        self._zfwButton.set_tooltip_text(xstr("payload_fszfw_tooltip"))
    2228         table.attach(self._zfwButton, 0, 1, 7, 8)
     2216        table.attach(self._zfwButton, 0, 1, 6, 7)
    22292217
    22302218        self._simulatorZFW = gtk.Label("-")
    22312219        self._simulatorZFW.set_width_chars(6)
    22322220        self._simulatorZFW.set_alignment(1.0, 0.5)
    2233         table.attach(self._simulatorZFW, 1, 2, 7, 8)
     2221        table.attach(self._simulatorZFW, 1, 2, 6, 7)
    22342222        self._simulatorZFWValue = None
    22352223
    2236         table.attach(gtk.Label("kg"), 2, 3, 7, 8)
     2224        table.attach(gtk.Label("kg"), 2, 3, 6, 7)
    22372225
    22382226        self.addCancelFlightButton()
     
    22412229
    22422230    @property
    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()
     2231    def numCrew(self):
     2232        """The number of the crew members on the flight."""
     2233        return self._numCrew.get_int()
    22512234
    22522235    @property
     
    22732256        """Setup the information."""
    22742257        bookedFlight = self._wizard._bookedFlight
    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)
     2258
     2259        self._numCrew.set_int(bookedFlight.numCrew)
     2260        self._numCrew.set_sensitive(True)
    22852261        self._numPassengers.set_int(bookedFlight.numPassengers)
    22862262        self._numPassengers.set_sensitive(True)
     
    23002276    def finalize(self):
    23012277        """Finalize the payload page."""
    2302         self._numCockpitCrew.set_sensitive(False)
    2303         self._numCabinCrew.set_sensitive(False)
     2278        self._numCrew.set_sensitive(False)
    23042279        self._numPassengers.set_sensitive(False)
    23052280        self._bagWeight.set_sensitive(False)
     
    23102285    def calculateZFW(self):
    23112286        """Calculate the ZFW value."""
    2312         aircraft = self._wizard.gui._flight.aircraft
    23132287        zfw = self._wizard.gui._flight.aircraft.dow
    2314         zfw += (self.numCockpitCrew - aircraft.dowCockpit) * aircraft.cockpitCrewWeight
    2315         zfw += (self.numCabinCrew - aircraft.dowCabin) * aircraft.cabinCrewWeight
    2316         zfw += (self._numPassengers.get_int()) * aircraft.humanWeight
     2288        zfw += (self._numCrew.get_int() + self._numPassengers.get_int()) * 82
    23172289        zfw += self._bagWeight.get_int()
    23182290        zfw += self._cargoWeight.get_int()
    23192291        zfw += self._mailWeight.get_int()
    2320         zfw = int(zfw)
    23212292        return zfw
    23222293
     
    55705541
    55715542    @property
    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
     5543    def numCrew(self):
     5544        """Get the number of crew members."""
     5545        return self._payloadPage.numCrew
    55805546
    55815547    @property
     
    59255891                self._loginResult = result
    59265892                self.gui.loginSuccessful()
    5927                 acft.setupTypes(result.aircraftTypes)
    59285893            else:
    59295894                if isReload:
Note: See TracChangeset for help on using the changeset viewer.