Added option to move buffer list to the left

This commit is contained in:
Ricky 2016-11-14 01:29:15 -08:00
parent 75f017b60d
commit cbc372c033
3 changed files with 24 additions and 10 deletions

View File

@ -37,6 +37,7 @@ CONFIG_DEFAULT_OPTIONS = (('relay.server', ''),
('relay.lines', str(CONFIG_DEFAULT_RELAY_LINES)),
('look.debug', 'off'),
('look.style', ''),
('look.buffer_list', 'left'),
('look.toolbar', 'on'),
('look.statusbar', 'off'))

View File

@ -119,14 +119,21 @@ class PreferencesPaneWidget(QtGui.QWidget):
def __init__(self, section_name):
QtGui.QWidget.__init__(self)
self.grid = QtGui.QGridLayout()
self.grid.setAlignment(QtCore.Qt.AlignTop)
self.section_name = section_name
self.fields = {}
self.setLayout(self.grid)
self.grid.setColumnStretch(2, 1)
self.grid.setSpacing(10)
def addItem(self, key, value):
"""Add a key-value pair."""
line = len(self.fields)
self.grid.addWidget(QtGui.QLabel(key.capitalize()), line, 0)
start = 0
if self.section_name == "color":
start = 2 * (line % 2)
line = line // 2
self.grid.addWidget(QtGui.QLabel(key.capitalize()), line, start + 0)
edit = QtGui.QLineEdit()
edit.setFixedWidth(200)
edit.insert(value)
@ -137,5 +144,5 @@ class PreferencesPaneWidget(QtGui.QWidget):
edit.addItems(QtGui.QStyleFactory.keys())
edit.setCurrentIndex(edit.findText(QtGui.qApp.style().objectName(),
QtCore.Qt.MatchFixedString))
self.grid.addWidget(edit, line, 1)
self.grid.addWidget(edit, line, start + 1)
self.fields[key] = edit

View File

@ -92,14 +92,11 @@ class MainWindow(QtGui.QMainWindow):
self.stacked_buffers.addWidget(self.buffers[0].widget)
# splitter with buffers + chat/input
splitter = QtGui.QSplitter()
splitter.addWidget(self.list_buffers)
splitter.addWidget(self.stacked_buffers)
self.splitter = QtGui.QSplitter()
self.splitter.addWidget(self.list_buffers)
self.splitter.addWidget(self.stacked_buffers)
self.setCentralWidget(splitter)
if self.config.getboolean('look', 'statusbar'):
self.statusBar().visible = True
self.setCentralWidget(self.splitter)
# actions for menu and toolbar
actions_def = {
@ -160,7 +157,7 @@ class MainWindow(QtGui.QMainWindow):
# toolbar
toolbar = self.addToolBar('toolBar')
toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
toolbar.setMovable(False);
toolbar.setMovable(False)
toolbar.addActions([self.actions['connect'],
self.actions['disconnect'],
self.actions['debug'],
@ -197,6 +194,15 @@ class MainWindow(QtGui.QMainWindow):
if self.config.get('look', 'style'):
app.setStyle(QtGui.QStyleFactory.create(
self.config.get('look', 'style')))
if self.config.getboolean('look', 'statusbar'):
self.statusBar().show()
else:
self.statusBar().hide()
# Move the buffer list / main buffer view:
if self.config.get('look', 'buffer_list') == 'right':
self.splitter.insertWidget(1, self.list_buffers)
else:
self.splitter.insertWidget(1, self.stacked_buffers)
def _buffer_switch(self, index):
"""Switch to a buffer."""