From 54bcac1f1bca29c2441b0f1ce63507adfc19d0f3 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 24 Dec 2011 13:17:31 +0100 Subject: [PATCH] Remove color codes from topic --- src/qweechat/buffer.py | 3 ++- src/qweechat/weechat/color.py | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/qweechat/buffer.py b/src/qweechat/buffer.py index fc12d09..82f5806 100644 --- a/src/qweechat/buffer.py +++ b/src/qweechat/buffer.py @@ -28,6 +28,7 @@ QtCore = qt_compat.import_module('QtCore') QtGui = qt_compat.import_module('QtGui') from chat import ChatTextEdit from input import InputLineEdit +import weechat.color as color class GenericListWidget(QtGui.QListWidget): @@ -161,7 +162,7 @@ class Buffer(QtCore.QObject): def update_title(self): """Update title.""" try: - self.widget.set_title(self.data['title']) + self.widget.set_title(color.remove(self.data['title'])) except: self.widget.set_title(None) diff --git a/src/qweechat/weechat/color.py b/src/qweechat/weechat/color.py index f2923ee..1396532 100644 --- a/src/qweechat/weechat/color.py +++ b/src/qweechat/weechat/color.py @@ -163,8 +163,8 @@ class Color(): else: return RE_COLOR.sub(self._convert_color, text) - def remove(self, text): - """Remove colors in a WeeChat string.""" - if not text: - return '' - return re.sub(RE_COLOR, '', text) +def remove(text): + """Remove colors in a WeeChat string.""" + if not text: + return '' + return re.sub(RE_COLOR, '', text)