diff --git a/qweechat/buffer.py b/qweechat/buffer.py index eefb5e1..4a193ee 100644 --- a/qweechat/buffer.py +++ b/qweechat/buffer.py @@ -149,9 +149,10 @@ class Buffer(QtCore.QObject): bufferInput = qt_compat.Signal(str, str) - def __init__(self, data={}): + def __init__(self, data={}, config=False): QtCore.QObject.__init__(self) self.data = data + self.config = config self.nicklist = {} self.widget = BufferWidget(display_nicklist=self.data.get('nicklist', 0)) @@ -222,6 +223,12 @@ class Buffer(QtCore.QObject): nick['visible'] = visible break + def nicklist_update_config(self): + """Match nicklist to configuration, quicker than a refresh""" + if (self.config): + setting = self.config.get("look", "nick_list") != "off" + self.widget.nicklist.setVisible(setting) + def nicklist_refresh(self): """Refresh nicklist.""" self.widget.nicklist.clear() @@ -245,4 +252,8 @@ class Buffer(QtCore.QObject): icon = QtGui.QIcon(pixmap) item = QtGui.QListWidgetItem(icon, nick['name']) self.widget.nicklist.addItem(item) - self.widget.nicklist.setVisible(True) + if self.config and self.config.get("look", + "nick_list") == "off": + self.widget.nicklist.setVisible(False) + else: + self.widget.nicklist.setVisible(True) diff --git a/qweechat/config.py b/qweechat/config.py index 3a33042..642bfdf 100644 --- a/qweechat/config.py +++ b/qweechat/config.py @@ -38,6 +38,7 @@ CONFIG_DEFAULT_OPTIONS = (('relay.server', ''), ('look.debug', 'off'), ('look.style', ''), ('look.buffer_list', 'left'), + ('look.nick_list', 'on'), ('look.toolbar', 'on'), ('look.statusbar', 'off')) diff --git a/qweechat/qweechat.py b/qweechat/qweechat.py index 080cf93..1391ed6 100644 --- a/qweechat/qweechat.py +++ b/qweechat/qweechat.py @@ -203,6 +203,9 @@ class MainWindow(QtGui.QMainWindow): self.splitter.insertWidget(1, self.list_buffers) else: self.splitter.insertWidget(1, self.stacked_buffers) + # Update visibility of all nicklists: + for buffer in self.buffers: + buffer.nicklist_update_config() def _buffer_switch(self, index): """Switch to a buffer.""" @@ -516,7 +519,7 @@ class MainWindow(QtGui.QMainWindow): def create_buffer(self, item): """Create a new buffer.""" - buf = Buffer(item) + buf = Buffer(item, self.config) buf.bufferInput.connect(self.buffer_input) buf.widget.input.bufferSwitchPrev.connect( self.list_buffers.switch_prev_buffer)