Fetch and display the next batch of log messages.

def qteUpdateLogSlot(self):
        """
        Fetch and display the next batch of log messages.
        """

        # Fetch all log records that have arrived since the last
        # fetch() call and update the record counter.
        log = self.logHandler.fetch(start=self.qteLogCnt)
        self.qteLogCnt += len(log)

        # Return immediately if no log message is available (this case
        # should be impossible).
        if not len(log):
            return

        # Remove all duplicate entries and count their repetitions.
        log_pruned = []
        last_entry = log[0]
        num_rep = -1
        for cur_entry in log:
            # If the previous log message is identical to the current
            # one increase its repetition counter. If the two log
            # messages differ, add the last message to the output log
            # and reset the repetition counter.
            if last_entry.msg == cur_entry.msg:
                num_rep += 1
            else:
                log_pruned.append([last_entry, num_rep])
                num_rep = 0
                last_entry = cur_entry

        # The very last entry must be added by hand.
        log_pruned.append([cur_entry, num_rep])

        # Format the log entries (eg. color coding etc.)
        log_formatted = ""
        for cur_entry in log_pruned:
            log_formatted += self.qteFormatMessage(cur_entry[0], cur_entry[1])
            log_formatted + '\n'

        # Insert the formatted text all at once as calls to insertHtml
        # are expensive.
        self.qteText.insertHtml(log_formatted)
        self.qteMoveToEndOfBuffer()

        # If the log contained an error (or something else of interest
        # to the user) then switch to the messages buffer (ie. switch
        # to this very applet).
        if self.qteAutoActivate:
            self.qteAutoActivate = False
            self.qteMain.qteMakeAppletActive(self)