@staticmethod
def trunc(string, ch):
    """
        Pads a string with '...' if it is too long to fit in a window.

        Arguments:
        string: String to be truncated.
        ch: Max length for the string.

        Returns: The original string if it is short enough to be displayed,
          otherwise the string truncated and padded with '...'.
        """
    if ch < 0 or len(string) <= ch:
        return string
    else:
        return string[:-(len(string) - ch + 3)] + '...'
