Skip to content

Commit

Permalink
Fix and add flake8.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Aug 8, 2018
1 parent deea30a commit 0636df1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ virtualenv:
install:
- sudo apt-get install -y git pylint pep8 python3-pyqt5
- pip install nose nose-exclude nosexcover pyflakes
- pip install --upgrade flake8

before_script:
- echo "Build starting on " `date`
- export PYTHONPATH=`pwd`

script:
- xvfb-run --server-args="-screen 0, 1024x768x24" nosetests -v --with-id --with-xcoverage --with-xunit --verbose --cover-package=.
- make pep8
- make flake8

after_success:
- pip install coveralls
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
PROJECT_NAME = PARAMETERS
BUILD_DIRECTORY = ../build_$(PROJECT_NAME)

# Run pep8 style checking
#http://pypi.python.org/pypi/pep8
pep8:
# Run flake8 style checking
flake8:
@echo
@echo "-----------"
@echo "PEP8 issues"
@echo "Flake8 issues"
@echo "-----------"
@pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128,E402 . || true
@python3 -m flake8 --version
@python3 -m flake8 || true

# Run entire test suite
test_suite:
Expand Down
3 changes: 2 additions & 1 deletion parameters/qt_widgets/group_parameter_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def __init__(self, parameter, parent=None):
self.main_layout.addLayout(self._group_layout)

# Why are we doing imports here? TS
from parameters.qt_widgets.parameter_container import ParameterContainer
from parameters.qt_widgets.parameter_container import (
ParameterContainer)

self.param_container = ParameterContainer(
parameters=self._parameter.value)
Expand Down
13 changes: 0 additions & 13 deletions parameters/qt_widgets/parameter_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
QFrame,
QHBoxLayout
)
from PyQt5.QtGui import QColor

from parameters.parameter_exceptions import InvalidValidationException
from parameters.qt_widgets.qt5_parameter_factory import Qt5ParameterFactory
Expand Down Expand Up @@ -190,21 +189,9 @@ def setup_ui(self, must_scroll=True):
self.qt5_parameter_factory.register_widget(
extra_parameter[0], extra_parameter[1])

color_odd = QColor(220, 220, 220)
color_even = QColor(192, 192, 192)

i = 0
for parameter in parameters:
parameter_widget = self.qt5_parameter_factory.get_widget(parameter)
if i % 2:
color = color_even
else:
color = color_odd
i += 1
parameter_widget.setAutoFillBackground(True)
# palette = parameter_widget.palette()
# palette.setColor(parameter_widget.backgroundRole(), color)
# parameter_widget.setPalette(palette)
self.vertical_layout.addWidget(parameter_widget)

self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
Expand Down
9 changes: 5 additions & 4 deletions parameters/qt_widgets/test/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import sys
from functools import partial

from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, QPushButton, QMessageBox
from PyQt5.QtWidgets import (
QApplication, QWidget, QGridLayout, QPushButton, QMessageBox)

from parameters.boolean_parameter import BooleanParameter
from parameters.dict_parameter import DictParameter
Expand Down Expand Up @@ -54,11 +55,11 @@ def validate_min_max(parent_container):

if min_value > max_value:
print('Not valid')
message = ('Your minimum value (%d) should be less than your '
'maximum value (%d)' % (min_value, max_value))
return {
'valid': False,
'message': (
'Your minimum value (%d) should be less than your maximum '
'value (%d)' % (min_value, max_value))
'message': message
}
print('Valid')
return {'valid': True, 'message': ''}
Expand Down
4 changes: 2 additions & 2 deletions parameters/unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def serialize(self):
'plural': self.plural,
'abbreviation': self.abbreviation,
'help_text': self.help_text,
'description': self.description,
}
'description': self.description
}

def __str__(self):
return self.name

0 comments on commit 0636df1

Please sign in to comment.