Changeset 436:4c3e7b66ca89 for src/mlx/gui
- Timestamp:
- 02/23/13 06:37:05 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/delaycodes.py
r435 r436 4 4 5 5 from mlx.gui.common import * 6 7 import mlx.const as const 6 8 7 9 #------------------------------------------------------------------------------ … … 162 164 def setStyle(self): 163 165 """Set the style of the event box from the treeview.""" 164 style = self._treeView.rc_get_style()165 self._eventBox.modify_bg(0, style.bg[2])166 self._eventBox.modify_fg(0, style.fg[2])167 166 if self._treeView is not None: 167 style = self._treeView.rc_get_style() 168 self._eventBox.modify_bg(0, style.bg[2]) 169 self._eventBox.modify_fg(0, style.fg[2]) 168 170 169 171 class Alignment(gtk.Alignment): … … 187 189 DELAYCODE = 2 188 190 189 _data = ( ["Num", "Code", "Reason", "Description"], 190 [ (CAPTION, "Others"), 191 (DELAYCODE, (" 6", "OA ", "NO GATES/STAND AVAILABLE", 192 "Due to own airline activity")), 193 (DELAYCODE, ("9", "SG", "SCHEDULED GROUND TIME", 194 "Planned turnaround time less than declared minimum")), 195 (CAPTION, "Passenger and baggage"), 196 (DELAYCODE, ("11", "PD", "LATE CHECK-IN", 197 "Check-in reopened for late passengers")), 198 (DELAYCODE, ("12", "PL", "LATE CHECK-IN", 199 "Check-in not completed by flight closure time")), 200 (DELAYCODE, ("13", "PE", "CHECK-IN ERROR", 201 "Error with passenger or baggage details")) ] ) 191 _data1 = ( ["Num", "Code", "Title", "Description"], 192 [ (CAPTION, "Others"), 193 (DELAYCODE, (" 6", "OA ", "NO GATES/STAND AVAILABLE", 194 "Due to own airline activity")), 195 (DELAYCODE, ("9", "SG", "SCHEDULED GROUND TIME", 196 "Planned turnaround time less than declared minimum")), 197 (CAPTION, "Passenger and baggage"), 198 (DELAYCODE, ("11", "PD", "LATE CHECK-IN", 199 "Check-in reopened for late passengers")), 200 (DELAYCODE, ("12", "PL", "LATE CHECK-IN", 201 "Check-in not completed by flight closure time")), 202 (DELAYCODE, ("13", "PE", "CHECK-IN ERROR", 203 "Error with passenger or baggage details")) ] ) 204 205 _data2 = ( ["MA", "IATA", "Description"], 206 [ (CAPTION, "Passenger and baggage"), 207 (DELAYCODE, (" 012", "01", 208 "Late shipping of parts and/or materials")), 209 (DELAYCODE, (" 111", "11", 210 "Check-in reopened for late passengers")), 211 (DELAYCODE, (" 121", "12", 212 "Check-in not completed by flight closure time")), 213 (DELAYCODE, (" 132", "13", 214 "Error with passenger or baggage details")) 215 ]) 202 216 203 217 #------------------------------------------------------------------------------ … … 209 223 super(DelayCodeTable, self).__init__() 210 224 211 (headers, rows) = _data 212 numColumns = len(headers) + 1 213 numRows = len(rows) 225 self._treeView = None 214 226 215 227 self._listStore = gtk.ListStore(str, str) 216 228 self._treeView = gtk.TreeView(self._listStore) 217 229 self._treeView.set_rules_hint(True) 230 231 self.pack_start(self._treeView, False, False, 0) 232 233 self._alignments = [] 234 235 self._eventBox = gtk.EventBox() 236 237 self._table = None 238 239 self._viewport = self._createViewport() 240 self._viewport.add(self._eventBox) 241 self._viewport.set_shadow_type(SHADOW_NONE) 242 243 self.pack_start(self._viewport, True, True, 0) 244 245 self._previousWidth = 0 246 247 def allocate_column_sizes(self, allocation): 248 """Allocate the column sizes.""" 249 if allocation.width!=self._previousWidth: 250 self._previousWidth = allocation.width 251 index = 0 252 for alignment in self._alignments: 253 column = self._treeView.get_column(index) 254 width = alignment.allocatedWidth + (8 if index==0 else 16) 255 column.set_fixed_width(width) 256 index += 1 257 258 def setType(self, aircraftType): 259 """Setup the delay code table according to the given aircraft type.""" 260 if aircraftType==const.AIRCRAFT_B736: 261 data = _data1 262 else: 263 data = _data2 264 265 columns = self._treeView.get_columns() 266 for column in columns: 267 self._treeView.remove_column(column) 268 269 (headers, rows) = data 270 numColumns = len(headers) + 1 271 numRows = len(rows) 218 272 219 273 column = gtk.TreeViewColumn("", gtk.CellRendererText()) … … 226 280 self._treeView.append_column(column) 227 281 228 self.pack_start(self._treeView, False, False, 0)229 230 self._alignments = []231 232 self._eventBox = gtk.EventBox()233 234 282 self._table = gtk.Table(numRows, numColumns) 235 283 self._table.set_homogeneous(False) 236 284 self._table.set_col_spacings(16) 237 285 self._table.set_row_spacings(4) 286 self._eventBox.add(self._table) 287 288 self._alignments = [] 238 289 239 290 firstDelayCodeRow = True … … 267 318 firstDelayCodeRow = False 268 319 269 self._viewport = self._createViewport()270 self._eventBox.add(self._table)271 self._viewport.add(self._eventBox)272 self._viewport.set_shadow_type(SHADOW_NONE)273 274 self.pack_start(self._viewport, True, True, 0)275 276 320 self._previousWidth = 0 277 278 def allocate_column_sizes(self, allocation): 279 """Allocate the column sizes.""" 280 if allocation.width!=self._previousWidth: 281 self._previousWidth = allocation.width 282 index = 0 283 for alignment in self._alignments: 284 column = self._treeView.get_column(index) 285 width = alignment.allocatedWidth + (8 if index==0 else 16) 286 column.set_fixed_width(width) 287 index += 1 288 289 290 #------------------------------------------------------------------------------ 321 self.show_all() 322 323 def reset(self): 324 """Reset the delay code table.""" 325 columns = self._treeView.get_columns() 326 for column in columns: 327 self._treeView.remove_column(column) 328 self._eventBox.remove(self._table) 329 self._table = None 330 self.show_all() 331 332 #------------------------------------------------------------------------------ -
src/mlx/gui/flight.py
r435 r436 591 591 flight = self._getSelectedFlight() 592 592 self._wizard._bookedFlight = flight 593 self._wizard.gui.enableFlightInfo( )593 self._wizard.gui.enableFlightInfo(flight.aircraftType) 594 594 595 595 self._updateDepartureGate() -
src/mlx/gui/gui.py
r393 r436 486 486 self.reset() 487 487 488 def enableFlightInfo(self ):488 def enableFlightInfo(self, aircraftType): 489 489 """Enable the flight info tab.""" 490 self._flightInfo.enable( )490 self._flightInfo.enable(aircraftType) 491 491 492 492 def cancelFlight(self): -
src/mlx/gui/info.py
r435 r436 163 163 return codes 164 164 165 def enable(self ):165 def enable(self, aircraftType): 166 166 """Enable the flight info tab.""" 167 167 self._comments.set_sensitive(True) 168 168 self._flightDefects.set_sensitive(True) 169 self._delayTable.setType(aircraftType) 169 170 self._delayWindow.set_sensitive(True) 170 171 self._delayTable.setStyle() … … 181 182 self._comments.get_buffer().set_text("") 182 183 self._flightDefects.get_buffer().set_text("") 183 184 for widget in self._delayCodeWidgets:185 widget.set_active(False)184 self._delayTable.reset() 185 # for widget in self._delayCodeWidgets: 186 # widget.set_active(False) 186 187 187 188 def _commentsChanged(self, textbuffer):
Note:
See TracChangeset
for help on using the changeset viewer.