Changeset 604:0ec6a6f58f08 for src
- Timestamp:
- 03/01/15 16:53:08 (10 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r575 r604 57 57 DIALOG_MODAL = gtk.DIALOG_MODAL 58 58 WRAP_WORD = gtk.WRAP_WORD 59 59 60 JUSTIFY_CENTER = gtk.JUSTIFY_CENTER 61 JUSTIFY_LEFT = gtk.JUSTIFY_LEFT 60 62 61 63 CONTROL_MASK = gdk.CONTROL_MASK … … 78 80 79 81 POLICY_AUTOMATIC = gtk.POLICY_AUTOMATIC 82 POLICY_NEVER = gtk.POLICY_NEVER 83 POLICY_ALWAYS = gtk.POLICY_ALWAYS 80 84 81 85 WEIGHT_NORMAL = pango.WEIGHT_NORMAL … … 131 135 WRAP_WORD = gtk.WrapMode.WORD 132 136 JUSTIFY_CENTER = gtk.Justification.CENTER 137 JUSTIFY_LEFT = gtk.Justification.LEFT 133 138 134 139 CONTROL_MASK = gdk.ModifierType.CONTROL_MASK … … 151 156 152 157 POLICY_AUTOMATIC = gtk.PolicyType.AUTOMATIC 158 POLICY_NEVER = gtk.PolicyType.NEVER 159 POLICY_ALWAYS = gtk.PolicyType.ALWAYS 153 160 154 161 WEIGHT_NORMAL = pango.Weight.NORMAL -
src/mlx/gui/gui.py
r555 r604 396 396 def flightDefects(self): 397 397 """Get the flight defects.""" 398 return self._flightInfo.f lightDefects398 return self._flightInfo.faultsAndExplanations 399 399 400 400 @property … … 585 585 """Remove the flight log line with the given index.""" 586 586 gobject.idle_add(self._removeFlightLogLine, index) 587 588 def addFault(self, id, timestampString, text): 589 """Add a fault to the list of faults.""" 590 faultText = formatFlightLogLine(timestampString, text).strip() 591 self._flightInfo.addFault(id, faultText) 592 593 def updateFault(self, id, timestampString, text): 594 """Update a fault in the list of faults.""" 595 faultText = formatFlightLogLine(timestampString, text).strip() 596 self._flightInfo.updateFault(id, faultText) 597 598 def clearFault(self, id): 599 """Clear a fault in the list of faults.""" 600 self._flightInfo.clearFault(id) 587 601 588 602 def _removeFlightLogLine(self, index): -
src/mlx/gui/info.py
r555 r604 3 3 4 4 from mlx.gui.delaycodes import DelayCodeTable 5 from mlx.gui.faultexplain import FaultExplainWidget 5 6 6 7 from mlx.i18n import xstr … … 14 15 # 15 16 # This module implements to \ref FlightInfo class, which is the widget for the 16 # extra information related to the flight. It contains text areasfor the17 # comments and the flight defects at the top next to each other, and the frame18 # for the delay codes at thebottom in the centre.17 # extra information related to the flight. It contains a text area for the 18 # comments, the fault list widget, and the frame for the delay codes at the 19 # bottom in the centre. 19 20 20 21 #------------------------------------------------------------------------------ … … 61 62 xscale = 1.0, yscale = 1.0) 62 63 commentsBox = gtk.HBox() 64 commentsBox.set_homogeneous(True) 63 65 64 66 (frame, self._comments) = FlightInfo._createCommentArea(xstr("info_comments")) … … 66 68 self._comments.get_buffer().connect("changed", self._commentsChanged) 67 69 68 (frame, self._flightDefects) = \ 69 FlightInfo._createCommentArea(xstr("info_defects")) 70 commentsBox.pack_start(frame, True, True, 8) 70 self._faultExplainWidget = FaultExplainWidget() 71 commentsBox.pack_start(self._faultExplainWidget, True, True, 8) 71 72 72 73 self._commentsAlignment.add(commentsBox) … … 113 114 114 115 @property 115 def flightDefects(self): 116 """Get the flight defects.""" 117 buffer = self._flightDefects.get_buffer() 118 return text2unicode(buffer.get_text(buffer.get_start_iter(), 119 buffer.get_end_iter(), True)) 116 def faultsAndExplanations(self): 117 """Get the faults and explanations as HTML.""" 118 return self._faultExplainWidget.html 120 119 121 120 @property … … 129 128 return self._delayCodeTable.hasDelayCode 130 129 130 def addFault(self, id, faultText): 131 """Add a fault to the list of faults.""" 132 self._faultExplainWidget.addFault(id, faultText) 133 134 def updateFault(self, id, faultText): 135 """Update a fault to the list of faults.""" 136 self._faultExplainWidget.updateFault(id, faultText) 137 138 def clearFault(self, id): 139 """Clear a fault to the list of faults.""" 140 self._faultExplainWidget.clearFault(id) 141 131 142 def enable(self, aircraftType): 132 143 """Enable the flight info tab.""" 133 144 self._comments.set_sensitive(True) 134 self._f lightDefects.set_sensitive(True)145 self._faultExplainWidget.set_sensitive(True) 135 146 self._delayCodeTable.setType(aircraftType) 136 147 self._delayWindow.set_sensitive(True) … … 140 151 """Enable the flight info tab.""" 141 152 self._comments.set_sensitive(False) 142 self._f lightDefects.set_sensitive(False)153 self._faultExplainWidget.set_sensitive(False) 143 154 self._delayWindow.set_sensitive(False) 144 155 self._delayCodeTable.setStyle() … … 147 158 """Reset the flight info tab.""" 148 159 self._comments.get_buffer().set_text("") 149 self._f lightDefects.get_buffer().set_text("")160 self._faultExplainWidget.reset() 150 161 self._delayCodeTable.reset() 151 162 -
src/mlx/logger.py
r400 r604 284 284 faultScore = score) 285 285 self._updateEntry(id, newEntry) 286 if latestEntry.isFault: 287 self._output.updateFault(id, newEntry.timestampString, text) 288 else: 289 self._output.addFault(id, newEntry.timestampString, text) 286 290 elif updateID is not None: 287 291 id = updateID 288 newEntry = self._entries[id].copy(timestamp = timestamp, 289 text = text, faultID = faultID, 290 faultScore = score) 292 oldEntry = self._entries[id] 293 newEntry = oldEntry.copy(timestamp = timestamp, 294 text = text, faultID = faultID, 295 faultScore = score) 291 296 self._updateEntry(id, newEntry) 297 if oldEntry.isFault: 298 self._output.updateFault(id, newEntry.timestampString, text) 299 else: 300 self._output.addFault(id, newEntry.timestampString, text) 292 301 else: 293 id = self._addEntry(Logger.Entry(timestamp, text, faultID = faultID, 294 faultScore = score)) 302 entry = Logger.Entry(timestamp, text, faultID = faultID, 303 faultScore = score) 304 id = self._addEntry(entry) 305 self._output.addFault(id, entry.timestampString, text) 295 306 296 307 if updateID is None: … … 328 339 newEntry = self._entries[id].copy(text = text, clearFault = True) 329 340 self._updateEntry(id, newEntry) 341 self._output.clearFault(id) 330 342 331 343 def _addEntry(self, entry):
Note:
See TracChangeset
for help on using the changeset viewer.