diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-03-31 18:54:41 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-06-11 20:49:43 +0100 |
commit | 332a5c2553db41de777473a1e1be9cd1522c9496 (patch) | |
tree | 3ee06a59f147ccc4009b35cccfbe2461bcd18310 /src/windows/funcs.py | |
parent | cf44cf7cdec9fdb35caa372563d57e7045dc29dd (diff) | |
download | poezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.gz poezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.bz2 poezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.xz poezio-332a5c2553db41de777473a1e1be9cd1522c9496.zip |
Move the src directory to poezio, for better cython compatibility.
Diffstat (limited to 'src/windows/funcs.py')
-rw-r--r-- | src/windows/funcs.py | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/windows/funcs.py b/src/windows/funcs.py deleted file mode 100644 index f1401628..00000000 --- a/src/windows/funcs.py +++ /dev/null @@ -1,54 +0,0 @@ -""" -Standalone functions used by the modules -""" - -import string - -from . base_wins import FORMAT_CHAR, format_chars - -def find_first_format_char(text, chars=None): - if chars is None: - chars = format_chars - pos = -1 - for char in chars: - p = text.find(char) - if p == -1: - continue - if pos == -1 or p < pos: - pos = p - return pos - -def truncate_nick(nick, size=10): - if size < 1: - size = 1 - if nick and len(nick) > size: - return nick[:size]+'…' - return nick - -def parse_attrs(text, previous=None): - next_attr_char = text.find(FORMAT_CHAR) - if previous: - attrs = previous - else: - attrs = [] - while next_attr_char != -1 and text: - if next_attr_char + 1 < len(text): - attr_char = text[next_attr_char+1].lower() - else: - attr_char = str() - if attr_char == 'o': - attrs = [] - elif attr_char == 'u': - attrs.append('u') - elif attr_char == 'b': - attrs.append('b') - if attr_char in string.digits and attr_char != '': - color_str = text[next_attr_char+1:text.find('}', next_attr_char)] - if color_str: - attrs.append(color_str + '}') - text = text[next_attr_char+len(color_str)+2:] - else: - text = text[next_attr_char+2:] - next_attr_char = text.find(FORMAT_CHAR) - return attrs - |