def SendMessage(self, kind, message, copy=False):
        """
        Prints an user-friendly message on the list control.

        
        **Parameters:**

        * kind: the message kind (error, warning, message);
        * message: the actual message to display in the list control;
        * copy: whether to save a reference to this message or not.
        """

        # Get the current time slightly dirrently formatted
        currentTime = shortNow()

        # Delete the "." at the end of the message (if any)
        message = message.strip()
        if message.endswith("."):
            message = message[:-1]
            
        # Wrap the message... error messages are often too long
        # to be seen in the list control
        width = self.GetMaxWidth()
        if kind == 2:  # is an error
            # Insert the correct icon (message, error, etc...) in the first column
            indx = self.InsertError(currentTime)
            messages = message.splitlines()
            message = []
            for msg in messages:
                message.extend(textwrap.wrap(msg, width))
        elif kind == 1 and "\n" in message:
            messages = message.splitlines()
            message = []
            for msg in messages:
                message.extend(textwrap.wrap(msg.strip(), width))
        else:
            message = [message]

        for msg in message:
            try:
                # Insert the correct icon (message, error, etc...) in the first column
                indx = self.list.InsertImageStringItem(sys.maxint, "", kind)
                # Insert the current time and the message
                self.list.SetStringItem(indx, 1, currentTime)
                self.list.SetStringItem(indx, 2, msg.encode())
            except UnicodeDecodeError:
                # Why does this happen here?!?
                continue
                
        # Ensure the last item is visible
        self.list.EnsureVisible(indx)
        if wx.Platform == "__WXGTK__":
            self.list.Refresh()
        if copy:
            # Save the last message
            self.list.lastMessage = [kind, msg]
    def SendMessage(self, kind, message, copy=False):
        """
        Prints an user-friendly message on the list control.

        
        **Parameters:**

        * kind: the message kind (error, warning, message);
        * message: the actual message to display in the list control;
        * copy: whether to save a reference to this message or not.
        """

        # Get the current time slightly dirrently formatted
        currentTime = shortNow()

        # Delete the "." at the end of the message (if any)
        message = message.strip()
        if message.endswith("."):
            message = message[:-1]
            
        # Wrap the message... error messages are often too long
        # to be seen in the list control
        width = self.GetMaxWidth()
        if kind == 2:  # is an error
            # Insert the correct icon (message, error, etc...) in the first column
            indx = self.InsertError(currentTime)
            messages = message.splitlines()
            message = []
            for msg in messages:
                message.extend(textwrap.wrap(msg, width))
        elif kind == 1 and "\n" in message:
            messages = message.splitlines()
            message = []
            for msg in messages:
                message.extend(textwrap.wrap(msg.strip(), width))
        else:
            message = [message]

        for msg in message:
            try:
                # Insert the correct icon (message, error, etc...) in the first column
                indx = self.list.InsertImageStringItem(sys.maxint, "", kind)
                # Insert the current time and the message
                self.list.SetStringItem(indx, 1, currentTime)
                self.list.SetStringItem(indx, 2, msg.encode())
            except UnicodeDecodeError:
                # Why does this happen here?!?
                continue
                
        # Ensure the last item is visible
        self.list.EnsureVisible(indx)
        if wx.Platform == "__WXGTK__":
            self.list.Refresh()
        if copy:
            # Save the last message
            self.list.lastMessage = [kind, msg]
    def CopyLastMessage(self):
        """ Re-sends the previous message to the log window (for long processes). """

        if not hasattr(self.list, "lastMessage"):
            return
        
        # Get the current time slightly dirrently formatted
        currentTime = shortNow()
        
        # Insert the correct icon (message, error, etc...) in the first column
        kind, msg = self.list.lastMessage
        indx = self.list.InsertImageStringItem(sys.maxint, "", kind)
        # Insert the current time and the message
        self.list.SetStringItem(indx, 1, currentTime)
        self.list.SetStringItem(indx, 2, msg)

        # Ensure the last item is visible
        self.list.EnsureVisible(indx)
        
        if wx.Platform == "__WXGTK__":
            self.list.Refresh()
    def CopyLastMessage(self):
        """ Re-sends the previous message to the log window (for long processes). """

        if not hasattr(self.list, "lastMessage"):
            return
        
        # Get the current time slightly dirrently formatted
        currentTime = shortNow()
        
        # Insert the correct icon (message, error, etc...) in the first column
        kind, msg = self.list.lastMessage
        indx = self.list.InsertImageStringItem(sys.maxint, "", kind)
        # Insert the current time and the message
        self.list.SetStringItem(indx, 1, currentTime)
        self.list.SetStringItem(indx, 2, msg)

        # Ensure the last item is visible
        self.list.EnsureVisible(indx)
        
        if wx.Platform == "__WXGTK__":
            self.list.Refresh()