Changeset 830:d0e4741cda76 for src/mlx/gui
- Timestamp:
- 12/30/16 15:39:17 (8 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flightlist.py
r828 r830 243 243 ] 244 244 245 def __init__(self, which, wizard, window ):245 def __init__(self, which, wizard, window, pirepEditable = False): 246 246 """Construct the frame with the given title.""" 247 247 super(PendingFlightsFrame, self).__init__(xstr("pendflt_title_" + which)) … … 250 250 self._wizard = wizard 251 251 self._window = window 252 self._pirepEditable = pirepEditable 252 253 253 254 alignment = gtk.Alignment(xscale = 1.0, yscale = 1.0) … … 267 268 buttonBox = gtk.VBox() 268 269 269 self._editButton = gtk.Button(xstr("pendflt_edit_" + which)) 270 self._editButton = gtk.Button(xstr("pendflt_" + 271 ("edit" if pirepEditable else 272 "view") + "_" + which)) 270 273 self._editButton.set_sensitive(False) 274 self._editButton.connect("clicked", self._editClicked) 271 275 buttonBox.pack_start(self._editButton, False, False, 2) 272 276 … … 306 310 self._reflyButton.set_sensitive(len(selectedIndexes)>0) 307 311 self._deleteButton.set_sensitive(len(selectedIndexes)>0) 312 313 def _editClicked(self, button): 314 """Called when the Edit button is clicked.""" 315 gui = self._wizard.gui 316 gui.beginBusy(xstr("pendflt_pirep_busy")) 317 self.set_sensitive(False) 318 319 indexes = self._flightList.selectedIndexes 320 assert(len(indexes)==1) 321 322 flightID = self._flights[indexes[0]].id 323 gui.webHandler.getPIREP(self._pirepResultCallback, flightID) 324 325 def _pirepResultCallback(self, returned, result): 326 """Called when the PIREP query result is available.""" 327 gobject.idle_add(self._handlePIREPResult, returned, result) 328 329 def _handlePIREPResult(self, returned, result): 330 """Handle the refly result.""" 331 332 self.set_sensitive(True) 333 gui = self._wizard.gui 334 gui.endBusy() 335 336 if returned: 337 if self._pirepEditable: 338 gui.editPIREP(result.pirep) 339 else: 340 gui.viewPIREP(result.pirep) 308 341 309 342 def _reflyClicked(self, button): … … 408 441 vbox = gtk.VBox() 409 442 410 self._reportedFrame = PendingFlightsFrame("reported", wizard, self) 443 self._reportedFrame = PendingFlightsFrame("reported", wizard, self, 444 True) 411 445 vbox.pack_start(self._reportedFrame, True, True, 2) 412 446 -
src/mlx/gui/gui.py
r805 r830 1252 1252 else: 1253 1253 simulator.disableTimeSync() 1254 1255 def viewPIREP(self, pirep): 1256 """Display the PIREP viewer window with the given PIREP.""" 1257 self._pirepViewer.setPIREP(pirep) 1258 self._pirepViewer.show_all() 1259 self._pirepViewer.run() 1260 self._pirepViewer.hide() 1261 1262 def editPIREP(self, pirep): 1263 """Display the PIREP editor window and allow editing the PIREP.""" 1264 self.viewPIREP(pirep) 1254 1265 1255 1266 def _loadPIREP(self, menuItem):
Note:
See TracChangeset
for help on using the changeset viewer.