Add test coverage of GuiBuildSettings tool
This commit is contained in:
@@ -59,8 +59,7 @@ class NPagedSideBar(QToolBar):
|
||||
return
|
||||
|
||||
def setLabelColor(self, color):
|
||||
"""Set the text color for the labels.
|
||||
"""
|
||||
"""Set the text color for the labels."""
|
||||
if isinstance(color, list):
|
||||
self._labelCol = QColor(*color)
|
||||
elif isinstance(color, QColor):
|
||||
@@ -68,8 +67,7 @@ class NPagedSideBar(QToolBar):
|
||||
return
|
||||
|
||||
def addSeparator(self):
|
||||
"""Add a spacer widget.
|
||||
"""
|
||||
"""Add a spacer widget."""
|
||||
spacer = QWidget(self)
|
||||
spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
spacer.setFixedHeight(self._spacerHeight)
|
||||
@@ -77,16 +75,14 @@ class NPagedSideBar(QToolBar):
|
||||
return
|
||||
|
||||
def addLabel(self, text):
|
||||
"""Add a new label to the toolbar.
|
||||
"""
|
||||
"""Add a new label to the toolbar."""
|
||||
label = NPagedToolLabel(self, self._labelCol)
|
||||
label.setText(text)
|
||||
self.insertWidget(self._stretchAction, label)
|
||||
return
|
||||
|
||||
def addButton(self, text, buttonId=-1):
|
||||
"""Add a new button to the toolbar.
|
||||
"""
|
||||
"""Add a new button to the toolbar."""
|
||||
button = NPagedToolButton(self)
|
||||
button.setText(text)
|
||||
|
||||
@@ -99,8 +95,7 @@ class NPagedSideBar(QToolBar):
|
||||
return action
|
||||
|
||||
def setSelected(self, buttonId):
|
||||
"""Set the selected button.
|
||||
"""
|
||||
"""Set the selected button."""
|
||||
self._group.button(buttonId).setChecked(True)
|
||||
return
|
||||
|
||||
@@ -110,8 +105,7 @@ class NPagedSideBar(QToolBar):
|
||||
|
||||
@pyqtSlot("QAbstractButton*")
|
||||
def _buttonClicked(self, button):
|
||||
"""A button was clicked in the group, emit its id.
|
||||
"""
|
||||
"""A button was clicked in the group, emit its id."""
|
||||
buttonId = self._group.id(button)
|
||||
if buttonId != -1:
|
||||
self.buttonClicked.emit(buttonId)
|
||||
@@ -155,7 +149,7 @@ class NPagedToolButton(QToolButton):
|
||||
height = self.height()
|
||||
palette = self.palette()
|
||||
|
||||
if opt.state & QStyle.State_MouseOver:
|
||||
if opt.state & QStyle.State_MouseOver == QStyle.State_MouseOver:
|
||||
backCol = palette.alternateBase()
|
||||
paint.setBrush(backCol)
|
||||
paint.setOpacity(0.5)
|
||||
|
||||
@@ -45,11 +45,15 @@ class NSwitchBox(QScrollArea):
|
||||
self._hSwitch = baseSize
|
||||
self._wSwitch = 2*self._hSwitch
|
||||
self._sIcon = baseSize
|
||||
self._widgets = []
|
||||
self.clear()
|
||||
return
|
||||
|
||||
def clear(self):
|
||||
"""Rebuild the content of the core widget."""
|
||||
self._index = 0
|
||||
self._widgets = []
|
||||
|
||||
self._content = QGridLayout()
|
||||
self._content.setColumnStretch(1, 1)
|
||||
|
||||
@@ -69,6 +73,7 @@ class NSwitchBox(QScrollArea):
|
||||
font.setBold(True)
|
||||
label.setFont(font)
|
||||
self._content.addWidget(label, self._index, 0, 1, 3, Qt.AlignLeft)
|
||||
self._widgets.append(label)
|
||||
self._bumpIndex()
|
||||
return
|
||||
|
||||
@@ -87,16 +92,17 @@ class NSwitchBox(QScrollArea):
|
||||
switch.toggled.connect(lambda state: self._emitSwitchSignal(identifier, state))
|
||||
self._content.addWidget(switch, self._index, 2, Qt.AlignRight)
|
||||
|
||||
self._widgets.append(switch)
|
||||
self._bumpIndex()
|
||||
|
||||
return
|
||||
|
||||
def addSeparator(self):
|
||||
"""Add a blank entry in the content box.
|
||||
"""
|
||||
"""Add a blank entry in the content box."""
|
||||
spacer = QWidget()
|
||||
spacer.setFixedHeight(int(0.5*self._sIcon))
|
||||
self._content.addWidget(spacer, self._index, 0, 1, 3, Qt.AlignLeft)
|
||||
self._widgets.append(spacer)
|
||||
self._bumpIndex()
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user