Changeset 831:66c2d86eb283 for src
- Timestamp:
- 12/30/16 15:53:35 (8 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/pirep.py
r437 r831 29 29 The frame will contain an alignment to properly distance the 30 30 insides. The alignment will contain a VBox to contain the real 31 contents. 31 contents. 32 32 33 33 The function returns a tuple with the following items: … … 43 43 box = gtk.VBox() 44 44 alignment.add(box) 45 45 46 46 return (frame, box) 47 47 … … 66 66 def getTextWindow(heightRequest = 40): 67 67 """Get a scrollable text window. 68 68 69 69 Returns a tuple of the following items: 70 70 - the window, … … 87 87 dataLabelXAlignment = 0.0): 88 88 """Attach a labeled data to the given column and row of the 89 table. 90 89 table. 90 91 91 If width is given, that will be the width of the data 92 92 label. … … 95 95 dataBox = gtk.HBox() 96 96 table.attach(dataBox, column, column+1, row, row+1) 97 97 98 98 dataLabel = PIREPViewer.addLabeledData(dataBox, labelText, 99 99 width = width) … … 105 105 def addLabeledData(hBox, labelText, width = None, dataPadding = 8): 106 106 """Add a label and a data label to the given HBox. 107 107 108 108 Returnsd the data label.""" 109 109 label = PIREPViewer.getLabel(labelText) 110 110 hBox.pack_start(label, False, False, 0) 111 111 112 112 dataLabel = PIREPViewer.getDataLabel(width = width) 113 113 hBox.pack_start(dataLabel, False, False, dataPadding) … … 122 122 filler.set_size_request(-1, height) 123 123 vBox.pack_start(filler, False, False, 0) 124 124 125 125 @staticmethod 126 126 def timestamp2text(label, timestamp): … … 136 136 xstr("pirepView_title"), 137 137 parent = gui.mainWindow) 138 138 139 139 self.set_resizable(False) 140 140 141 141 self._gui = gui 142 142 143 143 contentArea = self.get_content_area() 144 144 145 145 self._notebook = gtk.Notebook() 146 146 contentArea.pack_start(self._notebook, False, False, 4) 147 147 148 148 dataTab = self._buildDataTab() 149 149 label = gtk.Label(xstr("pirepView_tab_data")) … … 151 151 label.set_tooltip_text(xstr("pirepView_tab_data_tooltip")) 152 152 self._notebook.append_page(dataTab, label) 153 153 154 154 commentsTab = self._buildCommentsTab() 155 155 label = gtk.Label(xstr("pirepView_tab_comments")) … … 157 157 label.set_tooltip_text(xstr("pirepView_tab_comments_tooltip")) 158 158 self._notebook.append_page(commentsTab, label) 159 159 160 160 logTab = self._buildLogTab() 161 161 label = gtk.Label(xstr("pirepView_tab_log")) … … 166 166 self._okButton = self.add_button(xstr("button_ok"), RESPONSETYPE_OK) 167 167 self._okButton.set_can_default(True) 168 168 169 169 def setPIREP(self, pirep): 170 170 """Setup the data in the dialog from the given PIREP.""" … … 175 175 aircraftType = xstr("aircraft_" + icaoCodes[bookedFlight.aircraftType].lower()) 176 176 self._aircraftType.set_text(aircraftType) 177 177 178 178 self._departureICAO.set_text(bookedFlight.departureICAO) 179 179 self._departureTime.set_text("%02d:%02d" % \ … … 191 191 self._cargoWeight.set_text(str(bookedFlight.cargoWeight)) 192 192 self._mailWeight.set_text(str(bookedFlight.mailWeight)) 193 193 194 194 self._route.get_buffer().set_text(bookedFlight.route) 195 195 … … 218 218 PIREPViewer.timestamp2text(self._flightTimeStart, pirep.flightTimeStart) 219 219 PIREPViewer.timestamp2text(self._flightTimeEnd, pirep.flightTimeEnd) 220 220 221 221 self._flownDistance.set_text("%.1f" % (pirep.flownDistance,)) 222 222 self._fuelUsed.set_text("%.0f" % (pirep.fuelUsed,)) … … 233 233 self._flownCargoWeight.set_text("%.0f" % (pirep.cargoWeight,)) 234 234 self._flownMailWeight.set_text("%.0f" % (pirep.mailWeight,)) 235 self._flightType.set_text(xstr("flighttype_" + 235 self._flightType.set_text(xstr("flighttype_" + 236 236 flightType2string(pirep.flightType))) 237 237 self._online.set_text(xstr("pirepView_" + … … 242 242 if delayCodes: delayCodes += ", " 243 243 delayCodes += code 244 245 self._delayCodes.get_buffer().set_text(delayCodes) 244 245 self._delayCodes.get_buffer().set_text(delayCodes) 246 246 247 247 self._comments.get_buffer().set_text(pirep.comments) … … 270 270 box1 = gtk.VBox() 271 271 table.attach(box1, 0, 1, 0, 1) 272 272 273 273 box2 = gtk.VBox() 274 274 table.attach(box2, 1, 2, 0, 1) 275 275 276 276 flightFrame = self._buildFlightFrame() 277 277 box1.pack_start(flightFrame, False, False, 4) … … 296 296 def _buildFlightFrame(self): 297 297 """Build the frame for the flight data.""" 298 298 299 299 (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_flight")) 300 300 301 301 dataBox = gtk.HBox() 302 302 mainBox.pack_start(dataBox, False, False, 0) 303 303 304 304 self._callsign = \ 305 305 PIREPViewer.addLabeledData(dataBox, … … 327 327 mainBox.pack_start(table, False, False, 0) 328 328 table.set_row_spacings(4) 329 table.set_col_spacings(8) 329 table.set_col_spacings(8) 330 330 331 331 self._departureICAO = \ … … 352 352 mainBox.pack_start(table, False, False, 0) 353 353 table.set_row_spacings(4) 354 table.set_col_spacings(8) 354 table.set_col_spacings(8) 355 355 356 356 self._numPassengers = \ … … 365 365 366 366 self._bagWeight = \ 367 PIREPViewer.tableAttach(table, 0, 1, 367 PIREPViewer.tableAttach(table, 0, 1, 368 368 xstr("pirepView_bagWeight"), 369 369 width = 5) 370 370 371 371 self._cargoWeight = \ 372 PIREPViewer.tableAttach(table, 1, 1, 372 PIREPViewer.tableAttach(table, 1, 1, 373 373 xstr("pirepView_cargoWeight"), 374 374 width = 5) 375 375 376 376 self._mailWeight = \ 377 PIREPViewer.tableAttach(table, 2, 1, 377 PIREPViewer.tableAttach(table, 2, 1, 378 378 xstr("pirepView_mailWeight"), 379 379 width = 5) 380 380 381 381 PIREPViewer.addVFiller(mainBox) 382 382 383 383 mainBox.pack_start(PIREPViewer.getLabel(xstr("pirepView_route")), 384 384 False, False, 0) 385 385 386 386 (routeWindow, self._route) = PIREPViewer.getTextWindow() 387 387 mainBox.pack_start(routeWindow, False, False, 0) … … 392 392 """Build the frame for the user-specified route and flight 393 393 level.""" 394 394 395 395 (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_route")) 396 396 397 397 levelBox = gtk.HBox() 398 398 mainBox.pack_start(levelBox, False, False, 0) 399 399 400 400 self._filedCruiseLevel = \ 401 PIREPViewer.addLabeledData(levelBox, 401 PIREPViewer.addLabeledData(levelBox, 402 402 xstr("pirepView_filedCruiseLevel"), 403 403 width = 6) … … 416 416 417 417 def _buildDepartureFrame(self): 418 """Build the frame for the departure data.""" 418 """Build the frame for the departure data.""" 419 419 (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_departure")) 420 420 … … 429 429 dataBox = gtk.HBox() 430 430 mainBox.pack_start(dataBox, False, False, 0) 431 431 432 432 self._departureRunway = \ 433 433 PIREPViewer.addLabeledData(dataBox, … … 441 441 442 442 return frame 443 443 444 444 def _buildArrivalFrame(self): 445 """Build the frame for the arrival data.""" 445 """Build the frame for the arrival data.""" 446 446 (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_arrival")) 447 447 … … 457 457 mainBox.pack_start(table, False, False, 0) 458 458 table.set_row_spacings(4) 459 table.set_col_spacings(8) 459 table.set_col_spacings(8) 460 460 461 461 self._star = \ … … 468 468 xstr("pirepView_transition"), 469 469 width = 12) 470 470 471 471 self._approachType = \ 472 472 PIREPViewer.tableAttach(table, 0, 1, 473 473 xstr("pirepView_approachType"), 474 474 width = 7) 475 475 476 476 self._arrivalRunway = \ 477 PIREPViewer.tableAttach(table, 1, 1, 477 PIREPViewer.tableAttach(table, 1, 1, 478 478 xstr("pirepView_runway"), 479 479 width = 5) 480 480 481 481 return frame 482 482 483 483 def _buildStatisticsFrame(self): 484 """Build the frame for the statistics data.""" 484 """Build the frame for the statistics data.""" 485 485 (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_statistics")) 486 486 … … 490 490 table.set_col_spacings(8) 491 491 table.set_homogeneous(False) 492 492 493 493 self._blockTimeStart = \ 494 494 PIREPViewer.tableAttach(table, 0, 0, 495 495 xstr("pirepView_blockTimeStart"), 496 496 width = 6) 497 497 498 498 self._blockTimeEnd = \ 499 499 PIREPViewer.tableAttach(table, 1, 0, … … 505 505 xstr("pirepView_flightTimeStart"), 506 506 width = 6) 507 507 508 508 self._flightTimeEnd = \ 509 PIREPViewer.tableAttach(table, 1, 1, 509 PIREPViewer.tableAttach(table, 1, 1, 510 510 xstr("pirepView_flightTimeEnd"), 511 511 width = 6) … … 515 515 xstr("pirepView_flownDistance"), 516 516 width = 8) 517 517 518 518 self._fuelUsed = \ 519 519 PIREPViewer.tableAttach(table, 1, 2, 520 520 xstr("pirepView_fuelUsed"), 521 521 width = 6) 522 522 523 523 self._rating = \ 524 524 PIREPViewer.tableAttach(table, 0, 3, … … 528 528 529 529 def _buildMiscellaneousFrame(self): 530 """Build the frame for the miscellaneous data.""" 530 """Build the frame for the miscellaneous data.""" 531 531 (frame, mainBox) = PIREPViewer.createFrame(xstr("pirepView_frame_miscellaneous")) 532 532 … … 534 534 mainBox.pack_start(table, False, False, 0) 535 535 table.set_row_spacings(4) 536 table.set_col_spacings(8) 537 536 table.set_col_spacings(8) 537 538 538 self._flownNumPassengers = \ 539 539 PIREPViewer.tableAttach(table, 0, 0, … … 565 565 xstr("pirepView_flightType"), 566 566 width = 15) 567 567 568 568 self._online = \ 569 569 PIREPViewer.tableAttach(table, 1, 2, … … 575 575 mainBox.pack_start(PIREPViewer.getLabel(xstr("pirepView_delayCodes")), 576 576 False, False, 0) 577 577 578 578 (textWindow, self._delayCodes) = PIREPViewer.getTextWindow() 579 579 mainBox.pack_start(textWindow, False, False, 0) 580 580 581 return frame 581 return frame 582 582 583 583 def _buildCommentsTab(self): … … 601 601 PIREPViewer.getTextWindow(heightRequest = -1) 602 602 flightDefectsBox.pack_start(flightDefectsWindow, True, True, 0) 603 603 604 604 return table 605 605 … … 611 611 addFaultTag(self._log.get_buffer()) 612 612 mainBox.pack_start(logWindow, True, True, 0) 613 613 614 614 return mainBox 615 615 616 616 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.