Changeset 1034:4836f52b49cd
- Timestamp:
- 03/14/22 09:58:58 (3 years ago)
- Branch:
- python3
- Phase:
- public
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
locale/en/mlx.po
r1033 r1034 1300 1300 msgid "finish_fuel" 1301 1301 msgstr "Fuel used:" 1302 1303 msgid "finish_type"1304 msgstr "_Type:"1305 1306 msgid "finish_type_tooltip"1307 msgstr "Select the type of the flight."1308 1302 1309 1303 msgid "finish_online" -
locale/hu/mlx.po
r1033 r1034 1301 1301 msgid "finish_fuel" 1302 1302 msgstr "Elhasznált üzemanyag:" 1303 1304 msgid "finish_type"1305 msgstr "_Típus:"1306 1307 msgid "finish_type_tooltip"1308 msgstr "Válaszd ki a repülés típusát."1309 1303 1310 1304 msgid "finish_online" -
src/mlx/const.py
r1033 r1034 300 300 FLIGHTTYPE_SCHEDULED = 0 301 301 302 ## Flight type: old-timer303 FLIGHTTYPE_OLDTIMER = 1304 305 302 ## Flight type: VIP 306 FLIGHTTYPE_VIP = 2303 FLIGHTTYPE_VIP = 1 307 304 308 305 ## Flight type: charter 309 FLIGHTTYPE_CHARTER = 3 306 FLIGHTTYPE_CHARTER = 2 307 308 ## Flight type: old timer (not used anymore) 309 FLIGHTTYPE_OLDTIMER = -1 310 310 311 311 #------------------------------------------------------------------------------- 312 312 313 313 flightTypes = [ FLIGHTTYPE_SCHEDULED, 314 FLIGHTTYPE_OLDTIMER,315 314 FLIGHTTYPE_VIP, 316 FLIGHTTYPE_CHARTER ] 315 FLIGHTTYPE_CHARTER, 316 FLIGHTTYPE_OLDTIMER ] 317 317 318 318 #------------------------------------------------------------------------------- 319 319 320 320 _flightTypeStrings = { FLIGHTTYPE_SCHEDULED : "scheduled", 321 FLIGHTTYPE_OLDTIMER : "ot",322 321 FLIGHTTYPE_VIP : "vip", 323 FLIGHTTYPE_CHARTER : "charter" } 322 FLIGHTTYPE_CHARTER : "charter", 323 FLIGHTTYPE_OLDTIMER : "ot" } 324 324 325 325 def flightType2string(flightType): -
src/mlx/flight.py
r1033 r1034 54 54 55 55 @staticmethod 56 def isTimeDifferenceTooMuch(scheduledTime, realTimestamp): 56 def isTimeDifferenceTooMuch(scheduledTime, realTimestamp, 57 earlyOnlyWarning = False): 57 58 """Determine if the given real time differs to much from the scheduled 58 59 time. … … 71 72 72 73 return (diff>Flight.TIME_WARNING_DIFFERENCE, 73 diff>Flight.TIME_ERROR_DIFFERENCE)74 False if earlyOnlyWarning else diff>Flight.TIME_ERROR_DIFFERENCE) 74 75 75 76 def __init__(self, logger, gui): … … 385 386 but an error as well.""" 386 387 return self.isTimeDifferenceTooMuch(self.bookedFlight.arrivalTime, 387 self.blockTimeEnd) 388 self.blockTimeEnd, 389 earlyOnlyWarning = True) 388 390 389 391 def disconnected(self): -
src/mlx/gui/flight.py
r1033 r1034 2329 2329 self._bagWeight.set_sensitive(True) 2330 2330 2331 if bookedFlight.flightType== BookedFlight.FLIGHT_TYPE_CHARTER:2331 if bookedFlight.flightType==const.FLIGHTTYPE_CHARTER: 2332 2332 self._cargoWeight.set_int(0) 2333 2333 self._cargoWeight.set_sensitive(False) … … 2365 2365 zfw += self._numPassengers.get_int() * \ 2366 2366 (const.WEIGHT_PASSENGER_CHARTER 2367 if bookedFlight.flightType== BookedFlight.FLIGHT_TYPE_CHARTER2367 if bookedFlight.flightType==const.FLIGHTTYPE_CHARTER 2368 2368 else const.WEIGHT_PASSENGER) 2369 2369 zfw += self._numChildren.get_int() * const.WEIGHT_CHILD … … 5107 5107 table.attach(labelAlignment, 0, 1, row, row+1) 5108 5108 5109 self._flightType = createFlightTypeComboBox()5110 self._flightType.set_tooltip_text(xstr("finish_type_tooltip"))5111 self._flightType.set_active(0)5112 self._flightType.connect("changed", self._flightTypeChanged)5113 flightTypeAlignment = Gtk.Alignment(xalign=0.0, xscale=0.0)5114 flightTypeAlignment.add(self._flightType)5115 table.attach(flightTypeAlignment, 1, 2, row, row+1)5116 label.set_mnemonic_widget(self._flightType)5117 5118 row += 15119 5120 5109 self._onlineFlight = Gtk.CheckButton(xstr("finish_online")) 5121 5110 self._onlineFlight.set_use_underline(True) … … 5178 5167 5179 5168 @property 5180 def flightType(self):5181 """Get the flight type."""5182 index = self._flightType.get_active()5183 return None if index<0 else self._flightType.get_model()[index][1]5184 5185 @property5186 5169 def online(self): 5187 5170 """Get whether the flight was an online flight or not.""" … … 5215 5198 (flight.startFuel - flight.endFuel,)) 5216 5199 5217 self._flightType.set_active(-1)5218 5200 self._onlineFlight.set_active(self._wizard.loggedIn) 5219 5201 … … 5240 5222 gui = self._wizard.gui 5241 5223 faultsExplained = gui.faultsFullyExplained 5242 timesCorrect = self.flightType is None or \ 5243 not self._tooBigTimeDifference or \ 5224 timesCorrect = not self._tooBigTimeDifference or \ 5244 5225 gui.hasComments or gui.hasDelayCode 5245 5226 sensitive = gui.flight is not None and \ 5246 5227 gui.flight.stage==const.STAGE_END and \ 5247 self._flightType.get_active()>=0 and \5248 5228 (self._gatesModel.get_iter_first() is None or 5249 5229 self._gate.get_active()>=0) and \ … … 5281 5261 """Called when the Back button is pressed.""" 5282 5262 self.goBack() 5283 5284 def _flightTypeChanged(self, comboBox):5285 """Called when the flight type has changed."""5286 self._updateTimes()5287 5263 5288 5264 def _gateChanged(self, comboBox): … … 5374 5350 (arrivalWarning, arrivalError) = flight.blockTimeEndWrong 5375 5351 5376 if self.flightType==const.FLIGHTTYPE_VIP:5352 if bookedFlight.flightType==const.FLIGHTTYPE_VIP: 5377 5353 departureError = arrivalError = False 5378 5354 5379 self._tooBigTimeDifference = departureError orarrivalError5355 self._tooBigTimeDifference = departureError and arrivalError 5380 5356 5381 5357 self._depTime.set_markup(self._formatTime(bookedFlight.departureTime, -
src/mlx/gui/pirep.py
r1033 r1034 387 387 self._flownMailWeight.set_text("%.0f" % (pirep.mailWeight,)) 388 388 self._flightType.set_text(xstr("flighttype_" + 389 flightType2string(pirep. flightType)))389 flightType2string(pirep.bookedFlight.flightType))) 390 390 self._online.set_text(xstr("pirepView_" + 391 391 ("yes" if pirep.online else "no"))) … … 956 956 self._flownCargoWeight.set_value(pirep.cargoWeight) 957 957 self._flownMailWeight.set_value(pirep.mailWeight) 958 self._flightType.set_active(flightType2index(pirep.flightType)) 958 self._flightType.set_text(xstr("flighttype_" + 959 flightType2string(pirep.bookedFlight.flightType))) 959 960 self._online.set_active(pirep.online) 960 961 … … 1444 1445 self._flownMailWeight.set_tooltip_text(xstr("payload_mail_tooltip")) 1445 1446 1446 self._flightType = createFlightTypeComboBox()1447 self._flightType = PIREPViewer.getDataLabel(width = 3) 1447 1448 PIREPEditor.tableAttachWidget(table, 0, 2, 1448 1449 xstr("pirepView_flightType"), 1449 1450 self._flightType) 1450 self._flightType.connect("changed", self._updateButtons)1451 self._flightType.set_tooltip_text(xstr("pirepEdit_flight_type_tooltip"))1452 1451 1453 1452 self._online = Gtk.CheckButton(xstr("pirepEdit_online")) … … 1608 1607 pirep.mailWeight = self._flownMailWeight.get_value() 1609 1608 1610 pirep.flightType = flightTypes[self._flightType.get_active()]1611 1609 pirep.online = self._online.get_active() 1612 1610 -
src/mlx/gui/weighthelp.py
r1033 r1034 4 4 from mlx.i18n import xstr 5 5 from mlx.checks import PayloadChecker 6 from mlx.rpc import BookedFlight7 6 8 7 import mlx.const as const … … 441 440 return self._pax * \ 442 441 (const.WEIGHT_PASSENGER_CHARTER 443 if self._flightType== BookedFlight.FLIGHT_TYPE_CHARTER442 if self._flightType==const.FLIGHTTYPE_CHARTER 444 443 else const.WEIGHT_PASSENGER) + \ 445 444 self._children * const.WEIGHT_CHILD + \ -
src/mlx/pirep.py
r1033 r1034 42 42 43 43 _flightTypes = { const.FLIGHTTYPE_SCHEDULED : "SCHEDULED", 44 const.FLIGHTTYPE_OLDTIMER : "OT",45 44 const.FLIGHTTYPE_VIP : "VIP", 46 const.FLIGHTTYPE_CHARTER : "CHARTER" } 45 const.FLIGHTTYPE_CHARTER : "CHARTER", 46 const.FLIGHTTYPE_OLDTIMER : "OT" } 47 47 48 48 @staticmethod … … 167 167 self.arrivalRunway = flight.arrivalRunway.upper() 168 168 169 self.flightType = flight.flightType170 169 self.online = flight.online 171 170 … … 237 236 self.arrivalRunway = pirepData["arrivalRunway"] 238 237 239 self.flightType = PIREP.decodeFlightTypeText(pirepData["flightType"])240 238 self.online = int(pirepData["online"])!=0 241 239 … … 300 298 def flightTypeText(self): 301 299 """Get the text representation of the flight type.""" 302 return PIREP._flightTypes[self. flightType]300 return PIREP._flightTypes[self.bookedFlight.flightType] 303 301 304 302 @property … … 399 397 attrs["bagWeight"] = self.bagWeight 400 398 attrs["mailWeight"] = self.mailWeight 401 attrs["flightType"] = self.flightTypeText402 399 attrs["online"] = 1 if self.online else 0 403 400 attrs["blockTimeStart"] = self.blockTimeStartText -
src/mlx/rpc.py
r1033 r1034 257 257 raise Exception("Invalid flight status code: '" + status + "'") 258 258 259 @staticmethod 260 def _convertFlightType(ft): 261 """Convert the in-database flight-type to one of our constants.""" 262 ft = int(ft) 263 if ft==0: 264 return const.FLIGHTTYPE_SCHEDULED 265 elif ft==1: 266 return const.FLIGHTTYPE_VIP 267 elif ft==2: 268 return const.FLIGHTTYPE_CHARTER 269 else: 270 return const.FLIGHTTYPE_SCHEDULED 271 259 272 # FIXME: copied from web.BookedFlight 260 273 @staticmethod … … 275 288 # FIXME: copied from web.BookedFlight 276 289 STATUS_REJECTED = 4 277 278 # Flight type: scheduled279 FLIGHT_TYPE_SCHEDULED = 0280 281 # Flight type: VIP282 FLIGHT_TYPE_VIP = 1283 284 # Flight type: charter285 FLIGHT_TYPE_CHARTER = 2286 290 287 291 # The instructions for the construction … … 296 300 "cargoWeight" : int, 297 301 "mailWeight" : int, 298 "flightType" : int,302 "flightType" : lambda value: BookedFlight._convertFlightType(value), 299 303 "dow": int, 300 304 "maxPassengers": int, -
src/mlx/web.py
r1033 r1034 147 147 return flight 148 148 149 @staticmethod 150 def _convertFlightType(ft): 151 """Convert the in-database flight-type to one of our constants.""" 152 ft = int(ft) 153 if ft==0: 154 return const.FLIGHTTYPE_SCHEDULED 155 elif ft==1: 156 return const.FLIGHTTYPE_VIP 157 elif ft==2: 158 return const.FLIGHTTYPE_CHARTER 159 else: 160 return const.FLIGHTTYPE_SCHEDULED 161 149 162 def __init__(self, id = None): 150 163 """Construct a booked flight with the given ID.""" … … 295 308 self.mailWeight = int(bookedFlightData["mailWeight"]) 296 309 self.route = bookedFlightData["route"] 310 self.flightType = BookedFlight._convertFlightType(bookedFlightData["flightType"]) 297 311 298 312 def writeIntoFile(self, f):
Note:
See TracChangeset
for help on using the changeset viewer.