Changeset 349:41c486c8a0b4 for src/mlx/gui
- Timestamp:
- 12/10/12 19:28:32 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r347 r349 2007 2007 xscale = 0.0, yscale = 0.0) 2008 2008 2009 table = gtk.Table( 5, 4)2009 table = gtk.Table(6, 4) 2010 2010 table.set_row_spacings(4) 2011 2011 table.set_col_spacings(16) … … 2086 2086 table.attach(self._v2Unit, 3, 4, 4, 5) 2087 2087 2088 self._rto = gtk.CheckButton(xstr("takeoff_rto")) 2089 self._rto.set_use_underline(True) 2090 self._rto.set_tooltip_text(xstr("takeoff_rto_tooltip")) 2091 self._rto.connect("toggled", self._rtoToggled) 2092 table.attach(self._rto, 2, 4, 5, 6, ypadding = 8) 2093 2088 2094 self.addCancelFlightButton() 2089 2095 … … 2116 2122 """Get the v2 speed.""" 2117 2123 return self._v2.get_int() 2124 2125 @property 2126 def rtoIndicated(self): 2127 """Get whether the pilot has indicated if there was an RTO.""" 2128 return self._rto.get_active() 2118 2129 2119 2130 def activate(self): … … 2140 2151 self._v2.set_tooltip_markup(xstr("takeoff_v2_tooltip" + i18nSpeedUnit)) 2141 2152 2153 self._rto.set_active(False) 2154 self._rto.set_sensitive(False) 2155 2142 2156 self._button.set_sensitive(False) 2143 2157 self._forwardAllowed = False … … 2154 2168 self._vr.reset() 2155 2169 self._v2.reset() 2170 2171 def setRTOEnabled(self, enabled): 2172 """Set the RTO checkbox enabled or disabled.""" 2173 if not enabled: 2174 self._rto.set_active(False) 2175 self._rto.set_sensitive(enabled) 2156 2176 2157 2177 def _updateForwardButton(self): … … 2176 2196 entry.set_text(entry.get_text().upper()) 2177 2197 self._valueChanged(entry, arg) 2198 2199 def _rtoToggled(self, button): 2200 """Called when the RTO check button is toggled.""" 2201 self._wizard.rtoToggled(button.get_active()) 2178 2202 2179 2203 def _backClicked(self, button): … … 2971 2995 """Get the V2 speed.""" 2972 2996 return self._takeoffPage.v2 2997 2998 @property 2999 def rtoIndicated(self): 3000 """Get whether the pilot has indicated that an RTO has occured.""" 3001 return self._takeoffPage.rtoIndicated 2973 3002 2974 3003 @property … … 3162 3191 callback = callback) 3163 3192 3193 def updateRTO(self): 3194 """Update the RTO state. 3195 3196 The RTO checkbox will be enabled if the flight has an RTO state and the 3197 comments field contains some text.""" 3198 flight = self.gui.flight 3199 rtoEnabled = flight is not None and flight.hasRTO and \ 3200 self.gui.hasComments 3201 self._takeoffPage.setRTOEnabled(rtoEnabled) 3202 3203 def rtoToggled(self, indicated): 3204 """Called when the RTO indication has changed.""" 3205 self.gui.rtoToggled(indicated) 3206 3164 3207 def _connectSimulator(self): 3165 3208 """Connect to the simulator.""" … … 3179 3222 3180 3223 #----------------------------------------------------------------------------- 3181 -
src/mlx/gui/gui.py
r345 r349 303 303 304 304 @property 305 def rtoIndicated(self): 306 """Get whether the pilot has indicated than an RTO has occured.""" 307 return self._wizard.rtoIndicated 308 309 @property 305 310 def arrivalRunway(self): 306 311 """Get the arrival runway.""" … … 341 346 """Get the comments.""" 342 347 return self._flightInfo.comments 348 349 @property 350 def hasComments(self): 351 """Indicate whether there is a comment.""" 352 return self._flightInfo.hasComments 343 353 344 354 @property … … 728 738 else: 729 739 callback(self._fleet) 740 741 def updateRTO(self, inLoop = False): 742 """Indicate that the RTO state should be updated.""" 743 if inLoop: 744 self._wizard.updateRTO() 745 else: 746 gobject.idle_add(self.updateRTO, True) 747 748 def rtoToggled(self, indicated): 749 """Called when the user has toggled the RTO checkbox.""" 750 self._flight.rtoToggled(indicated) 730 751 731 752 def _fleetResultCallback(self, returned, result): -
src/mlx/gui/info.py
r300 r349 33 33 (const.DELAYCODE_WEATHER, xstr("info_delay_weather")), 34 34 (const.DELAYCODE_PERSONAL, xstr("info_delay_personal")) ] 35 35 36 36 @staticmethod 37 37 def _createCommentArea(label): … … 50 50 alignment.set_padding(padding_top = 4, padding_bottom = 4, 51 51 padding_left = 8, padding_right = 8) 52 52 53 53 scroller = gtk.ScrolledWindow() 54 54 # FIXME: these should be constants … … 80 80 (frame, self._comments) = FlightInfo._createCommentArea(xstr("info_comments")) 81 81 commentsBox.pack_start(frame, True, True, 8) 82 self._comments.get_buffer().connect("changed", self._commentsChanged) 82 83 83 84 (frame, self._flightDefects) = \ … … 130 131 return text2unicode(buffer.get_text(buffer.get_start_iter(), 131 132 buffer.get_end_iter(), True)) 132 133 134 @property 135 def hasComments(self): 136 """Get whether there is any text in comments field.""" 137 return self._comments.get_buffer().get_char_count()>0 138 133 139 @property 134 140 def flightDefects(self): … … 147 153 codes.append(delayCodes[index][0]) 148 154 return codes 149 155 150 156 def enable(self): 151 157 """Enable the flight info tab.""" … … 153 159 self._flightDefects.set_sensitive(True) 154 160 self._delayTable.set_sensitive(True) 155 161 156 162 def disable(self): 157 163 """Enable the flight info tab.""" … … 167 173 for widget in self._delayCodeWidgets: 168 174 widget.set_active(False) 175 176 def _commentsChanged(self, textbuffer): 177 """Called when the comments have changed.""" 178 self._gui.updateRTO(inLoop = True)
Note:
See TracChangeset
for help on using the changeset viewer.