'Set wrap mode
Valid *mode* values: None, \'word\', \'character\''

def set_wrap_mode(self, mode=None):

    if (mode == 'word'):
        wrap_mode = QTextOption.WrapAtWordBoundaryOrAnywhere
    elif (mode == 'character'):
        wrap_mode = QTextOption.WrapAnywhere
    else:
        wrap_mode = QTextOption.NoWrap
    self.setWordWrapMode(wrap_mode)
