+ layout.addWidget(QtGui.QLabel('<b>Logging</b>'), 2, 0)
+ layout.addWidget(QtGui.QLabel('Log level:'), 3, 0)
+
+ cbox = QtGui.QComboBox()
+ descriptions = [
+ 'no messages at all',
+ 'error messages',
+ 'warnings',
+ 'informational messages',
+ 'debug messages',
+ 'very noisy debug messages'
+ ]
+ for i, desc in enumerate(descriptions):
+ level = sr.LogLevel.get(i)
+ text = '{} ({})'.format(level.name, desc)
+ # The numeric log level corresponds to the index of the text in the
+ # combo box. Should this ever change, we could use the 'userData'
+ # that can also be stored in the item.
+ cbox.addItem(text)
+
+ cbox.setCurrentIndex(settings.logging.level.value().id)
+ cbox.currentIndexChanged[int].connect(
+ (lambda i: settings.logging.level.setValue(sr.LogLevel.get(i))))
+ layout.addWidget(cbox, 3, 1)
+
+ layout.addWidget(QtGui.QLabel('Number of lines to log:'), 4, 0)
+
+ spin = QtGui.QSpinBox(self)
+ spin.setMinimum(100)
+ spin.setMaximum(10 * 1000 * 1000)
+ spin.setSingleStep(100)
+ spin.setValue(settings.logging.lines.value())
+ spin.valueChanged[int].connect(settings.logging.lines.setValue)
+ layout.addWidget(spin, 4, 1)
+