Changeset 225:298b775161db for src/mlx


Ignore:
Timestamp:
06/04/12 12:24:42 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Started the possibilities to log faults differently

Location:
src/mlx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/common.py

    r221 r225  
    228228#------------------------------------------------------------------------------
    229229
    230 def formatFlightLogLine(timeStr, line):
     230def formatFlightLogLine(timeStr, line, isFault = False):
    231231    """Format the given flight log line."""
    232232    """Format the given line for flight logging."""
    233233    if timeStr is not None:
    234234        line = timeStr + ": " + line
     235    #if isFault:
     236    #    line = "<b>" + line + "</b>"
    235237    return line + "\n"
    236238
  • src/mlx/gui/gui.py

    r221 r225  
    463463        return True
    464464           
    465     def addFlightLogLine(self, timeStr, line):
     465    def addFlightLogLine(self, timeStr, line, isFault = False):
    466466        """Write the given message line to the log."""
    467467        gobject.idle_add(self._writeLog,
    468                          formatFlightLogLine(timeStr, line),
     468                         formatFlightLogLine(timeStr, line, isFault = isFault),
    469469                         self._logView)
    470470
    471     def updateFlightLogLine(self, index, timeStr, line):
     471    def updateFlightLogLine(self, index, timeStr, line, isFault = False):
    472472        """Update the line with the given index."""
    473473        gobject.idle_add(self._updateFlightLogLine, index,
    474                          formatFlightLogLine(timeStr, line))
     474                         formatFlightLogLine(timeStr, line,
     475                                             isFault = isFault))
    475476
    476477    def _updateFlightLogLine(self, index, line):
  • src/mlx/gui/pirep.py

    r224 r225  
    234234
    235235        logBuffer = self._log.get_buffer()
     236        print dir(logBuffer)
    236237        logBuffer.set_text("")
     238        lineIndex = 0
    237239        for (timeStr, line) in pirep.logLines:
     240            isFault = lineIndex in pirep.faultLineIndexes
    238241            logBuffer.insert(logBuffer.get_end_iter(),
    239                              formatFlightLogLine(timeStr, line))
     242                             formatFlightLogLine(timeStr, line,
     243                                                 isFault = isFault))
     244            lineIndex += 1
    240245
    241246        self._notebook.set_current_page(0)
  • src/mlx/logger.py

    r160 r225  
    5656        self._faultLineIndexes = []
    5757               
    58     def message(self, timestamp, msg):
     58    def message(self, timestamp, msg, isFault = False):
    5959        """Put a simple textual message into the log with the given timestamp."""
    6060        timeStr = util.getTimestampString(timestamp)
    61         return self._logLine(msg, timeStr)
     61        return self._logLine(msg, timeStr, isFault = isFault)
    6262
    63     def untimedMessage(self, msg):
     63    def untimedMessage(self, msg, isFault = False):
    6464        """Put an untimed message into the log."""
    65         return self._logLine(msg)
     65        return self._logLine(msg, isFault = isFault)
    6666
    6767    def debug(self, msg):
     
    9191        text = "%s (NO GO)" % (what) if score==Logger.NO_GO_SCORE \
    9292               else "%s (%.1f)" % (what, score)
    93         lineIndex = self.message(timestamp, text)
     93        lineIndex = self.message(timestamp, text, isFault = True)
    9494        self._faultLineIndexes.append(lineIndex)
    9595        (messageType, duration) = (const.MESSAGETYPE_NOGO, 10) \
     
    118118        self._output.updateFlightLogLine(index, timeStr, line)
    119119
    120     def _logLine(self, line, timeStr = None):
     120    def _logLine(self, line, timeStr = None, isFault = False):
    121121        """Log the given line."""
    122122        index = len(self._lines)
    123123        self._lines.append((timeStr, line))
    124         self._output.addFlightLogLine(timeStr, line)
     124        self._output.addFlightLogLine(timeStr, line, isFault)
    125125        return index
    126126       
Note: See TracChangeset for help on using the changeset viewer.