Skip to content

Commit

Permalink
Lint CueGUI code. (#904)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcipriano authored Feb 8, 2021
1 parent 67454c9 commit 9e49bc8
Show file tree
Hide file tree
Showing 87 changed files with 3,094 additions and 2,187 deletions.
2 changes: 1 addition & 1 deletion ci/pylintrc_main
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=
extension-pkg-whitelist=PySide2

# Specify a score threshold to be exceeded before program exits with error.
fail-under=10.0
Expand Down
6 changes: 4 additions & 2 deletions ci/pylintrc_test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=
extension-pkg-whitelist=PySide2

# Specify a score threshold to be exceeded before program exits with error.
fail-under=10.0
Expand Down Expand Up @@ -60,7 +60,8 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=duplicate-code,
disable=arguments-differ,
duplicate-code,
fixme,
invalid-name,
locally-disabled,
Expand All @@ -69,6 +70,7 @@ disable=duplicate-code,
no-self-use,
protected-access,
raise-missing-from,
too-many-lines,
too-many-locals,
too-many-public-methods,
unused-argument,
Expand Down
3 changes: 3 additions & 0 deletions ci/run_python_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ if [[ "$1" == "--lint" ]]; then

cd cueadmin && PYTHONPATH=../pycue python -m pylint --rcfile=../ci/pylintrc_main cueadmin && cd ..
cd cueadmin && PYTHONPATH=../pycue python -m pylint --rcfile=../ci/pylintrc_test tests && cd ..

cd cuegui && PYTHONPATH=../pycue python -m pylint --rcfile=../ci/pylintrc_main cuegui --ignore=cuegui/images,cuegui/images/crystal && cd ..
cd cuegui && PYTHONPATH=../pycue python -m pylint --rcfile=../ci/pylintrc_test tests && cd ..
fi

22 changes: 13 additions & 9 deletions cuegui/cuegui/AbstractDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# limitations under the License.


"""Base class for dialog windows."""


from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
Expand All @@ -23,18 +26,14 @@


class AbstractDialog(QtWidgets.QDialog):
"""Base class for dialog windows."""

def __init__(self, parent=None):
QtWidgets.QDialog.__init__(self, parent)

def _newCheckBoxSelectionMatrix(self,
title,
allowedOptions,
checkedOptions,
parent=None):
return CheckBoxSelectionMatrix(title,
allowedOptions,
checkedOptions,
parent)
@staticmethod
def _newCheckBoxSelectionMatrix(title, allowedOptions, checkedOptions, parent=None):
return CheckBoxSelectionMatrix(title, allowedOptions, checkedOptions, parent)

def _newDialogButtonBox(self, buttons, orientation=QtCore.Qt.Horizontal):
buttonBox = QtWidgets.QDialogButtonBox(buttons, orientation, self)
Expand All @@ -50,6 +49,8 @@ def _addWidgetRow(self, *widgets):


class CheckBoxSelectionMatrix(QtWidgets.QWidget):
"""Widget for displaying a matrix of checkboxes."""

def __init__(self, title, allowedOptions, checkedOptions, parent=None):
QtWidgets.QWidget.__init__(self, parent)
layout = QtWidgets.QVBoxLayout(self)
Expand All @@ -70,11 +71,14 @@ def __init__(self, title, allowedOptions, checkedOptions, parent=None):
layout.addStretch()

def checkedBoxes(self):
"""Gets all checked boxes."""
return [cb for cb in self.__checkBoxes if cb.isChecked()]

def checkedOptions(self):
"""Gets text value of all checked boxes."""
return [str(cb.text()) for cb in self.__checkBoxes if cb.isChecked()]

def checkBoxes(self, names):
"""Sets checked state for checkboxes representing the named values."""
for box in self.__checkBoxes:
box.setChecked(str(box.text()) in names)
14 changes: 10 additions & 4 deletions cuegui/cuegui/AbstractDockWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.


"""
Extends QDockWidget to provide a standard setup
"""
"""Base class for all CueGUI widgets.
Extends QDockWidget to provide a standard setup."""


from __future__ import absolute_import
Expand All @@ -29,6 +29,9 @@


class AbstractDockWidget(cuegui.Plugins.Plugin, QtWidgets.QDockWidget):
"""Base class for all CueGUI widgets.
Extends QDockWidget to provide a standard setup."""

closed = QtCore.Signal(object)
enabled = QtCore.Signal()
Expand All @@ -40,7 +43,8 @@ def __init__(self, parent, name, area = QtCore.Qt.LeftDockWidgetArea):
self.parent = parent

self.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
self.setFeatures(QtWidgets.QDockWidget.DockWidgetClosable | QtWidgets.QDockWidget.DockWidgetMovable)
self.setFeatures(
QtWidgets.QDockWidget.DockWidgetClosable | QtWidgets.QDockWidget.DockWidgetMovable)
self.setObjectName(name)
parent.addDockWidget(area, self)

Expand All @@ -53,9 +57,11 @@ def __init__(self, parent, name, area = QtCore.Qt.LeftDockWidgetArea):
self.widget().setLayout(self.__layout)

def closeEvent(self, event):
del event
self.closed.emit(self)

def showEvent(self, event):
del event
self.enabled.emit()

def layout(self):
Expand Down
Loading

0 comments on commit 9e49bc8

Please sign in to comment.