Changeset 303:8d5607e36aed


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

The number of the crew and the passengers as well as all payload weights can be edited

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r284 r303  
    485485msgstr "Crew:"
    486486
     487msgid "payload_crew_tooltip"
     488msgstr "The number of the crew members on your flight."
     489
    487490msgid "payload_pax"
    488491msgstr "Passengers:"
    489492
     493msgid "payload_pax_tooltip"
     494msgstr "The number of passengers on your flight."
     495
    490496msgid "payload_bag"
    491497msgstr "Baggage:"
    492498
     499msgid "payload_bag_tooltip"
     500msgstr "The weight of the baggage on your flight."
     501
    493502msgid "payload_cargo"
    494503msgstr "_Cargo:"
    495504
    496505msgid "payload_cargo_tooltip"
    497 msgstr "The weight of the cargo for your flight."
     506msgstr "The weight of the cargo on your flight."
    498507
    499508msgid "payload_mail"
    500509msgstr "Mail:"
     510
     511msgid "payload_mail_tooltip"
     512msgstr "The weight of the mail on your flight."
    501513
    502514msgid "payload_zfw"
  • src/mlx/flight.py

    r298 r303  
    8989
    9090    @property
     91    def numCrew(self):
     92        """Get the number of crew members on the flight."""
     93        return self._gui.numCrew
     94
     95    @property
     96    def numPassengers(self):
     97        """Get the number of passengers on the flight."""
     98        return self._gui.numPassengers
     99
     100    @property
     101    def bagWeight(self):
     102        """Get the baggage weight for the flight."""
     103        return self._gui.bagWeight
     104
     105    @property
    91106    def cargoWeight(self):
    92107        """Get the cargo weight for the flight."""
    93108        return self._gui.cargoWeight
     109
     110    @property
     111    def mailWeight(self):
     112        """Get the mail weight for the flight."""
     113        return self._gui.mailWeight
    94114
    95115    @property
  • src/mlx/gui/flight.py

    r300 r303  
    10161016        table.attach(label, 0, 1, 0, 1)
    10171017
    1018         self._numCrew = gtk.Label()
     1018        self._numCrew = IntegerEntry(defaultValue = 0)
    10191019        self._numCrew.set_width_chars(6)
    1020         self._numCrew.set_alignment(1.0, 0.5)
     1020        self._numCrew.connect("integer-changed", self._weightChanged)
     1021        self._numCrew.set_tooltip_text(xstr("payload_crew_tooltip"))
    10211022        table.attach(self._numCrew, 1, 2, 0, 1)
     1023        label.set_mnemonic_widget(self._numCrew)
    10221024       
    10231025        label = gtk.Label(xstr("payload_pax"))
     
    10251027        table.attach(label, 0, 1, 1, 2)
    10261028
    1027         self._numPassengers = gtk.Label()
     1029        self._numPassengers = IntegerEntry(defaultValue = 0)       
    10281030        self._numPassengers.set_width_chars(6)
    1029         self._numPassengers.set_alignment(1.0, 0.5)
     1031        self._numPassengers.connect("integer-changed", self._weightChanged)
     1032        self._numPassengers.set_tooltip_text(xstr("payload_pax_tooltip"))
    10301033        table.attach(self._numPassengers, 1, 2, 1, 2)
     1034        label.set_mnemonic_widget(self._numPassengers)
    10311035       
    10321036        label = gtk.Label(xstr("payload_bag"))
     
    10341038        table.attach(label, 0, 1, 2, 3)
    10351039
    1036         self._bagWeight = gtk.Label()
     1040        self._bagWeight = IntegerEntry(defaultValue = 0)
    10371041        self._bagWeight.set_width_chars(6)
    1038         self._bagWeight.set_alignment(1.0, 0.5)
     1042        self._bagWeight.connect("integer-changed", self._weightChanged)
     1043        self._bagWeight.set_tooltip_text(xstr("payload_bag_tooltip"))
    10391044        table.attach(self._bagWeight, 1, 2, 2, 3)
     1045        label.set_mnemonic_widget(self._bagWeight)
    10401046
    10411047        table.attach(gtk.Label("kg"), 2, 3, 2, 3)
     
    10481054        self._cargoWeight = IntegerEntry(defaultValue = 0)
    10491055        self._cargoWeight.set_width_chars(6)
    1050         self._cargoWeight.connect("integer-changed", self._cargoWeightChanged)
     1056        self._cargoWeight.connect("integer-changed", self._weightChanged)
    10511057        self._cargoWeight.set_tooltip_text(xstr("payload_cargo_tooltip"))
    10521058        table.attach(self._cargoWeight, 1, 2, 3, 4)
     
    10591065        table.attach(label, 0, 1, 4, 5)
    10601066
    1061         self._mailWeight = gtk.Label()
     1067        self._mailWeight = IntegerEntry(defaultValue = 0)
    10621068        self._mailWeight.set_width_chars(6)
    1063         self._mailWeight.set_alignment(1.0, 0.5)
     1069        self._mailWeight.connect("integer-changed", self._weightChanged)
     1070        self._mailWeight.set_tooltip_text(xstr("payload_mail_tooltip"))
    10641071        table.attach(self._mailWeight, 1, 2, 4, 5)
     1072        label.set_mnemonic_widget(self._mailWeight)
    10651073
    10661074        table.attach(gtk.Label("kg"), 2, 3, 4, 5)
     
    10971105
    10981106    @property
     1107    def numCrew(self):
     1108        """The number of the crew members on the flight."""
     1109        return self._numCrew.get_int()
     1110       
     1111    @property
     1112    def numPassengers(self):
     1113        """The number of the passengers on the flight."""
     1114        return self._numPassengers.get_int()
     1115       
     1116    @property
     1117    def bagWeight(self):
     1118        """Get the bag weight entered."""
     1119        return self._bagWeight.get_int()
     1120
     1121    @property
    10991122    def cargoWeight(self):
    11001123        """Get the cargo weight entered."""
    11011124        return self._cargoWeight.get_int()
    11021125
     1126    @property
     1127    def mailWeight(self):
     1128        """Get the bag weight entered."""
     1129        return self._mailWeight.get_int()
     1130
    11031131    def activate(self):
    11041132        """Setup the information."""
    11051133        bookedFlight = self._wizard._bookedFlight
    1106         self._numCrew.set_text(str(bookedFlight.numCrew))
    1107         self._numPassengers.set_text(str(bookedFlight.numPassengers))
    1108         self._bagWeight.set_text(str(bookedFlight.bagWeight))
     1134
     1135        self._numCrew.set_int(bookedFlight.numCrew)
     1136        self._numCrew.set_sensitive(True)
     1137        self._numPassengers.set_int(bookedFlight.numPassengers)
     1138        self._numPassengers.set_sensitive(True)
     1139
     1140        self._bagWeight.set_int(bookedFlight.bagWeight)
     1141        self._bagWeight.set_sensitive(True)
    11091142        self._cargoWeight.set_int(bookedFlight.cargoWeight)
    11101143        self._cargoWeight.set_sensitive(True)
    1111         self._mailWeight.set_text(str(bookedFlight.mailWeight))
     1144        self._mailWeight.set_int(bookedFlight.mailWeight)
     1145        self._mailWeight.set_sensitive(True)
     1146       
    11121147        self._simulatorZFW.set_text("-")
    11131148        self._simulatorZFWValue = None
     
    11171152    def finalize(self):
    11181153        """Finalize the payload page."""
     1154        self._numCrew.set_sensitive(False)
     1155        self._numPassengers.set_sensitive(False)
     1156        self._bagWeight.set_sensitive(False)
    11191157        self._cargoWeight.set_sensitive(False)
     1158        self._mailWeight.set_sensitive(False)
    11201159        self._wizard.gui.initializeWeightHelp()
    11211160
     
    11231162        """Calculate the ZFW value."""
    11241163        zfw = self._wizard.gui._flight.aircraft.dow
    1125         bookedFlight = self._wizard._bookedFlight
    1126         zfw += (bookedFlight.numCrew + bookedFlight.numPassengers) * 82
    1127         zfw += bookedFlight.bagWeight
     1164        zfw += (self._numCrew.get_int() + self._numPassengers.get_int()) * 82
     1165        zfw += self._bagWeight.get_int()
    11281166        zfw += self._cargoWeight.get_int()
    1129         zfw += bookedFlight.mailWeight
     1167        zfw += self._mailWeight.get_int()
    11301168        return zfw
    11311169       
     
    11421180        self._calculatedZFW.set_markup(markupBegin + str(zfw) + markupEnd)
    11431181
    1144     def _cargoWeightChanged(self, entry, weight):
    1145         """Called when the cargo weight has changed."""
     1182    def _weightChanged(self, entry, weight):
     1183        """Called when one of the weight values or humanm counts has changed."""
    11461184        self._updateCalculatedZFW()
    11471185           
     
    28492887
    28502888    @property
     2889    def numCrew(self):
     2890        """Get the number of crew members."""
     2891        return self._payloadPage.numCrew
     2892
     2893    @property
     2894    def numPassengers(self):
     2895        """Get the number of passengers."""
     2896        return self._payloadPage.numPassengers
     2897
     2898    @property
     2899    def bagWeight(self):
     2900        """Get the baggage weight."""
     2901        return self._payloadPage.bagWeight
     2902
     2903    @property
    28512904    def cargoWeight(self):
    2852         """Get the calculated ZFW value."""
     2905        """Get the cargo weight."""
    28532906        return self._payloadPage.cargoWeight
     2907
     2908    @property
     2909    def mailWeight(self):
     2910        """Get the mail weight."""
     2911        return self._payloadPage.mailWeight
    28542912
    28552913    @property
  • src/mlx/gui/gui.py

    r300 r303  
    223223
    224224    @property
     225    def numCrew(self):
     226        """Get the number of crew members."""
     227        return self._wizard.numCrew
     228
     229    @property
     230    def numPassengers(self):
     231        """Get the number of passengers."""
     232        return self._wizard.numPassengers
     233
     234    @property
     235    def bagWeight(self):
     236        """Get the bag weight."""
     237        return self._wizard.bagWeight
     238
     239    @property
    225240    def cargoWeight(self):
    226241        """Get the cargo weight."""
    227242        return self._wizard.cargoWeight
     243
     244    @property
     245    def mailWeight(self):
     246        """Get the mail weight."""
     247        return self._wizard.mailWeight
    228248
    229249    @property
  • src/mlx/gui/pirep.py

    r300 r303  
    228228            self._rating.set_text("%.1f %%" % (rating,))
    229229
     230        self._flownNumCrew.set_text("%d" % (pirep.numCrew,))
     231        self._flownNumPassengers.set_text("%d" % (pirep.numPassengers,))
     232        self._flownBagWeight.set_text("%.0f" % (pirep.bagWeight,))
    230233        self._flownCargoWeight.set_text("%.0f" % (pirep.cargoWeight,))
     234        self._flownMailWeight.set_text("%.0f" % (pirep.mailWeight,))
    231235        self._flightType.set_text(xstr("flighttype_" +
    232236                                       flightType2string(pirep.flightType)))
     
    526530        """Build the frame for the miscellaneous data."""       
    527531        (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_miscellaneous"))
    528        
    529         dataBox = gtk.HBox()
    530         mainBox.pack_start(dataBox, False, False, 0)
    531        
     532
     533        table = gtk.Table(3, 2)
     534        mainBox.pack_start(table, False, False, 0)
     535        table.set_row_spacings(4)
     536        table.set_col_spacings(8)       
     537       
     538        self._flownNumPassengers = \
     539            PIREPViewer.tableAttach(table, 0, 0,
     540                                    xstr("pirepView_numPassengers"),
     541                                    width = 4)
     542
     543        self._flownNumCrew = \
     544            PIREPViewer.tableAttach(table, 1, 0,
     545                                    xstr("pirepView_numCrew"),
     546                                    width = 3)
     547
     548        self._flownBagWeight = \
     549            PIREPViewer.tableAttach(table, 0, 1,
     550                                    xstr("pirepView_bagWeight"),
     551                                    width = 5)
     552
    532553        self._flownCargoWeight = \
    533             PIREPViewer.addLabeledData(dataBox,
    534                                        xstr("pirepView_cargoWeight"),
    535                                        width = 6)
     554            PIREPViewer.tableAttach(table, 1, 1,
     555                                    xstr("pirepView_cargoWeight"),
     556                                    width = 6)
     557
     558        self._flownMailWeight = \
     559            PIREPViewer.tableAttach(table, 2, 1,
     560                                    xstr("pirepView_mailWeight"),
     561                                    width = 5)
    536562
    537563        self._flightType = \
    538             PIREPViewer.addLabeledData(dataBox,
    539                                        xstr("pirepView_flightType"),
    540                                        width = 15)
     564            PIREPViewer.tableAttach(table, 0, 2,
     565                                    xstr("pirepView_flightType"),
     566                                    width = 15)
    541567           
    542568        self._online = \
    543             PIREPViewer.addLabeledData(dataBox,
    544                                        xstr("pirepView_online"),
    545                                        width = 5)
     569            PIREPViewer.tableAttach(table, 1, 2,
     570                                    xstr("pirepView_online"),
     571                                    width = 5)
    546572
    547573        PIREPViewer.addVFiller(mainBox)
  • src/mlx/gui/weighthelp.py

    r300 r303  
    444444        self._gui.logger.untimedMessage("The weight calculation help function was used by the pilot")
    445445
    446         bookedFlight = self._gui.bookedFlight
    447         self._crew = bookedFlight.numCrew
    448         self._pax = bookedFlight.numPassengers
    449         self._bag = bookedFlight.bagWeight
     446        self._crew = self._gui.numCrew
     447        self._pax = self._gui.numPassengers
     448        self._bag = self._gui.bagWeight
    450449        self._cargo = self._gui.cargoWeight
    451         self._mail = bookedFlight.mailWeight
     450        self._mail = self._gui.mailWeight
    452451       
    453452        aircraft = self._gui.flight.aircraft
  • src/mlx/pirep.py

    r298 r303  
    4141        try:
    4242            with open(path, "rb") as f:
    43                 return pickle.load(f)
     43                pirep = pickle.load(f)
     44                if "numCrew" not in dir(pirep):
     45                    pirep.numCrew = pirep.bookedFlight.numCrew
     46                if "numPassengers" not in dir(pirep):
     47                    pirep.numPassengers = pirep.bookedFlight.numPassengers
     48                if "bagWeight" not in dir(pirep):
     49                    pirep.bagWeight = pirep.bookedFlight.bagWeight
     50                if "mailWeight" not in dir(pirep):
     51                    pirep.mailWeight = pirep.bookedFlight.mailWeight
     52                return pirep
    4453        except Exception, e:
    4554            print "Failed loading PIREP from %s: %s" % (path, str(e))
     
    4958        """Initialize the PIREP from the given flight."""
    5059        self.bookedFlight = flight.bookedFlight
     60
     61        self.numCrew = flight.numCrew
     62        self.numPassengers = flight.numPassengers
     63        self.bagWeight = flight.bagWeight
    5164        self.cargoWeight = flight.cargoWeight
     65        self.mailWeight = flight.mailWeight
    5266       
    5367        self.filedCruiseAltitude = flight.filedCruiseAltitude
  • src/mlx/web.py

    r298 r303  
    684684        data["depap"] = bookedFlight.departureICAO
    685685        data["arrap"] = bookedFlight.arrivalICAO
    686         data["pass"] = str(bookedFlight.numPassengers)
    687         data["crew"] = str(bookedFlight.numCrew)
     686        data["pass"] = str(pirep.numPassengers)
     687        data["crew"] = str(pirep.numCrew)
    688688        data["cargo"] = str(pirep.cargoWeight)
    689         data["bag"] = str(bookedFlight.bagWeight)
    690         data["mail"] = str(bookedFlight.mailWeight)
     689        data["bag"] = str(pirep.bagWeight)
     690        data["mail"] = str(pirep.mailWeight)
    691691       
    692692        data["flttype"] = SendPIREP._flightTypes[pirep.flightType]
Note: See TracChangeset for help on using the changeset viewer.