1 | # Module for the detailed PIREP viewer
|
---|
2 |
|
---|
3 | #------------------------------------------------------------------------------
|
---|
4 |
|
---|
5 | from common import *
|
---|
6 |
|
---|
7 | from mlx.const import *
|
---|
8 |
|
---|
9 | import time
|
---|
10 |
|
---|
11 | #------------------------------------------------------------------------------
|
---|
12 |
|
---|
13 | class PIREPViewer(gtk.Dialog):
|
---|
14 | """The dialog for PIREP viewing."""
|
---|
15 | @staticmethod
|
---|
16 | def createFrame(label):
|
---|
17 | """Create a frame with the given label.
|
---|
18 |
|
---|
19 | The frame will contain an alignment to properly distance the
|
---|
20 | insides. The alignment will contain a VBox to contain the real
|
---|
21 | contents.
|
---|
22 |
|
---|
23 | The function returns a tuple with the following items:
|
---|
24 | - the frame,
|
---|
25 | - the inner VBox."""
|
---|
26 | frame = gtk.Frame(label = label)
|
---|
27 |
|
---|
28 | alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0,
|
---|
29 | xscale = 1.0, yscale = 1.0)
|
---|
30 | frame.add(alignment)
|
---|
31 | alignment.set_padding(padding_top = 4, padding_bottom = 4,
|
---|
32 | padding_left = 4, padding_right = 4)
|
---|
33 | box = gtk.VBox()
|
---|
34 | alignment.add(box)
|
---|
35 |
|
---|
36 | return (frame, box)
|
---|
37 |
|
---|
38 | @staticmethod
|
---|
39 | def getLabel(text):
|
---|
40 | """Get a bold label with the given text."""
|
---|
41 | label = gtk.Label("<b>" + text + "</b>")
|
---|
42 | label.set_use_markup(True)
|
---|
43 | label.set_alignment(0.0, 0.5)
|
---|
44 | return label
|
---|
45 |
|
---|
46 | @staticmethod
|
---|
47 | def getDataLabel(width = None, xAlignment = 0.0):
|
---|
48 | """Get a bold label with the given text."""
|
---|
49 | label = gtk.Label()
|
---|
50 | if width is not None:
|
---|
51 | label.set_width_chars(width)
|
---|
52 | label.set_alignment(xAlignment, 0.5)
|
---|
53 | return label
|
---|
54 |
|
---|
55 | @staticmethod
|
---|
56 | def getTextWindow(heightRequest = 40):
|
---|
57 | """Get a scrollable text window.
|
---|
58 |
|
---|
59 | Returns a tuple of the following items:
|
---|
60 | - the window,
|
---|
61 | - the text view."""
|
---|
62 | scrolledWindow = gtk.ScrolledWindow()
|
---|
63 | scrolledWindow.set_shadow_type(SHADOW_IN)
|
---|
64 | scrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
|
---|
65 |
|
---|
66 | textView = gtk.TextView()
|
---|
67 | textView.set_wrap_mode(WRAP_WORD)
|
---|
68 | textView.set_editable(False)
|
---|
69 | textView.set_cursor_visible(False)
|
---|
70 | textView.set_size_request(-1, heightRequest)
|
---|
71 | scrolledWindow.add(textView)
|
---|
72 |
|
---|
73 | return (scrolledWindow, textView)
|
---|
74 |
|
---|
75 | @staticmethod
|
---|
76 | def tableAttach(table, column, row, labelText, width = None,
|
---|
77 | dataLabelXAlignment = 0.0):
|
---|
78 | """Attach a labeled data to the given column and row of the
|
---|
79 | table.
|
---|
80 |
|
---|
81 | If width is given, that will be the width of the data
|
---|
82 | label.
|
---|
83 |
|
---|
84 | Returns the data label attached."""
|
---|
85 | dataBox = gtk.HBox()
|
---|
86 | table.attach(dataBox, column, column+1, row, row+1)
|
---|
87 |
|
---|
88 | dataLabel = PIREPViewer.addLabeledData(dataBox, labelText,
|
---|
89 | width = width)
|
---|
90 | dataLabel.set_alignment(dataLabelXAlignment, 0.5)
|
---|
91 |
|
---|
92 | return dataLabel
|
---|
93 |
|
---|
94 | @staticmethod
|
---|
95 | def addLabeledData(hBox, labelText, width = None, dataPadding = 8):
|
---|
96 | """Add a label and a data label to the given HBox.
|
---|
97 |
|
---|
98 | Returnsd the data label."""
|
---|
99 | label = PIREPViewer.getLabel(labelText)
|
---|
100 | hBox.pack_start(label, False, False, 0)
|
---|
101 |
|
---|
102 | dataLabel = PIREPViewer.getDataLabel(width = width)
|
---|
103 | hBox.pack_start(dataLabel, False, False, dataPadding)
|
---|
104 |
|
---|
105 | return dataLabel
|
---|
106 |
|
---|
107 | @staticmethod
|
---|
108 | def addVFiller(vBox, height = 4):
|
---|
109 | """Add a filler eventbox to the given vertical box."""
|
---|
110 | filler = gtk.EventBox()
|
---|
111 | filler.set_size_request(-1, height)
|
---|
112 | vBox.pack_start(filler, False, False, 0)
|
---|
113 |
|
---|
114 | @staticmethod
|
---|
115 | def timestamp2text(label, timestamp):
|
---|
116 | """Convert the given timestamp into a text containing the hour
|
---|
117 | and minute in UTC and put that text into the given label."""
|
---|
118 | tm = time.gmtime(timestamp)
|
---|
119 | label.set_text("%02d:%02d" % (tm.tm_hour, tm.tm_min))
|
---|
120 |
|
---|
121 | def __init__(self, gui):
|
---|
122 | """Construct the PIREP viewer."""
|
---|
123 | super(PIREPViewer, self).__init__(title = WINDOW_TITLE_BASE +
|
---|
124 | " - " +
|
---|
125 | xstr("pirepView_title"),
|
---|
126 | parent = gui.mainWindow)
|
---|
127 |
|
---|
128 | self.set_resizable(False)
|
---|
129 |
|
---|
130 | self._gui = gui
|
---|
131 |
|
---|
132 | contentArea = self.get_content_area()
|
---|
133 |
|
---|
134 | self._notebook = gtk.Notebook()
|
---|
135 | contentArea.pack_start(self._notebook, False, False, 4)
|
---|
136 |
|
---|
137 | dataTab = self._buildDataTab()
|
---|
138 | label = gtk.Label(xstr("pirepView_tab_data"))
|
---|
139 | label.set_use_underline(True)
|
---|
140 | label.set_tooltip_text(xstr("pirepView_tab_data_tooltip"))
|
---|
141 | self._notebook.append_page(dataTab, label)
|
---|
142 |
|
---|
143 | commentsTab = self._buildCommentsTab()
|
---|
144 | label = gtk.Label(xstr("pirepView_tab_comments"))
|
---|
145 | label.set_use_underline(True)
|
---|
146 | label.set_tooltip_text(xstr("pirepView_tab_comments_tooltip"))
|
---|
147 | self._notebook.append_page(commentsTab, label)
|
---|
148 |
|
---|
149 | logTab = self._buildLogTab()
|
---|
150 | label = gtk.Label(xstr("pirepView_tab_log"))
|
---|
151 | label.set_use_underline(True)
|
---|
152 | label.set_tooltip_text(xstr("pirepView_tab_log_tooltip"))
|
---|
153 | self._notebook.append_page(logTab, label)
|
---|
154 |
|
---|
155 | def setPIREP(self, pirep):
|
---|
156 | """Setup the data in the dialog from the given PIREP."""
|
---|
157 | bookedFlight = pirep.bookedFlight
|
---|
158 |
|
---|
159 | self._callsign.set_text(bookedFlight.callsign)
|
---|
160 | self._tailNumber.set_text(bookedFlight.tailNumber)
|
---|
161 | aircraftType = xstr("aircraft_" + icaoCodes[bookedFlight.aircraftType].lower())
|
---|
162 | self._aircraftType.set_text(aircraftType)
|
---|
163 |
|
---|
164 | self._departureICAO.set_text(bookedFlight.departureICAO)
|
---|
165 | self._departureTime.set_text("%02d:%02d" % \
|
---|
166 | (bookedFlight.departureTime.hour,
|
---|
167 | bookedFlight.departureTime.minute))
|
---|
168 |
|
---|
169 | self._arrivalICAO.set_text(bookedFlight.arrivalICAO)
|
---|
170 | self._arrivalTime.set_text("%02d:%02d" % \
|
---|
171 | (bookedFlight.arrivalTime.hour,
|
---|
172 | bookedFlight.arrivalTime.minute))
|
---|
173 |
|
---|
174 | self._numPassengers.set_text(str(bookedFlight.numPassengers))
|
---|
175 | self._numCrew.set_text(str(bookedFlight.numCrew))
|
---|
176 | self._bagWeight.set_text(str(bookedFlight.bagWeight))
|
---|
177 | self._cargoWeight.set_text(str(bookedFlight.cargoWeight))
|
---|
178 | self._mailWeight.set_text(str(bookedFlight.mailWeight))
|
---|
179 |
|
---|
180 | self._route.get_buffer().set_text(bookedFlight.route)
|
---|
181 |
|
---|
182 | self._filedCruiseLevel.set_text("FL" + str(pirep.filedCruiseAltitude/100))
|
---|
183 |
|
---|
184 | if pirep.cruiseAltitude != pirep.filedCruiseAltitude:
|
---|
185 | self._modifiedCruiseLevel.set_text("FL" + str(pirep.cruiseAltitude/100))
|
---|
186 | else:
|
---|
187 | self._modifiedCruiseLevel.set_text("-")
|
---|
188 |
|
---|
189 | self._userRoute.get_buffer().set_text(pirep.route)
|
---|
190 |
|
---|
191 | self._departureMETAR.get_buffer().set_text(pirep.departureMETAR)
|
---|
192 |
|
---|
193 | self._arrivalMETAR.get_buffer().set_text(pirep.arrivalMETAR)
|
---|
194 | self._departureRunway.set_text(pirep.departureRunway)
|
---|
195 | self._sid.set_text(pirep.sid)
|
---|
196 |
|
---|
197 | self._star.set_text("-" if pirep.star is None else pirep.star)
|
---|
198 | self._transition.set_text("-" if pirep.transition is None else pirep.transition)
|
---|
199 | self._approachType.set_text(pirep.approachType)
|
---|
200 | self._arrivalRunway.set_text(pirep.arrivalRunway)
|
---|
201 |
|
---|
202 | PIREPViewer.timestamp2text(self._blockTimeStart, pirep.blockTimeStart)
|
---|
203 | PIREPViewer.timestamp2text(self._blockTimeEnd, pirep.blockTimeEnd)
|
---|
204 | PIREPViewer.timestamp2text(self._flightTimeStart, pirep.flightTimeStart)
|
---|
205 | PIREPViewer.timestamp2text(self._flightTimeEnd, pirep.flightTimeEnd)
|
---|
206 |
|
---|
207 | self._flownDistance.set_text("%.1f" % (pirep.flownDistance,))
|
---|
208 | self._fuelUsed.set_text("%.0f" % (pirep.fuelUsed,))
|
---|
209 |
|
---|
210 | rating = pirep.rating
|
---|
211 | if rating<0:
|
---|
212 | self._rating.set_markup('<b><span foreground="red">NO GO</span></b>')
|
---|
213 | else:
|
---|
214 | self._rating.set_text("%.1f %%" % (rating,))
|
---|
215 |
|
---|
216 | self._flownCargoWeight.set_text("%.0f" % (pirep.cargoWeight,))
|
---|
217 | self._flightType.set_text(xstr("flighttype_" +
|
---|
218 | flightType2string(pirep.flightType)))
|
---|
219 | self._online.set_text(xstr("pirepView_" +
|
---|
220 | ("yes" if pirep.online else "no")))
|
---|
221 |
|
---|
222 | delayCodes = ""
|
---|
223 | for code in pirep.delayCodes:
|
---|
224 | if delayCodes: delayCodes += ", "
|
---|
225 | delayCodes += PIREP.delayCodes[code]
|
---|
226 |
|
---|
227 | self._delayCodes.get_buffer().set_text(delayCodes)
|
---|
228 |
|
---|
229 | self._comments.get_buffer().set_text(pirep.comments)
|
---|
230 | self._flightDefects.get_buffer().set_text(pirep.flightDefects)
|
---|
231 |
|
---|
232 | logBuffer = self._log.get_buffer()
|
---|
233 | logBuffer.set_text("")
|
---|
234 | for (timeStr, line) in pirep.logLines:
|
---|
235 | logBuffer.insert(logBuffer.get_end_iter(),
|
---|
236 | formatFlightLogLine(timeStr, line))
|
---|
237 |
|
---|
238 | self._notebook.set_current_page(0)
|
---|
239 |
|
---|
240 | def _buildDataTab(self):
|
---|
241 | """Build the data tab of the viewer."""
|
---|
242 | table = gtk.Table(1, 2)
|
---|
243 | table.set_row_spacings(4)
|
---|
244 | table.set_col_spacings(16)
|
---|
245 | table.set_homogeneous(True)
|
---|
246 |
|
---|
247 | box1 = gtk.VBox()
|
---|
248 | table.attach(box1, 0, 1, 0, 1)
|
---|
249 |
|
---|
250 | box2 = gtk.VBox()
|
---|
251 | table.attach(box2, 1, 2, 0, 1)
|
---|
252 |
|
---|
253 | flightFrame = self._buildFlightFrame()
|
---|
254 | box1.pack_start(flightFrame, False, False, 4)
|
---|
255 |
|
---|
256 | routeFrame = self._buildRouteFrame()
|
---|
257 | box1.pack_start(routeFrame, False, False, 4)
|
---|
258 |
|
---|
259 | departureFrame = self._buildDepartureFrame()
|
---|
260 | box2.pack_start(departureFrame, True, True, 4)
|
---|
261 |
|
---|
262 | arrivalFrame = self._buildArrivalFrame()
|
---|
263 | box2.pack_start(arrivalFrame, True, True, 4)
|
---|
264 |
|
---|
265 | statisticsFrame = self._buildStatisticsFrame()
|
---|
266 | box2.pack_start(statisticsFrame, False, False, 4)
|
---|
267 |
|
---|
268 | miscellaneousFrame = self._buildMiscellaneousFrame()
|
---|
269 | box1.pack_start(miscellaneousFrame, False, False, 4)
|
---|
270 |
|
---|
271 | return table
|
---|
272 |
|
---|
273 | def _buildFlightFrame(self):
|
---|
274 | """Build the frame for the flight data."""
|
---|
275 |
|
---|
276 | (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_flight"))
|
---|
277 |
|
---|
278 | dataBox = gtk.HBox()
|
---|
279 | mainBox.pack_start(dataBox, False, False, 0)
|
---|
280 |
|
---|
281 | self._callsign = \
|
---|
282 | PIREPViewer.addLabeledData(dataBox,
|
---|
283 | xstr("pirepView_callsign"),
|
---|
284 | width = 8)
|
---|
285 |
|
---|
286 | self._tailNumber = \
|
---|
287 | PIREPViewer.addLabeledData(dataBox,
|
---|
288 | xstr("pirepView_tailNumber"),
|
---|
289 | width = 7)
|
---|
290 |
|
---|
291 | PIREPViewer.addVFiller(mainBox)
|
---|
292 |
|
---|
293 | dataBox = gtk.HBox()
|
---|
294 | mainBox.pack_start(dataBox, False, False, 0)
|
---|
295 |
|
---|
296 | self._aircraftType = \
|
---|
297 | PIREPViewer.addLabeledData(dataBox,
|
---|
298 | xstr("pirepView_aircraftType"),
|
---|
299 | width = 25)
|
---|
300 |
|
---|
301 | PIREPViewer.addVFiller(mainBox)
|
---|
302 |
|
---|
303 | table = gtk.Table(3, 2)
|
---|
304 | mainBox.pack_start(table, False, False, 0)
|
---|
305 | table.set_row_spacings(4)
|
---|
306 | table.set_col_spacings(8)
|
---|
307 |
|
---|
308 | self._departureICAO = \
|
---|
309 | PIREPViewer.tableAttach(table, 0, 0,
|
---|
310 | xstr("pirepView_departure"),
|
---|
311 | width = 5)
|
---|
312 |
|
---|
313 | self._departureTime = \
|
---|
314 | PIREPViewer.tableAttach(table, 1, 0,
|
---|
315 | xstr("pirepView_departure_time"),
|
---|
316 | width = 6)
|
---|
317 |
|
---|
318 | self._arrivalICAO = \
|
---|
319 | PIREPViewer.tableAttach(table, 0, 1,
|
---|
320 | xstr("pirepView_arrival"),
|
---|
321 | width = 5)
|
---|
322 |
|
---|
323 | self._arrivalTime = \
|
---|
324 | PIREPViewer.tableAttach(table, 1, 1,
|
---|
325 | xstr("pirepView_arrival_time"),
|
---|
326 | width = 6)
|
---|
327 |
|
---|
328 | table = gtk.Table(3, 2)
|
---|
329 | mainBox.pack_start(table, False, False, 0)
|
---|
330 | table.set_row_spacings(4)
|
---|
331 | table.set_col_spacings(8)
|
---|
332 |
|
---|
333 | self._numPassengers = \
|
---|
334 | PIREPViewer.tableAttach(table, 0, 0,
|
---|
335 | xstr("pirepView_numPassengers"),
|
---|
336 | width = 4)
|
---|
337 |
|
---|
338 | self._numCrew = \
|
---|
339 | PIREPViewer.tableAttach(table, 1, 0,
|
---|
340 | xstr("pirepView_numCrew"),
|
---|
341 | width = 3)
|
---|
342 |
|
---|
343 | self._bagWeight = \
|
---|
344 | PIREPViewer.tableAttach(table, 0, 1,
|
---|
345 | xstr("pirepView_bagWeight"),
|
---|
346 | width = 5)
|
---|
347 |
|
---|
348 | self._cargoWeight = \
|
---|
349 | PIREPViewer.tableAttach(table, 1, 1,
|
---|
350 | xstr("pirepView_cargoWeight"),
|
---|
351 | width = 5)
|
---|
352 |
|
---|
353 | self._mailWeight = \
|
---|
354 | PIREPViewer.tableAttach(table, 2, 1,
|
---|
355 | xstr("pirepView_mailWeight"),
|
---|
356 | width = 5)
|
---|
357 |
|
---|
358 | PIREPViewer.addVFiller(mainBox)
|
---|
359 |
|
---|
360 | mainBox.pack_start(PIREPViewer.getLabel(xstr("pirepView_route")),
|
---|
361 | False, False, 0)
|
---|
362 |
|
---|
363 | (routeWindow, self._route) = PIREPViewer.getTextWindow()
|
---|
364 | mainBox.pack_start(routeWindow, False, False, 0)
|
---|
365 |
|
---|
366 | return frame
|
---|
367 |
|
---|
368 | def _buildRouteFrame(self):
|
---|
369 | """Build the frame for the user-specified route and flight
|
---|
370 | level."""
|
---|
371 |
|
---|
372 | (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_route"))
|
---|
373 |
|
---|
374 | levelBox = gtk.HBox()
|
---|
375 | mainBox.pack_start(levelBox, False, False, 0)
|
---|
376 |
|
---|
377 | self._filedCruiseLevel = \
|
---|
378 | PIREPViewer.addLabeledData(levelBox,
|
---|
379 | xstr("pirepView_filedCruiseLevel"),
|
---|
380 | width = 6)
|
---|
381 |
|
---|
382 | self._modifiedCruiseLevel = \
|
---|
383 | PIREPViewer.addLabeledData(levelBox,
|
---|
384 | xstr("pirepView_modifiedCruiseLevel"),
|
---|
385 | width = 6)
|
---|
386 |
|
---|
387 | PIREPViewer.addVFiller(mainBox)
|
---|
388 |
|
---|
389 | (routeWindow, self._userRoute) = PIREPViewer.getTextWindow()
|
---|
390 | mainBox.pack_start(routeWindow, False, False, 0)
|
---|
391 |
|
---|
392 | return frame
|
---|
393 |
|
---|
394 | def _buildDepartureFrame(self):
|
---|
395 | """Build the frame for the departure data."""
|
---|
396 | (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_departure"))
|
---|
397 |
|
---|
398 | mainBox.pack_start(PIREPViewer.getLabel("METAR:"),
|
---|
399 | False, False, 0)
|
---|
400 | (metarWindow, self._departureMETAR) = \
|
---|
401 | PIREPViewer.getTextWindow(heightRequest = -1)
|
---|
402 | mainBox.pack_start(metarWindow, True, True, 0)
|
---|
403 |
|
---|
404 | PIREPViewer.addVFiller(mainBox)
|
---|
405 |
|
---|
406 | dataBox = gtk.HBox()
|
---|
407 | mainBox.pack_start(dataBox, False, False, 0)
|
---|
408 |
|
---|
409 | self._departureRunway = \
|
---|
410 | PIREPViewer.addLabeledData(dataBox,
|
---|
411 | xstr("pirepView_runway"),
|
---|
412 | width = 5)
|
---|
413 |
|
---|
414 | self._sid = \
|
---|
415 | PIREPViewer.addLabeledData(dataBox,
|
---|
416 | xstr("pirepView_sid"),
|
---|
417 | width = 12)
|
---|
418 |
|
---|
419 | return frame
|
---|
420 |
|
---|
421 | def _buildArrivalFrame(self):
|
---|
422 | """Build the frame for the arrival data."""
|
---|
423 | (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_arrival"))
|
---|
424 |
|
---|
425 | mainBox.pack_start(PIREPViewer.getLabel("METAR:"),
|
---|
426 | False, False, 0)
|
---|
427 | (metarWindow, self._arrivalMETAR) = \
|
---|
428 | PIREPViewer.getTextWindow(heightRequest = -1)
|
---|
429 | mainBox.pack_start(metarWindow, True, True, 0)
|
---|
430 |
|
---|
431 | PIREPViewer.addVFiller(mainBox)
|
---|
432 |
|
---|
433 | table = gtk.Table(2, 2)
|
---|
434 | mainBox.pack_start(table, False, False, 0)
|
---|
435 | table.set_row_spacings(4)
|
---|
436 | table.set_col_spacings(8)
|
---|
437 |
|
---|
438 | self._star = \
|
---|
439 | PIREPViewer.tableAttach(table, 0, 0,
|
---|
440 | xstr("pirepView_star"),
|
---|
441 | width = 12)
|
---|
442 |
|
---|
443 | self._transition = \
|
---|
444 | PIREPViewer.tableAttach(table, 1, 0,
|
---|
445 | xstr("pirepView_transition"),
|
---|
446 | width = 12)
|
---|
447 |
|
---|
448 | self._approachType = \
|
---|
449 | PIREPViewer.tableAttach(table, 0, 1,
|
---|
450 | xstr("pirepView_approachType"),
|
---|
451 | width = 7)
|
---|
452 |
|
---|
453 | self._arrivalRunway = \
|
---|
454 | PIREPViewer.tableAttach(table, 1, 1,
|
---|
455 | xstr("pirepView_runway"),
|
---|
456 | width = 5)
|
---|
457 |
|
---|
458 | return frame
|
---|
459 |
|
---|
460 | def _buildStatisticsFrame(self):
|
---|
461 | """Build the frame for the statistics data."""
|
---|
462 | (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_statistics"))
|
---|
463 |
|
---|
464 | table = gtk.Table(4, 2)
|
---|
465 | mainBox.pack_start(table, False, False, 0)
|
---|
466 | table.set_row_spacings(4)
|
---|
467 | table.set_col_spacings(8)
|
---|
468 | table.set_homogeneous(False)
|
---|
469 |
|
---|
470 | self._blockTimeStart = \
|
---|
471 | PIREPViewer.tableAttach(table, 0, 0,
|
---|
472 | xstr("pirepView_blockTimeStart"),
|
---|
473 | width = 6)
|
---|
474 |
|
---|
475 | self._blockTimeEnd = \
|
---|
476 | PIREPViewer.tableAttach(table, 1, 0,
|
---|
477 | xstr("pirepView_blockTimeEnd"),
|
---|
478 | width = 8)
|
---|
479 |
|
---|
480 | self._flightTimeStart = \
|
---|
481 | PIREPViewer.tableAttach(table, 0, 1,
|
---|
482 | xstr("pirepView_flightTimeStart"),
|
---|
483 | width = 6)
|
---|
484 |
|
---|
485 | self._flightTimeEnd = \
|
---|
486 | PIREPViewer.tableAttach(table, 1, 1,
|
---|
487 | xstr("pirepView_flightTimeEnd"),
|
---|
488 | width = 6)
|
---|
489 |
|
---|
490 | self._flownDistance = \
|
---|
491 | PIREPViewer.tableAttach(table, 0, 2,
|
---|
492 | xstr("pirepView_flownDistance"),
|
---|
493 | width = 8)
|
---|
494 |
|
---|
495 | self._fuelUsed = \
|
---|
496 | PIREPViewer.tableAttach(table, 1, 2,
|
---|
497 | xstr("pirepView_fuelUsed"),
|
---|
498 | width = 6)
|
---|
499 |
|
---|
500 | self._rating = \
|
---|
501 | PIREPViewer.tableAttach(table, 0, 3,
|
---|
502 | xstr("pirepView_rating"),
|
---|
503 | width = 7)
|
---|
504 | return frame
|
---|
505 |
|
---|
506 | def _buildMiscellaneousFrame(self):
|
---|
507 | """Build the frame for the miscellaneous data."""
|
---|
508 | (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_miscellaneous"))
|
---|
509 |
|
---|
510 | dataBox = gtk.HBox()
|
---|
511 | mainBox.pack_start(dataBox, False, False, 0)
|
---|
512 |
|
---|
513 | self._flownCargoWeight = \
|
---|
514 | PIREPViewer.addLabeledData(dataBox,
|
---|
515 | xstr("pirepView_cargoWeight"),
|
---|
516 | width = 6)
|
---|
517 |
|
---|
518 | self._flightType = \
|
---|
519 | PIREPViewer.addLabeledData(dataBox,
|
---|
520 | xstr("pirepView_flightType"),
|
---|
521 | width = 10)
|
---|
522 |
|
---|
523 | self._online = \
|
---|
524 | PIREPViewer.addLabeledData(dataBox,
|
---|
525 | xstr("pirepView_online"),
|
---|
526 | width = 5)
|
---|
527 |
|
---|
528 | PIREPViewer.addVFiller(mainBox)
|
---|
529 |
|
---|
530 | mainBox.pack_start(PIREPViewer.getLabel(xstr("pirepView_delayCodes")),
|
---|
531 | False, False, 0)
|
---|
532 |
|
---|
533 | (textWindow, self._delayCodes) = PIREPViewer.getTextWindow()
|
---|
534 | mainBox.pack_start(textWindow, False, False, 0)
|
---|
535 |
|
---|
536 | return frame
|
---|
537 |
|
---|
538 | def _buildCommentsTab(self):
|
---|
539 | """Build the tab with the comments and flight defects."""
|
---|
540 | table = gtk.Table(2, 1)
|
---|
541 | table.set_col_spacings(16)
|
---|
542 |
|
---|
543 | (frame, commentsBox) = \
|
---|
544 | PIREPViewer.createFrame(xstr("pirepView_comments"))
|
---|
545 | table.attach(frame, 0, 1, 0, 1)
|
---|
546 |
|
---|
547 | (commentsWindow, self._comments) = \
|
---|
548 | PIREPViewer.getTextWindow(heightRequest = -1)
|
---|
549 | commentsBox.pack_start(commentsWindow, True, True, 0)
|
---|
550 |
|
---|
551 | (frame, flightDefectsBox) = \
|
---|
552 | PIREPViewer.createFrame(xstr("pirepView_flightDefects"))
|
---|
553 | table.attach(frame, 1, 2, 0, 1)
|
---|
554 |
|
---|
555 | (flightDefectsWindow, self._flightDefects) = \
|
---|
556 | PIREPViewer.getTextWindow(heightRequest = -1)
|
---|
557 | flightDefectsBox.pack_start(flightDefectsWindow, True, True, 0)
|
---|
558 |
|
---|
559 | return table
|
---|
560 |
|
---|
561 | def _buildLogTab(self):
|
---|
562 | """Build the log tab."""
|
---|
563 | mainBox = gtk.VBox()
|
---|
564 |
|
---|
565 | (logWindow, self._log) = PIREPViewer.getTextWindow(heightRequest = -1)
|
---|
566 | mainBox.pack_start(logWindow, True, True, 0)
|
---|
567 |
|
---|
568 | return mainBox
|
---|
569 |
|
---|
570 | #------------------------------------------------------------------------------
|
---|