#!/usr/bin/python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
+# buffer.py - management of WeeChat buffers/nicklist
+#
+# Copyright (C) 2011-2013 Sebastien Helleu <flashcode@flashtux.org>
#
# This file is part of QWeeChat, a Qt remote GUI for WeeChat.
#
# along with QWeeChat. If not, see <http://www.gnu.org/licenses/>.
#
-#
-# Buffers.
-#
-
import qt_compat
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):
"""Generic QListWidget with dynamic size."""
def __init__(self, *args):
- apply(QtGui.QListWidget.__init__, (self,) + args)
+ QtGui.QListWidget.__init__(*(self,) + args)
self.setMaximumWidth(100)
self.setTextElideMode(QtCore.Qt.ElideNone)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
def clear(self, *args):
"""Re-implement clear to set dynamic size after clear."""
- apply(QtGui.QListWidget.clear, (self,) + args)
+ QtGui.QListWidget.clear(*(self,) + args)
self.auto_resize()
def addItem(self, *args):
"""Re-implement addItem to set dynamic size after add."""
- apply(QtGui.QListWidget.addItem, (self,) + args)
+ QtGui.QListWidget.addItem(*(self,) + args)
self.auto_resize()
def insertItem(self, *args):
"""Re-implement insertItem to set dynamic size after insert."""
- apply(QtGui.QListWidget.insertItem, (self,) + args)
+ QtGui.QListWidget.insertItem(*(self,) + args)
self.auto_resize()
"""Widget with list of buffers."""
def __init__(self, *args):
- apply(GenericListWidget.__init__, (self,) + args)
+ GenericListWidget.__init__(*(self,) + args)
def switch_prev_buffer(self):
if self.currentRow() > 0:
def update_title(self):
"""Update title."""
try:
- self.widget.set_title(self.data['title'])
+ self.widget.set_title(color.remove(self.data['title'].decode('utf-8')))
except:
self.widget.set_title(None)