Changeset 106:5d81096406c0 for src/mlx
- Timestamp:
- 04/22/12 14:45:55 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r105 r106 1212 1212 self._metar.set_accepts_tab(False) 1213 1213 self._metar.set_wrap_mode(gtk.WrapMode.WORD if pygobject else gtk.WRAP_WORD) 1214 self._metar.get_buffer().connect("changed", self._metarChanged) 1214 1215 scrolledWindow.add(self._metar) 1215 1216 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, … … 1220 1221 self._metarFrame.add(alignment) 1221 1222 mainBox.pack_start(self._metarFrame, True, True, 4) 1223 self.metarEdited = False 1222 1224 1223 1225 button = self.addButton(gtk.STOCK_GO_BACK) … … 1235 1237 return buffer.get_text(buffer.get_start_iter(), 1236 1238 buffer.get_end_iter(), True) 1239 1240 def setMETAR(self, metar): 1241 """Set the metar.""" 1242 self._metar.get_buffer().set_text(metar) 1243 self.metarEdited = False 1237 1244 1238 1245 def activate(self): … … 1279 1286 buffer.set_text(metar) 1280 1287 1288 self.metarEdited = False 1289 1281 1290 def _backClicked(self, button): 1282 1291 """Called when the Back button is pressed.""" … … 1293 1302 1294 1303 self._wizard.nextPage() 1304 1305 def _metarChanged(self, buffer): 1306 """Called when the METAR has changed.""" 1307 self.metarEdited = True 1308 self._button.set_sensitive(buffer.get_text(buffer.get_start_iter(), 1309 buffer.get_end_iter(), 1310 True)!="") 1295 1311 1296 1312 #----------------------------------------------------------------------------- … … 2123 2139 if stage==const.STAGE_TAKEOFF: 2124 2140 self._takeoffPage.allowForward() 2141 elif stage==const.STAGE_LANDING: 2142 if not self._arrivalBriefingPage.metarEdited: 2143 print "Downloading arrival METAR again" 2144 self.gui.webHandler.getMETARs(self._arrivalMETARCallback, 2145 [self._bookedFlight.arrivalICAO]) 2146 2147 self._takeoffPage.allowForward() 2125 2148 elif stage==const.STAGE_END: 2126 2149 self._landingPage.flightEnded() … … 2217 2240 """Connect to the simulator.""" 2218 2241 self.gui.connectSimulator(self._bookedFlight.aircraftType) 2242 2243 def _arrivalMETARCallback(self, returned, result): 2244 """Called when the METAR of the arrival airport is retrieved.""" 2245 gobject.idle_add(self._handleArrivalMETAR, returned, result) 2246 2247 def _handleArrivalMETAR(self, returned, result): 2248 """Called when the METAR of the arrival airport is retrieved.""" 2249 icao = self._bookedFlight.arrivalICAO 2250 if returned and icao in result.metars: 2251 metar = result.metars[icao] 2252 if metar!="": 2253 self._arrivalBriefingPage.setMETAR(metar) 2219 2254 2220 2255 #----------------------------------------------------------------------------- -
src/mlx/web.py
r104 r106 14 14 import datetime 15 15 import codecs 16 import traceback 16 17 import xml.sax 17 18 … … 301 302 returned = True 302 303 except Exception, e: 304 traceback.print_exc() 303 305 result = e 304 306 returned = False … … 308 310 except Exception, e: 309 311 print >> sys.stderr, "web.Handler.Request.perform: callback throwed an exception: " + str(e) 312 traceback.print_exc() 310 313 311 314 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.