From b2a73d2e37a8f1237de7de07193699855754ad62 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Mon, 27 Jul 2020 18:42:09 +0900 Subject: [PATCH 01/97] Add pylint in CI #39 --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index b1287128..caef8060 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: uses: ricardochaves/python-lint@v1.1.0 with: python-root-list: pyvistaqt - use-pylint: false + use-pylint: true use-pycodestyle: false use-flake8: false use-black: true From bf24af5d13e385d33293b2f1e4c0ab76740d6a81 Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Wed, 29 Jul 2020 11:39:32 +0200 Subject: [PATCH 02/97] Improve rating to 8.87/10 --- .pylintrc | 595 ++++++++++++++++++++++++++++++++++++++++++ pyvistaqt/plotting.py | 102 ++++---- 2 files changed, 651 insertions(+), 46 deletions(-) create mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000..97cfffb0 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,595 @@ +[MASTER] + +# 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=PyQt5, vtk + +# Specify a score threshold to be exceeded before program exits with error. +fail-under=10 + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Add files or directories matching the regex patterns to the blacklist. The +# regex matches against base names, not paths. +ignore-patterns= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the +# number of processors available to use. +jobs=1 + +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python module names) to load, +# usually to register additional checkers. +load-plugins= + +# Pickle collected data for later comparisons. +persistent=yes + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. +confidence= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --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=print-statement, + parameter-unpacking, + unpacking-in-except, + old-raise-syntax, + backtick, + long-suffix, + old-ne-operator, + old-octal-literal, + import-star-module-level, + non-ascii-bytes-literal, + raw-checker-failed, + bad-inline-option, + locally-disabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-symbolic-message-instead, + apply-builtin, + basestring-builtin, + buffer-builtin, + cmp-builtin, + coerce-builtin, + execfile-builtin, + file-builtin, + long-builtin, + raw_input-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + no-absolute-import, + old-division, + dict-iter-method, + dict-view-method, + next-method-called, + metaclass-assignment, + indexing-exception, + raising-string, + reload-builtin, + oct-method, + hex-method, + nonzero-method, + cmp-method, + input-builtin, + round-builtin, + intern-builtin, + unichr-builtin, + map-builtin-not-iterating, + zip-builtin-not-iterating, + range-builtin-not-iterating, + filter-builtin-not-iterating, + using-cmp-argument, + eq-without-hash, + div-method, + idiv-method, + rdiv-method, + exception-message-attribute, + invalid-str-codec, + sys-max-int, + bad-python3-import, + deprecated-string-function, + deprecated-str-translate-call, + deprecated-itertools-function, + deprecated-types-field, + next-method-defined, + dict-items-not-iterating, + dict-keys-not-iterating, + dict-values-not-iterating, + deprecated-operator-function, + deprecated-urllib-function, + xreadlines-attribute, + deprecated-sys-function, + exception-escape, + comprehension-escape + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +enable=c-extension-no-member + + +[REPORTS] + +# Python expression which should return a score less than or equal to 10. You +# have access to the variables 'error', 'warning', 'refactor', and 'convention' +# which contain the number of messages in each category, as well as 'statement' +# which is the total number of statements analyzed. This score is used by the +# global evaluation report (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +#msg-template= + +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Tells whether to display a full report or only the messages. +reports=no + +# Activate the evaluation score. +score=yes + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. Available dictionaries: none. To make it work, +# install the python-enchant package. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains the private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to the private dictionary (see the +# --spelling-private-dict-file option) instead of raising a message. +spelling-store-unknown-words=no + + +[BASIC] + +# Naming style matching correct argument names. +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style. +#argument-rgx= + +# Naming style matching correct attribute names. +attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. +#attr-rgx= + +# Bad variable names which should always be refused, separated by a comma. +bad-names=foo, + bar, + baz, + toto, + tutu, + tata + +# Bad variable names regexes, separated by a comma. If names match any regex, +# they will always be refused +bad-names-rgxs= + +# Naming style matching correct class attribute names. +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. +#class-attribute-rgx= + +# Naming style matching correct class names. +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming- +# style. +#class-rgx= + +# Naming style matching correct constant names. +const-naming-style=UPPER_CASE + +# Regular expression matching correct constant names. Overrides const-naming- +# style. +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names. +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style. +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + ex, + Run, + _ + +# Good variable names regexes, separated by a comma. If names match any regex, +# they will always be accepted +good-names-rgxs= + +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=no + +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. +#inlinevar-rgx= + +# Naming style matching correct method names. +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style. +#method-rgx= + +# Naming style matching correct module names. +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style. +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty + +# Naming style matching correct variable names. +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style. +#variable-rgx= + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis). It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + +# List of decorators that change the signature of a decorated function. +signature-mutators= + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO + +# Regular expression of note tags to take in consideration. +#notes-rgx= + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid defining new builtins when possible. +additional-builtins= + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore. +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=100 + +# Maximum number of lines in a module. +max-module-lines=1000 + +# List of optional constructs for which whitespace checking is disabled. `dict- +# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. +# `trailing-comma` allows a space between comma and closing bracket: (a, ). +# `empty-line` allows space-only lines. +no-space-check=trailing-comma, + dict-separator + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[LOGGING] + +# The type of string formatting that logging methods do. `old` means using % +# formatting, `new` is for `{}` formatting. +logging-format-style=old + +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging + + +[STRING] + +# This flag controls whether inconsistent-quotes generates a warning when the +# character used as a quote delimiter is used inconsistently within a module. +check-quote-consistency=no + +# This flag controls whether the implicit-str-concat should generate a warning +# on implicit string concatenation in sequences defined over several lines. +check-str-concat-over-line-jumps=no + + +[SIMILARITIES] + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp, + __post_init__ + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict, + _fields, + _replace, + _source, + _make + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=cls + + +[DESIGN] + +# Maximum number of arguments for function / method. +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in an if statement (see R0916). +max-bool-expr=5 + +# Maximum number of branch for function / method body. +max-branches=12 + +# Maximum number of locals for function / method body. +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of return / yield for function / method body. +max-returns=6 + +# Maximum number of statements in function / method body. +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + + +[IMPORTS] + +# List of modules that can be imported at any level, not just the top level +# one. +allow-any-import-level= + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules=optparse,tkinter.tix + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled). +ext-import-graph= + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled). +import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled). +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + +# Couples of modules and preferred modules, separated by a comma. +preferred-modules= + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "BaseException, Exception". +overgeneral-exceptions=BaseException, + Exception diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index fc6d18e5..ef3b2e16 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -47,17 +47,11 @@ import numpy as np import vtk -import pyvista -from pyvista.utilities import conditional_decorator, threaded import scooby -from pyvista.plotting.plotting import BasePlotter -from pyvista.plotting.theme import rcParams - -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QTimer from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor -from PyQt5 import QtGui -from PyQt5 import QtCore +from PyQt5 import QtGui, QtCore +from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QTimer from PyQt5.QtWidgets import ( QMenuBar, QVBoxLayout, @@ -72,6 +66,11 @@ QFileDialog, ) +import pyvista +from pyvista.utilities import conditional_decorator, threaded +from pyvista.plotting.plotting import BasePlotter +from pyvista.plotting.theme import rcParams + log = logging.getLogger("pyvistaqt") log.setLevel(logging.CRITICAL) log.addHandler(logging.StreamHandler()) @@ -101,13 +100,13 @@ class FileDialog(QFileDialog): dlg_accepted = pyqtSignal(str) def __init__( - self, - parent=None, - filefilter=None, - save_mode=True, - show=True, - callback=None, - directory=False, + self, + parent=None, + filefilter=None, + save_mode=True, + show=True, + callback=None, + directory=False, ): """Initialize the file dialog.""" super(FileDialog, self).__init__(parent) @@ -151,6 +150,7 @@ class DoubleSlider(QSlider): https://gist.github.com/dennis-tra/994a65d6165a328d4eabaadbaedac2cc """ + # pylint: disable=C0103 def __init__(self, *args, **kwargs): """Initialize the double slider.""" @@ -227,12 +227,14 @@ def __init__(self, parent, callback, minimum=0.0, maximum=20.0, value=1.0): self.spinbox.valueChanged.connect(self.update_value) self.spinbox.valueChanged.connect(callback) - def update_spinbox(self, value): + def update_spinbox(self, unused): """Set the value of the internal spinbox.""" + del unused self.spinbox.setValue(self.slider.value()) - def update_value(self, value): + def update_value(self, unused): """Update the value of the internal slider.""" + del unused # if self.spinbox.value() < self.minimum: # self.spinbox.setValue(self.minimum) # elif self.spinbox.value() > self.maximum: @@ -288,8 +290,9 @@ def __init__(self, parent, plotter, show=True): if show: # pragma: no cover self.show() - def update_scale(self, value): + def update_scale(self, unused): """Update the scale of all actors in the plotter.""" + del unused self.plotter.set_scale( self.x_slider_group.value, self.y_slider_group.value, @@ -364,23 +367,24 @@ class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): updating the render window when actors are change without being automatically ``Modified``. """ + # pylint: disable=C0103 # Signals must be class attributes render_signal = pyqtSignal() key_press_event_signal = pyqtSignal(vtk.vtkGenericRenderWindowInteractor, str) def __init__( - self, - parent=None, - title=None, - off_screen=None, - multi_samples=None, - line_smoothing=False, - point_smoothing=False, - polygon_smoothing=False, - splitting_position=None, - auto_update=5.0, - **kwargs + self, + parent=None, + title=None, + off_screen=None, + multi_samples=None, + line_smoothing=False, + point_smoothing=False, + polygon_smoothing=False, + splitting_position=None, + auto_update=5.0, + **kwargs ): """Initialize Qt interactor.""" log.debug("QtInteractor init start") @@ -394,6 +398,16 @@ def __init__( with _no_BasePlotter_init(): QVTKRenderWindowInteractor.__init__(self, **qvtk_kwargs) BasePlotter.__init__(self, **kwargs) + + self.url = None + self.default_camera_tool_bar = None + self.saved_camera_positions = None + self.saved_cameras_tool_bar = None + self.main_menu = None + self._menu_close_action = None + self._edl_action = None + self._parallel_projection_action = None + # backward compat for when we had this as a separate class self.interactor = self @@ -508,7 +522,6 @@ def dropEvent(self, event): self.add_mesh(pyvista.read(filename)) except Exception as e: print(str(e)) - pass def add_toolbars(self): """Add the toolbars.""" @@ -517,7 +530,6 @@ def _add_action(tool_bar, key, method): action = QAction(key, self.app_window) action.triggered.connect(method) tool_bar.addAction(action) - return # Camera toolbar self.default_camera_tool_bar = self.app_window.addToolBar("Camera Position") @@ -551,8 +563,6 @@ def _add_action(tool_bar, key, method): self.clear_camera_positions, ) - return - def add_menu_bar(self): """Add the main menu bar.""" self.main_menu = _create_menu_bar(parent=self.app_window) @@ -617,7 +627,6 @@ def load_camera_position(): ) if ncam < 10: self.add_key_event(str(ncam), load_camera_position) - return def clear_camera_positions(self): """Clear all camera positions.""" @@ -626,7 +635,6 @@ def clear_camera_positions(self): if action.text() not in [SAVE_CAM_BUTTON_TEXT, CLEAR_CAMS_BUTTON_TEXT]: self.saved_cameras_tool_bar.removeAction(action) self.saved_camera_positions = [] - return def close(self): """Quit application.""" @@ -704,15 +712,15 @@ class BackgroundPlotter(QtInteractor): ICON_TIME_STEP = 5.0 def __init__( - self, - show=True, - app=None, - window_size=None, - off_screen=None, - allow_quit_keypress=True, - toolbar=True, - menu_bar=True, - **kwargs + self, + show=True, + app=None, + window_size=None, + off_screen=None, + allow_quit_keypress=True, + toolbar=True, + menu_bar=True, + **kwargs ): """Initialize the qt plotter.""" log.debug("BackgroundPlotter init start") @@ -833,7 +841,7 @@ def _close(self): def update_app_icon(self): """Update the app icon if the user is not trying to resize the window.""" if os.name == "nt" or not hasattr( - self, "_last_window_size" + self, "_last_window_size" ): # pragma: no cover # DO NOT EVEN ATTEMPT TO UPDATE ICON ON WINDOWS return @@ -843,7 +851,7 @@ def update_app_icon(self): # This means the user is resizing it so ignore update. pass elif ( - cur_time - self._last_update_time > BackgroundPlotter.ICON_TIME_STEP + cur_time - self._last_update_time > BackgroundPlotter.ICON_TIME_STEP ) and self._last_camera_pos != self.camera_position: # its been a while since last update OR # the camera position has changed and its been at least one second @@ -938,11 +946,13 @@ def add_callback(self, func, interval=1000, count=None): class MainWindow(QMainWindow): """Convenience MainWindow that manages the application.""" + # pylint: disable=C0103 signal_close = pyqtSignal() signal_gesture = pyqtSignal(QtCore.QEvent) def event(self, event): + """Manage events.""" if event.type() == QtCore.QEvent.Gesture: self.signal_gesture.emit(event) return True From c445b797b0cc01dade1d34f3de12529682c8ca46 Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Wed, 29 Jul 2020 13:42:11 +0200 Subject: [PATCH 03/97] Fix codespell conf --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bed8f366..2a3562d8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Simple makefile to simplify repetitive build env management tasks under posix BLACK_DIRS ?= ./pyvistaqt/ -CODESPELL_DIRS ?= ./ +CODESPELL_DIRS ?= ./pyvistaqt ./tests CODESPELL_SKIP ?= "*.pyc,*.txt,*.gif,*.png,*.jpg,*.ply,*.vtk,*.vti,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./docs/_build/*,./docs/images/*,./dist/*,./.ci/*" CODESPELL_IGNORE ?= "ignore_words.txt" From 66ed89ca720230a5abe89fb69da157f42925d07e Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Wed, 29 Jul 2020 13:52:56 +0200 Subject: [PATCH 04/97] Install dependencies --- .github/workflows/pythonpackage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index caef8060..e52c9220 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,6 +11,8 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + - name: Install dependencies + run: pip install -r requirements_test.txt - name: Python Code Quality and Lint uses: ricardochaves/python-lint@v1.1.0 with: From 38948108cfc8efa326bbe86a7306b01fb9441a0b Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Wed, 29 Jul 2020 13:56:39 +0200 Subject: [PATCH 05/97] Setup python first --- .github/workflows/pythonpackage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index e52c9220..49f9b4ae 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,6 +11,8 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + - name: Setup python + run: python -m pip install --upgrade pip setuptools wheel - name: Install dependencies run: pip install -r requirements_test.txt - name: Python Code Quality and Lint From 0b1e993759371e17a7300bba0d557dc8c53bd437 Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Wed, 29 Jul 2020 14:00:27 +0200 Subject: [PATCH 06/97] Use python 3.6 --- .github/workflows/pythonpackage.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 49f9b4ae..cd488bcb 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,6 +11,9 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + with: + python-version: '3.6' + architecture: 'x64' - name: Setup python run: python -m pip install --upgrade pip setuptools wheel - name: Install dependencies From 0eb3b506c1dcb9f86b0e418e2104d85f49269e23 Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Wed, 29 Jul 2020 14:06:24 +0200 Subject: [PATCH 07/97] Fix workflow --- .github/workflows/pythonpackage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index cd488bcb..5be86dbc 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,12 +11,13 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 with: python-version: '3.6' architecture: 'x64' - name: Setup python run: python -m pip install --upgrade pip setuptools wheel - - name: Install dependencies + - name: Install requirements run: pip install -r requirements_test.txt - name: Python Code Quality and Lint uses: ricardochaves/python-lint@v1.1.0 From f662cd4ef35d5e12ccccbf1022d691258d60e75b Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Wed, 29 Jul 2020 14:24:06 +0200 Subject: [PATCH 08/97] Restore workflow --- .github/workflows/pythonpackage.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 5be86dbc..caef8060 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,14 +11,6 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.6' - architecture: 'x64' - - name: Setup python - run: python -m pip install --upgrade pip setuptools wheel - - name: Install requirements - run: pip install -r requirements_test.txt - name: Python Code Quality and Lint uses: ricardochaves/python-lint@v1.1.0 with: From 5252e318d2b7b7f9d846e2a6624f00617ca19e19 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Wed, 29 Jul 2020 22:17:58 +0900 Subject: [PATCH 09/97] Update .github/workflows/pythonpackage.yml --- .github/workflows/pythonpackage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index caef8060..4cbe2e12 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,6 +16,7 @@ jobs: with: python-root-list: pyvistaqt use-pylint: true + extra-pylint-options: --disable=F0401 use-pycodestyle: false use-flake8: false use-black: true From c903ba4b6381b939a588463fd461fb8a7f8846d1 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Wed, 29 Jul 2020 22:22:58 +0900 Subject: [PATCH 10/97] Fix C0103: invalid-name --- pyvistaqt/_version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/_version.py b/pyvistaqt/_version.py index c1966fb5..8d4273ea 100644 --- a/pyvistaqt/_version.py +++ b/pyvistaqt/_version.py @@ -1,6 +1,6 @@ """Version info for pyvistaqt.""" # major, minor, patch -version_info = 0, 1, 1 +VERSION_INFO = 0, 1, 1 # Nice string for the version -__version__ = ".".join(map(str, version_info)) +__version__ = ".".join(map(str, VERSION_INFO)) From 33b03d1adceb00bb1fff2e18bca4e87f4ed959aa Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Wed, 29 Jul 2020 22:45:27 +0900 Subject: [PATCH 11/97] Fix C0103 invalid-name --- pyvistaqt/plotting.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index ef3b2e16..25b4ea3f 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -71,9 +71,9 @@ from pyvista.plotting.plotting import BasePlotter from pyvista.plotting.theme import rcParams -log = logging.getLogger("pyvistaqt") -log.setLevel(logging.CRITICAL) -log.addHandler(logging.StreamHandler()) +LOG = logging.getLogger("pyvistaqt") +LOG.setLevel(logging.CRITICAL) +LOG.addHandler(logging.StreamHandler()) # for display bugs due to older intel integrated GPUs, setting @@ -82,9 +82,9 @@ # changing it from the default 'QWidget'. # See https://github.com/pyvista/pyvista/pull/693 -# log is unused at the moment -# log = logging.getLogger(__name__) -# log.setLevel('DEBUG') +# LOG is unused at the moment +# LOG = logging.getLogger(__name__) +# LOG.setLevel('DEBUG') SAVE_CAM_BUTTON_TEXT = "Save Camera" CLEAR_CAMS_BUTTON_TEXT = "Clear Cameras" @@ -387,7 +387,7 @@ def __init__( **kwargs ): """Initialize Qt interactor.""" - log.debug("QtInteractor init start") + LOG.debug("QtInteractor init start") # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs # because they use **kwargs in their constructor... @@ -473,7 +473,7 @@ def __init__( self._first_time = False # Crucial! self.view_isometric() - log.debug("QtInteractor init stop") + LOG.debug("QtInteractor init stop") def gesture_event(self, event): """Handle gesture events.""" @@ -723,7 +723,7 @@ def __init__( **kwargs ): """Initialize the qt plotter.""" - log.debug("BackgroundPlotter init start") + LOG.debug("BackgroundPlotter init start") if not isinstance(menu_bar, bool): raise TypeError( "Expected type for ``menu_bar`` is bool" @@ -810,7 +810,7 @@ def __init__( # Keypress events self.add_key_event("S", self._qt_screenshot) # shift + s - log.debug("BackgroundPlotter init stop") + LOG.debug("BackgroundPlotter init stop") def reset_key_events(self): """Reset all of the key press events to their defaults. From ca6426566e50846b1281defa2cbd177347ad6f95 Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Wed, 29 Jul 2020 15:52:40 +0200 Subject: [PATCH 12/97] Add pylint Makefile target --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2a3562d8..760d5fed 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ # Simple makefile to simplify repetitive build env management tasks under posix -BLACK_DIRS ?= ./pyvistaqt/ -CODESPELL_DIRS ?= ./pyvistaqt ./tests +SRC_DIR = ./pyvistaqt +BLACK_DIRS ?= $(SRC_DIR) +PYLINT_DIRS ?= $(SRC_DIR) +CODESPELL_DIRS ?= $(SRC_DIR) ./tests CODESPELL_SKIP ?= "*.pyc,*.txt,*.gif,*.png,*.jpg,*.ply,*.vtk,*.vti,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./docs/_build/*,./docs/images/*,./dist/*,./.ci/*" CODESPELL_IGNORE ?= "ignore_words.txt" @@ -13,6 +15,10 @@ black: @echo "Running black" @black $(BLACK_DIRS) +pylint: + @echo "Running pylint" + @pylint $(PYLINT_DIRS) + codespell: @echo "Running codespell" @codespell $(CODESPELL_DIRS) -S $(CODESPELL_SKIP) -I $(CODESPELL_IGNORE) From ce59bf8308812445b0db4e41d30a2a0d56741afa Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Wed, 29 Jul 2020 23:00:40 +0900 Subject: [PATCH 13/97] Fix C0103 invalid-name --- pyvistaqt/plotting.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 25b4ea3f..29500238 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -304,14 +304,14 @@ def resample_image(arr, max_size=400): """Resample a square image to an image of max_size.""" dim = np.max(arr.shape[0:2]) max_size = min(max_size, dim) - x, y, _ = arr.shape - sx = int(np.ceil(x / max_size)) - sy = int(np.ceil(y / max_size)) + x_val, y_val, _ = arr.shape + sx_val = int(np.ceil(x_val / max_size)) + sy_val = int(np.ceil(y_val / max_size)) img = np.zeros((max_size, max_size, 3), dtype=arr.dtype) - arr = arr[0:-1:sx, 0:-1:sy, :] - xl = (max_size - arr.shape[0]) // 2 - yl = (max_size - arr.shape[1]) // 2 - img[xl : arr.shape[0] + xl, yl : arr.shape[1] + yl, :] = arr + arr = arr[0:-1:sx_val, 0:-1:sy_val, :] + xl_val = (max_size - arr.shape[0]) // 2 + yl_val = (max_size - arr.shape[1]) // 2 + img[xl_val : arr.shape[0] + xl_val, yl_val : arr.shape[1] + yl_val, :] = arr return img From 208102da1853e5ebf14bdc73cb240d38a252633e Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 17:56:27 +0900 Subject: [PATCH 14/97] :recycle: fix by pylint --- pyvistaqt/dialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 89bb0517..61fa4d21 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -148,11 +148,11 @@ def __init__(self, parent, callback, minimum=0.0, maximum=20.0, value=1.0): self.spinbox.valueChanged.connect(self.update_value) self.spinbox.valueChanged.connect(callback) - def update_spinbox(self, value): + def update_spinbox(self): """Set the value of the internal spinbox.""" self.spinbox.setValue(self.slider.value()) - def update_value(self, value): + def update_value(self): """Update the value of the internal slider.""" # if self.spinbox.value() < self.minimum: # self.spinbox.setValue(self.minimum) From 83e8448b69b7c1f8b751699ec0fda5d2301c5bb8 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:05:55 +0000 Subject: [PATCH 15/97] Fix Makefile --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 1ad4e4c1..def3aaae 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ BLACK_DIRS ?= ./pyvistaqt/ ISORT_DIRS ?= ./pyvistaqt/*.py PYCODESTYLE_DIRS ?= ./pyvistaqt/ +PYLINT_DIRS ?= ./pyvistaqt/ CODESPELL_DIRS ?= ./ CODESPELL_SKIP ?= "*.pyc,*.txt,*.gif,*.png,*.jpg,*.ply,*.vtk,*.vti,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./docs/_build/*,./docs/images/*,./dist/*,./.ci/*" CODESPELL_IGNORE ?= "ignore_words.txt" From 219962465860b5bcbf04299b07359bc6339f02c2 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:14:25 +0000 Subject: [PATCH 16/97] Move dragEnterEvent to function --- pyvistaqt/plotting.py | 81 ++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 40f0d625..d217a3dc 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -49,10 +49,12 @@ from PyQt5 import QtCore, QtGui from PyQt5.QtCore import QTimer, pyqtSignal from PyQt5.QtWidgets import QAction, QFrame, QMenuBar, QVBoxLayout +from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor + +import pyvista from pyvista.plotting.plotting import BasePlotter from pyvista.plotting.theme import rcParams from pyvista.utilities import conditional_decorator, threaded -from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor from .counter import Counter from .dialog import DoubleSlider, FileDialog, RangeGroup, ScaleAxesDialog @@ -77,7 +79,6 @@ CLEAR_CAMS_BUTTON_TEXT = "Clear Cameras" - def resample_image(arr, max_size=400): """Resample a square image to an image of max_size.""" dim = np.max(arr.shape[0:2]) @@ -113,6 +114,22 @@ def _no_BasePlotter_init(): BasePlotter.__init__ = init +def dragEnterEvent(event): + """Event is called when something is dropped onto the vtk window. + + Only triggers event when event contains file paths that + exist. User can drop anything in this window and we only want + to allow files. + """ + try: + for url in event.mimeData().urls(): + if os.path.isfile(url.path()): + # only call accept on files + event.accept() + except Exception as e: + warnings.warn("Exception when dropping files: %s" % str(e)) + + class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): """Extend QVTKRenderWindowInteractor class. @@ -145,6 +162,7 @@ class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): updating the render window when actors are change without being automatically ``Modified``. """ + # pylint: disable=C0103 # Signals must be class attributes @@ -152,17 +170,17 @@ class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): key_press_event_signal = pyqtSignal(vtk.vtkGenericRenderWindowInteractor, str) def __init__( - self, - parent=None, - title=None, - off_screen=None, - multi_samples=None, - line_smoothing=False, - point_smoothing=False, - polygon_smoothing=False, - splitting_position=None, - auto_update=5.0, - **kwargs + self, + parent=None, + title=None, + off_screen=None, + multi_samples=None, + line_smoothing=False, + point_smoothing=False, + polygon_smoothing=False, + splitting_position=None, + auto_update=5.0, + **kwargs ): """Initialize Qt interactor.""" LOG.debug("QtInteractor init start") @@ -275,21 +293,6 @@ def render(self): """Override the ``render`` method to handle threading issues.""" return self.render_signal.emit() - def dragEnterEvent(self, event): - """Event is called when something is dropped onto the vtk window. - - Only triggers event when event contains file paths that - exist. User can drop anything in this window and we only want - to allow files. - """ - try: - for url in event.mimeData().urls(): - if os.path.isfile(url.path()): - # only call accept on files - event.accept() - except Exception as e: - warnings.warn("Exception when dropping files: %s" % str(e)) - def dropEvent(self, event): """Event is called after dragEnterEvent.""" for url in event.mimeData().urls(): @@ -494,15 +497,15 @@ class BackgroundPlotter(QtInteractor): ICON_TIME_STEP = 5.0 def __init__( - self, - show=True, - app=None, - window_size=None, - off_screen=None, - allow_quit_keypress=True, - toolbar=True, - menu_bar=True, - **kwargs + self, + show=True, + app=None, + window_size=None, + off_screen=None, + allow_quit_keypress=True, + toolbar=True, + menu_bar=True, + **kwargs ): """Initialize the qt plotter.""" LOG.debug("BackgroundPlotter init start") @@ -626,7 +629,7 @@ def _close(self): def update_app_icon(self): """Update the app icon if the user is not trying to resize the window.""" if os.name == "nt" or not hasattr( - self, "_last_window_size" + self, "_last_window_size" ): # pragma: no cover # DO NOT EVEN ATTEMPT TO UPDATE ICON ON WINDOWS return @@ -636,7 +639,7 @@ def update_app_icon(self): # This means the user is resizing it so ignore update. pass elif ( - cur_time - self._last_update_time > BackgroundPlotter.ICON_TIME_STEP + cur_time - self._last_update_time > BackgroundPlotter.ICON_TIME_STEP ) and self._last_camera_pos != self.camera_position: # its been a while since last update OR # the camera position has changed and its been at least one second From 12bd10aa3796f077cfa2c318331a8fd0b11fccac Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:21:12 +0000 Subject: [PATCH 17/97] Fix pylint error --- pyvistaqt/dialog.py | 16 ++++++++-------- pyvistaqt/plotting.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 61fa4d21..a65c7b18 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -22,13 +22,13 @@ class FileDialog(QFileDialog): dlg_accepted = pyqtSignal(str) def __init__( - self, - parent=None, - filefilter=None, - save_mode=True, - show=True, - callback=None, - directory=False, + self, + parent=None, + filefilter=None, + save_mode=True, + show=True, + callback=None, + directory=False, ): """Initialize the file dialog.""" super(FileDialog, self).__init__(parent) @@ -209,7 +209,7 @@ def __init__(self, parent, plotter, show=True): if show: # pragma: no cover self.show() - def update_scale(self, value): + def update_scale(self): """Update the scale of all actors in the plotter.""" self.plotter.set_scale( self.x_slider_group.value, diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index d217a3dc..b476f076 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -183,7 +183,7 @@ def __init__( **kwargs ): """Initialize Qt interactor.""" - LOG.debug("QtInteractor init start") + # LOG.debug("QtInteractor init start") # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs # because they use **kwargs in their constructor... @@ -269,7 +269,7 @@ def __init__( self._first_time = False # Crucial! self.view_isometric() - LOG.debug("QtInteractor init stop") + # LOG.debug("QtInteractor init stop") def gesture_event(self, event): """Handle gesture events.""" From 98565cfacceabbdfccfea26b3f95af65bdbbeee3 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:27:21 +0000 Subject: [PATCH 18/97] Fix W0611 unused-import --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index b476f076..b9d6b994 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -57,7 +57,7 @@ from pyvista.utilities import conditional_decorator, threaded from .counter import Counter -from .dialog import DoubleSlider, FileDialog, RangeGroup, ScaleAxesDialog +from .dialog import FileDialog, ScaleAxesDialog from .window import MainWindow log = logging.getLogger("pyvistaqt") From 16f9e74359caf85660d0805993eb6151d11b9bf6 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:33:34 +0000 Subject: [PATCH 19/97] Fix W0613: unused-argument --- pyvistaqt/plotting.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index b9d6b994..18f544a6 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -36,6 +36,7 @@ We fix this by internally by temporarily monkey-patching ``BasePlotter.__init__`` with a no-op ``__init__``. """ +import scooby import contextlib import logging import os @@ -71,9 +72,9 @@ # changing it from the default 'QWidget'. # See https://github.com/pyvista/pyvista/pull/693 -# LOG is unused at the moment -# LOG = logging.getLogger(__name__) -# LOG.setLevel('DEBUG') +# log is unused at the moment +# log = logging.getLogger(__name__) +# log.setLevel('DEBUG') SAVE_CAM_BUTTON_TEXT = "Save Camera" CLEAR_CAMS_BUTTON_TEXT = "Clear Cameras" @@ -508,7 +509,7 @@ def __init__( **kwargs ): """Initialize the qt plotter.""" - LOG.debug("BackgroundPlotter init start") + log.debug("BackgroundPlotter init start") if not isinstance(menu_bar, bool): raise TypeError( "Expected type for ``menu_bar`` is bool" @@ -598,7 +599,7 @@ def __init__( # Keypress events self.add_key_event("S", self._qt_screenshot) # shift + s - LOG.debug("BackgroundPlotter init stop") + log.debug("BackgroundPlotter init stop") def reset_key_events(self): """Reset all of the key press events to their defaults. From bed4a79454c0dbb675ebdf874b345bc06bc9b14a Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:37:00 +0000 Subject: [PATCH 20/97] Fix isort --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 18f544a6..8c227950 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -36,7 +36,6 @@ We fix this by internally by temporarily monkey-patching ``BasePlotter.__init__`` with a no-op ``__init__``. """ -import scooby import contextlib import logging import os @@ -46,6 +45,7 @@ from functools import wraps import numpy as np +import scooby import vtk from PyQt5 import QtCore, QtGui from PyQt5.QtCore import QTimer, pyqtSignal From f452316c1b1354cfc8a6e354d2d9184a32f8d4f3 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:41:40 +0000 Subject: [PATCH 21/97] Revert of comment --- pyvistaqt/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 8c227950..f2772046 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -184,7 +184,7 @@ def __init__( **kwargs ): """Initialize Qt interactor.""" - # LOG.debug("QtInteractor init start") + log.debug("QtInteractor init start") # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs # because they use **kwargs in their constructor... @@ -270,7 +270,7 @@ def __init__( self._first_time = False # Crucial! self.view_isometric() - # LOG.debug("QtInteractor init stop") + log.debug("QtInteractor init stop") def gesture_event(self, event): """Handle gesture events.""" From 545889d265b9cf0bccdbabc73dd2aa0b8511de3c Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:49:28 +0000 Subject: [PATCH 22/97] Fix unnecessary-lambda --- pyvistaqt/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index f2772046..0c6d0db2 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -332,7 +332,7 @@ def _view_vector(*args): } for key, method in cvec_setters.items(): self._view_action = _add_action(self.default_camera_tool_bar, key, method) - _add_action(self.default_camera_tool_bar, "Reset", lambda: self.reset_camera()) + _add_action(self.default_camera_tool_bar, "Reset", self.reset_camera()) # Saved camera locations toolbar self.saved_camera_positions = [] @@ -372,7 +372,7 @@ def add_menu_bar(self): tool_menu.addAction("Enable Cell Picking (through)", self.enable_cell_picking) tool_menu.addAction( "Enable Cell Picking (visible)", - lambda: self.enable_cell_picking(through=False), + self.enable_cell_picking(through=False), ) cam_menu = view_menu.addMenu("Camera") From 1154ac3f8f58d7160ac045b704195f36c2b52a54 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 09:50:16 +0000 Subject: [PATCH 23/97] Fix unnecessary-lambda --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 0c6d0db2..e14209b8 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -608,7 +608,7 @@ def reset_key_events(self): """ super(BackgroundPlotter, self).reset_key_events() if self.allow_quit_keypress: - self.add_key_event("q", lambda: self.close()) + self.add_key_event("q", self.close()) def scale_axes_dialog(self, show=True): """Open scale axes dialog.""" From fa0612a074bb8a6486107d2fd14d3aa2b9d8dffe Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 10:08:23 +0000 Subject: [PATCH 24/97] Fix invalid name --- pyvistaqt/dialog.py | 34 +++++++++++++++++----------------- pyvistaqt/plotting.py | 32 ++++++++++++++++---------------- pyvistaqt/window.py | 2 +- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index a65c7b18..bed5a27f 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -79,8 +79,8 @@ def __init__(self, *args, **kwargs): self.decimals = 5 self._max_int = 10 ** self.decimals - super().setMinimum(0) - super().setMaximum(self._max_int) + super().set_minimum(0) + super().set_maximum(self._max_int) self._min_value = 0.0 self._max_value = 20.0 @@ -96,27 +96,27 @@ def value(self): float(super().value()) / self._max_int * self._value_range + self._min_value ) - def setValue(self, value): + def set_value(self, value): """Set the value of the slider.""" - super().setValue( + super().set_value( int((value - self._min_value) / self._value_range * self._max_int) ) - def setMinimum(self, value): + def set_minimum(self, value): """Set the minimum value of the slider.""" if value > self._max_value: # pragma: no cover raise ValueError("Minimum limit cannot be higher than maximum") self._min_value = value - self.setValue(self.value()) + self.set_value(self.value()) - def setMaximum(self, value): + def set_maximum(self, value): """Set the maximum value of the slider.""" if value < self._min_value: # pragma: no cover raise ValueError("Minimum limit cannot be higher than maximum") self._max_value = value - self.setValue(self.value()) + self.set_value(self.value()) # this is redefined from above because the above object is a dummy object @@ -129,9 +129,9 @@ def __init__(self, parent, callback, minimum=0.0, maximum=20.0, value=1.0): super(RangeGroup, self).__init__(parent) self.slider = DoubleSlider(QtCore.Qt.Horizontal) self.slider.setTickInterval(0.1) - self.slider.setMinimum(minimum) - self.slider.setMaximum(maximum) - self.slider.setValue(value) + self.slider.set_minimum(minimum) + self.slider.set_maximum(maximum) + self.slider.set_value(value) self.minimum = minimum self.maximum = maximum @@ -150,17 +150,17 @@ def __init__(self, parent, callback, minimum=0.0, maximum=20.0, value=1.0): def update_spinbox(self): """Set the value of the internal spinbox.""" - self.spinbox.setValue(self.slider.value()) + self.spinbox.set_value(self.slider.value()) def update_value(self): """Update the value of the internal slider.""" # if self.spinbox.value() < self.minimum: - # self.spinbox.setValue(self.minimum) + # self.spinbox.set_value(self.minimum) # elif self.spinbox.value() > self.maximum: - # self.spinbox.setValue(self.maximum) + # self.spinbox.set_value(self.maximum) self.slider.blockSignals(True) - self.slider.setValue(self.spinbox.value()) + self.slider.set_value(self.spinbox.value()) self.slider.blockSignals(False) @property @@ -171,7 +171,7 @@ def value(self): @value.setter def value(self, new_value): """Set the value of the internal slider.""" - self.slider.setValue(new_value) + self.slider.set_value(new_value) class ScaleAxesDialog(QDialog): @@ -184,7 +184,7 @@ def __init__(self, parent, plotter, show=True): """Initialize the scaling dialog.""" super(ScaleAxesDialog, self).__init__(parent) self.setGeometry(300, 300, 50, 50) - self.setMinimumWidth(500) + self.set_minimumWidth(500) self.signal_close.connect(self.close) self.plotter = plotter self.plotter.app_window.signal_close.connect(self.close) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index e14209b8..4f6d2595 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -84,14 +84,14 @@ def resample_image(arr, max_size=400): """Resample a square image to an image of max_size.""" dim = np.max(arr.shape[0:2]) max_size = min(max_size, dim) - x_val, y_val, _ = arr.shape - sx_val = int(np.ceil(x_val / max_size)) - sy_val = int(np.ceil(y_val / max_size)) + x_size, y_size, _ = arr.shape + s_x = int(np.ceil(x_size / max_size)) + s_y = int(np.ceil(y_size / max_size)) img = np.zeros((max_size, max_size, 3), dtype=arr.dtype) - arr = arr[0:-1:sx_val, 0:-1:sy_val, :] - xl_val = (max_size - arr.shape[0]) // 2 - yl_val = (max_size - arr.shape[1]) // 2 - img[xl_val : arr.shape[0] + xl_val, yl_val : arr.shape[1] + yl_val, :] = arr + arr = arr[0:-1:s_x, 0:-1:s_y, :] + x_l = (max_size - arr.shape[0]) // 2 + y_l = (max_size - arr.shape[1]) // 2 + img[x_l : arr.shape[0] + x_l, y_l : arr.shape[1] + y_l, :] = arr return img @@ -99,14 +99,14 @@ def pad_image(arr, max_size=400): """Pad an image to a square then resamples to max_size.""" dim = np.max(arr.shape) img = np.zeros((dim, dim, 3), dtype=arr.dtype) - xl = (dim - arr.shape[0]) // 2 - yl = (dim - arr.shape[1]) // 2 - img[xl : arr.shape[0] + xl, yl : arr.shape[1] + yl, :] = arr + x_l = (dim - arr.shape[0]) // 2 + y_l = (dim - arr.shape[1]) // 2 + img[x_l : arr.shape[0] + x_l, y_l : arr.shape[1] + y_l, :] = arr return resample_image(img, max_size=max_size) @contextlib.contextmanager -def _no_BasePlotter_init(): +def _no_base_plotter_init(): init = BasePlotter.__init__ BasePlotter.__init__ = lambda x: None try: @@ -115,7 +115,7 @@ def _no_BasePlotter_init(): BasePlotter.__init__ = init -def dragEnterEvent(event): +def drag_enter_event(event): """Event is called when something is dropped onto the vtk window. Only triggers event when event contains file paths that @@ -127,8 +127,8 @@ def dragEnterEvent(event): if os.path.isfile(url.path()): # only call accept on files event.accept() - except Exception as e: - warnings.warn("Exception when dropping files: %s" % str(e)) + except Exception as exception: + warnings.warn("Exception when dropping files: %s" % str(exception)) class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): @@ -192,7 +192,7 @@ def __init__( for key in ("stereo", "iren", "rw", "wflags"): if key in kwargs: qvtk_kwargs[key] = kwargs.pop(key) - with _no_BasePlotter_init(): + with _no_base_plotter_init(): QVTKRenderWindowInteractor.__init__(self, **qvtk_kwargs) BasePlotter.__init__(self, **kwargs) @@ -295,7 +295,7 @@ def render(self): return self.render_signal.emit() def dropEvent(self, event): - """Event is called after dragEnterEvent.""" + """Event is called after drag_enter_event.""" for url in event.mimeData().urls(): self.url = url filename = self.url.path() diff --git a/pyvistaqt/window.py b/pyvistaqt/window.py index 1c37b10f..d3bc537b 100644 --- a/pyvistaqt/window.py +++ b/pyvistaqt/window.py @@ -15,7 +15,7 @@ def event(self, event): return True return super().event(event) - def closeEvent(self, event): + def close_event(self, event): """Manage the close event.""" self.signal_close.emit() event.accept() From b3c23bb5bb1293930bf3df70fbe27329d6a44272 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 10:10:53 +0000 Subject: [PATCH 25/97] Fix unused variable --- pyvistaqt/plotting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 4f6d2595..d8d48b5b 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -179,7 +179,6 @@ def __init__( line_smoothing=False, point_smoothing=False, polygon_smoothing=False, - splitting_position=None, auto_update=5.0, **kwargs ): From d6d724231d367ab001857110fbf897a873521b2a Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 10:16:31 +0000 Subject: [PATCH 26/97] Disable conflicting rule between black and pylint See : psf/black#48 PyCQA/pylint#289 --- .pylintrc | 3 ++- pyvistaqt/dialog.py | 14 +++++++------- pyvistaqt/plotting.py | 3 +-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pylintrc b/.pylintrc index 97cfffb0..f12b6fb1 100644 --- a/.pylintrc +++ b/.pylintrc @@ -138,7 +138,8 @@ disable=print-statement, xreadlines-attribute, deprecated-sys-function, exception-escape, - comprehension-escape + comprehension-escape, + bad-continuation # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index bed5a27f..3739ce09 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -22,13 +22,13 @@ class FileDialog(QFileDialog): dlg_accepted = pyqtSignal(str) def __init__( - self, - parent=None, - filefilter=None, - save_mode=True, - show=True, - callback=None, - directory=False, + self, + parent=None, + filefilter=None, + save_mode=True, + show=True, + callback=None, + directory=False, ): """Initialize the file dialog.""" super(FileDialog, self).__init__(parent) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index d8d48b5b..42fb35b3 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -370,8 +370,7 @@ def add_menu_bar(self): tool_menu = self.main_menu.addMenu("Tools") tool_menu.addAction("Enable Cell Picking (through)", self.enable_cell_picking) tool_menu.addAction( - "Enable Cell Picking (visible)", - self.enable_cell_picking(through=False), + "Enable Cell Picking (visible)", self.enable_cell_picking(through=False), ) cam_menu = view_menu.addMenu("Camera") From 39a19c70f2133022940506aa414fb38a079eb89e Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 10:28:53 +0000 Subject: [PATCH 27/97] Fix reimported (W0404) --- pyvistaqt/plotting.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 42fb35b3..ac6ea6e9 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -47,7 +47,7 @@ import numpy as np import scooby import vtk -from PyQt5 import QtCore, QtGui +from PyQt5 import QtCore from PyQt5.QtCore import QTimer, pyqtSignal from PyQt5.QtWidgets import QAction, QFrame, QMenuBar, QVBoxLayout from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor @@ -61,6 +61,12 @@ from .dialog import FileDialog, ScaleAxesDialog from .window import MainWindow +if scooby.in_ipython(): # pragma: no cover + from IPython import get_ipython + from IPython.external.qt_for_kernel import QtGui +else: + from PyQt5 import QtGui + log = logging.getLogger("pyvistaqt") log.setLevel(logging.CRITICAL) log.addHandler(logging.StreamHandler()) @@ -531,13 +537,10 @@ def __init__( # ipython magic if scooby.in_ipython(): # pragma: no cover - from IPython import get_ipython ipython = get_ipython() ipython.magic("gui qt") - from IPython.external.qt_for_kernel import QtGui - QtGui.QApplication.instance() else: ipython = None From c8ba4945e4034bd8bd59b54a6af2f4f2b9df42ea Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 10:41:57 +0000 Subject: [PATCH 28/97] Fix C0412 (ungrouped-imports) --- pyvistaqt/plotting.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index ac6ea6e9..61c44adb 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -47,9 +47,6 @@ import numpy as np import scooby import vtk -from PyQt5 import QtCore -from PyQt5.QtCore import QTimer, pyqtSignal -from PyQt5.QtWidgets import QAction, QFrame, QMenuBar, QVBoxLayout from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor import pyvista @@ -65,7 +62,9 @@ from IPython import get_ipython from IPython.external.qt_for_kernel import QtGui else: - from PyQt5 import QtGui + from PyQt5.QtCore import QTimer, pyqtSignal + from PyQt5.QtWidgets import QAction, QFrame, QMenuBar, QVBoxLayout + from PyQt5 import QtCore, QtGui log = logging.getLogger("pyvistaqt") log.setLevel(logging.CRITICAL) From 17194544b2141c3f461f00ad7958bc61fa0118d6 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 12:24:49 +0000 Subject: [PATCH 29/97] Fix missing-module-docstring --- pyvistaqt/counter.py | 7 ++++++- pyvistaqt/dialog.py | 3 +++ pyvistaqt/window.py | 8 +++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/counter.py b/pyvistaqt/counter.py index 30478312..c38b8669 100644 --- a/pyvistaqt/counter.py +++ b/pyvistaqt/counter.py @@ -1,8 +1,13 @@ +""" +TODO: Add docstring. +""" from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot class Counter(QObject): - """Counter augmented with a Qt timer.""" + """ + Counter classCounter augmented with a Qt timer. + """ signal_finished = pyqtSignal() diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 3739ce09..89ce3f47 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -1,3 +1,6 @@ +""" +TODO: Add docstring +""" import os from PyQt5 import QtCore diff --git a/pyvistaqt/window.py b/pyvistaqt/window.py index d3bc537b..42fc1014 100644 --- a/pyvistaqt/window.py +++ b/pyvistaqt/window.py @@ -1,15 +1,21 @@ +""" +TODO: Add docstring +""" from PyQt5 import QtCore from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QMainWindow class MainWindow(QMainWindow): - """Convenience MainWindow that manages the application.""" + """ + Convenience MainWindow that manages the application. + """ signal_close = pyqtSignal() signal_gesture = pyqtSignal(QtCore.QEvent) def event(self, event): + """TODO: Add docstring""" if event.type() == QtCore.QEvent.Gesture: self.signal_gesture.emit(event) return True From ec45b88e88d6998f698fd3f4547bf30a62089844 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 12:55:13 +0000 Subject: [PATCH 30/97] Fix too-many-arguments --- pyvistaqt/dialog.py | 6 ++++-- pyvistaqt/plotting.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 89ce3f47..2f1c7632 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -32,7 +32,7 @@ def __init__( show=True, callback=None, directory=False, - ): + ): # pylint: disable=too-many-arguments """Initialize the file dialog.""" super(FileDialog, self).__init__(parent) @@ -127,7 +127,9 @@ def set_maximum(self, value): class RangeGroup(QHBoxLayout): """Range group box widget.""" - def __init__(self, parent, callback, minimum=0.0, maximum=20.0, value=1.0): + def __init__( + self, parent, callback, minimum=0.0, maximum=20.0, value=1.0 + ): # pylint: disable=too-many-arguments """Initialize the range widget.""" super(RangeGroup, self).__init__(parent) self.slider = DoubleSlider(QtCore.Qt.Horizontal) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 61c44adb..23505531 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -186,7 +186,7 @@ def __init__( polygon_smoothing=False, auto_update=5.0, **kwargs - ): + ): # pylint: disable=too-many-arguments """Initialize Qt interactor.""" log.debug("QtInteractor init start") # Cannot use super() here because @@ -510,7 +510,7 @@ def __init__( toolbar=True, menu_bar=True, **kwargs - ): + ): # pylint: disable=too-many-arguments """Initialize the qt plotter.""" log.debug("BackgroundPlotter init start") if not isinstance(menu_bar, bool): From 4eccbd010ba1760ce98b9ff66c85863e28fac139 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 13:23:13 +0000 Subject: [PATCH 31/97] Fix broad-except --- pyvistaqt/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 23505531..003d7340 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -132,7 +132,7 @@ def drag_enter_event(event): if os.path.isfile(url.path()): # only call accept on files event.accept() - except Exception as exception: + except OSError as exception: warnings.warn("Exception when dropping files: %s" % str(exception)) @@ -306,7 +306,7 @@ def dropEvent(self, event): if os.path.isfile(filename): try: self.add_mesh(pyvista.read(filename)) - except Exception as e: + except IOError as e: print(str(e)) def add_toolbars(self): From 66081d75179f16fbe395e8284ae8b8164d3cffa5 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 13:27:57 +0000 Subject: [PATCH 32/97] Fix invalid-name --- pyvistaqt/plotting.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 003d7340..b6f932e0 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -66,9 +66,9 @@ from PyQt5.QtWidgets import QAction, QFrame, QMenuBar, QVBoxLayout from PyQt5 import QtCore, QtGui -log = logging.getLogger("pyvistaqt") -log.setLevel(logging.CRITICAL) -log.addHandler(logging.StreamHandler()) +LOG = logging.getLogger("pyvistaqt") +LOG.setLevel(logging.CRITICAL) +LOG.addHandler(logging.StreamHandler()) # for display bugs due to older intel integrated GPUs, setting @@ -77,9 +77,9 @@ # changing it from the default 'QWidget'. # See https://github.com/pyvista/pyvista/pull/693 -# log is unused at the moment -# log = logging.getLogger(__name__) -# log.setLevel('DEBUG') +# LOG is unused at the moment +# LOG = logging.getLogger(__name__) +# LOG.setLevel('DEBUG') SAVE_CAM_BUTTON_TEXT = "Save Camera" CLEAR_CAMS_BUTTON_TEXT = "Clear Cameras" @@ -188,7 +188,7 @@ def __init__( **kwargs ): # pylint: disable=too-many-arguments """Initialize Qt interactor.""" - log.debug("QtInteractor init start") + LOG.debug("QtInteractor init start") # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs # because they use **kwargs in their constructor... @@ -274,7 +274,7 @@ def __init__( self._first_time = False # Crucial! self.view_isometric() - log.debug("QtInteractor init stop") + LOG.debug("QtInteractor init stop") def gesture_event(self, event): """Handle gesture events.""" @@ -512,7 +512,7 @@ def __init__( **kwargs ): # pylint: disable=too-many-arguments """Initialize the qt plotter.""" - log.debug("BackgroundPlotter init start") + LOG.debug("BackgroundPlotter init start") if not isinstance(menu_bar, bool): raise TypeError( "Expected type for ``menu_bar`` is bool" @@ -599,7 +599,7 @@ def __init__( # Keypress events self.add_key_event("S", self._qt_screenshot) # shift + s - log.debug("BackgroundPlotter init stop") + LOG.debug("BackgroundPlotter init stop") def reset_key_events(self): """Reset all of the key press events to their defaults. From fcae4f4b359aaffc4829326d05da0ae5639e4129 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 13:48:24 +0000 Subject: [PATCH 33/97] Fix disable to name --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index b6f932e0..a2d7c36b 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -169,7 +169,7 @@ class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): being automatically ``Modified``. """ - # pylint: disable=C0103 + # pylint: disable=invalid-name # Signals must be class attributes render_signal = pyqtSignal() From 7ea8c6657794e4de5b0076c52768b4381d38bc1f Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 13:53:17 +0000 Subject: [PATCH 34/97] Fix too-many-instance-attributes --- pyvistaqt/plotting.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index a2d7c36b..600a6fbc 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -136,7 +136,9 @@ def drag_enter_event(event): warnings.warn("Exception when dropping files: %s" % str(exception)) -class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): +class QtInteractor( + QVTKRenderWindowInteractor, BasePlotter +): # pylint: disable=too-many-instance-attributes """Extend QVTKRenderWindowInteractor class. This adds the methods available to pyvista.Plotter. @@ -435,7 +437,7 @@ def close(self): QVTKRenderWindowInteractor.close(self) -class BackgroundPlotter(QtInteractor): +class BackgroundPlotter(QtInteractor): # pylint: disable=too-many-instance-attributes """Qt interactive plotter. Background plotter for pyvista that allows you to maintain an From 739d6a66e89a357e7bc0d44c21cf5a9295dcfdcd Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 14:22:34 +0000 Subject: [PATCH 35/97] Fix pylint --- pyvistaqt/plotting.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 600a6fbc..afe5700e 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -138,7 +138,7 @@ def drag_enter_event(event): class QtInteractor( QVTKRenderWindowInteractor, BasePlotter -): # pylint: disable=too-many-instance-attributes +): """Extend QVTKRenderWindowInteractor class. This adds the methods available to pyvista.Plotter. @@ -172,6 +172,10 @@ class QtInteractor( """ # pylint: disable=invalid-name + # pylint: disable=too-many-arguments + # pylint: disable=too-many-branches + # pylint: disable=too-many-instance-attributes + # pylint: disable=too-many-statements # Signals must be class attributes render_signal = pyqtSignal() @@ -188,7 +192,7 @@ def __init__( polygon_smoothing=False, auto_update=5.0, **kwargs - ): # pylint: disable=too-many-arguments + ): """Initialize Qt interactor.""" LOG.debug("QtInteractor init start") # Cannot use super() here because @@ -337,6 +341,7 @@ def _view_vector(*args): "Isometric": lambda: _view_vector((1, 1, 1), (0, 0, 1)), } for key, method in cvec_setters.items(): + # pylint: disable=attribute-defined-outside-init self._view_action = _add_action(self.default_camera_tool_bar, key, method) _add_action(self.default_camera_tool_bar, "Reset", self.reset_camera()) @@ -437,7 +442,7 @@ def close(self): QVTKRenderWindowInteractor.close(self) -class BackgroundPlotter(QtInteractor): # pylint: disable=too-many-instance-attributes +class BackgroundPlotter(QtInteractor): """Qt interactive plotter. Background plotter for pyvista that allows you to maintain an @@ -500,6 +505,11 @@ class BackgroundPlotter(QtInteractor): # pylint: disable=too-many-instance-attr >>> _ = plotter.add_mesh(pv.Sphere()) """ + # pylint: disable=too-many-ancestors + # pylint: disable=too-many-arguments + # pylint: disable=too-many-instance-attributes + # pylint: disable=too-many-statements + ICON_TIME_STEP = 5.0 def __init__( @@ -512,7 +522,7 @@ def __init__( toolbar=True, menu_bar=True, **kwargs - ): # pylint: disable=too-many-arguments + ): """Initialize the qt plotter.""" LOG.debug("BackgroundPlotter init start") if not isinstance(menu_bar, bool): @@ -548,6 +558,7 @@ def __init__( # run within python if app is None: + # pylint: disable=import-outside-toplevel from PyQt5.QtWidgets import QApplication app = QApplication.instance() From 9ec56d289b37f0b7472f27dad3caae23971f7238 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 14:23:13 +0000 Subject: [PATCH 36/97] Fix black --- pyvistaqt/plotting.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index afe5700e..29ef38ad 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -136,9 +136,7 @@ def drag_enter_event(event): warnings.warn("Exception when dropping files: %s" % str(exception)) -class QtInteractor( - QVTKRenderWindowInteractor, BasePlotter -): +class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): """Extend QVTKRenderWindowInteractor class. This adds the methods available to pyvista.Plotter. From 4adf320a43e6c347a6019f1ddc482dfc7152520c Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 14:28:45 +0000 Subject: [PATCH 37/97] Fix invalid-name --- pyvistaqt/plotting.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 29ef38ad..bf72358a 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -169,7 +169,6 @@ class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): being automatically ``Modified``. """ - # pylint: disable=invalid-name # pylint: disable=too-many-arguments # pylint: disable=too-many-branches # pylint: disable=too-many-instance-attributes @@ -302,7 +301,7 @@ def render(self): """Override the ``render`` method to handle threading issues.""" return self.render_signal.emit() - def dropEvent(self, event): + def dropEvent(self, event): # pylint: disable=invalid-name """Event is called after drag_enter_event.""" for url in event.mimeData().urls(): self.url = url @@ -310,8 +309,8 @@ def dropEvent(self, event): if os.path.isfile(filename): try: self.add_mesh(pyvista.read(filename)) - except IOError as e: - print(str(e)) + except IOError as exception: + print(str(exception)) def add_toolbars(self): """Add the toolbars.""" From d4627e3381983107b19877149debb30f1f961538 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 14:33:12 +0000 Subject: [PATCH 38/97] Fix too-many-arguments --- pyvistaqt/plotting.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index bf72358a..72d52e1a 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -169,7 +169,6 @@ class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): being automatically ``Modified``. """ - # pylint: disable=too-many-arguments # pylint: disable=too-many-branches # pylint: disable=too-many-instance-attributes # pylint: disable=too-many-statements @@ -189,7 +188,7 @@ def __init__( polygon_smoothing=False, auto_update=5.0, **kwargs - ): + ): # pylint: disable=too-many-arguments """Initialize Qt interactor.""" LOG.debug("QtInteractor init start") # Cannot use super() here because @@ -503,7 +502,6 @@ class BackgroundPlotter(QtInteractor): """ # pylint: disable=too-many-ancestors - # pylint: disable=too-many-arguments # pylint: disable=too-many-instance-attributes # pylint: disable=too-many-statements @@ -519,7 +517,7 @@ def __init__( toolbar=True, menu_bar=True, **kwargs - ): + ): # pylint: disable=too-many-arguments """Initialize the qt plotter.""" LOG.debug("BackgroundPlotter init start") if not isinstance(menu_bar, bool): From 54bb328e8a53a91e5d83ad6b706b90aebf59e14c Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 23:39:21 +0900 Subject: [PATCH 39/97] Update pyvistaqt/window.py --- pyvistaqt/window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/window.py b/pyvistaqt/window.py index 42fc1014..5a4a0721 100644 --- a/pyvistaqt/window.py +++ b/pyvistaqt/window.py @@ -21,7 +21,7 @@ def event(self, event): return True return super().event(event) - def close_event(self, event): + def closeEvent(self, event): """Manage the close event.""" self.signal_close.emit() event.accept() From bd13784e4a21e31ed11b156101cd7ebbc1d84498 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 23:39:46 +0900 Subject: [PATCH 40/97] Update pyvistaqt/dialog.py --- pyvistaqt/dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 2f1c7632..ea437a5d 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -99,7 +99,7 @@ def value(self): float(super().value()) / self._max_int * self._value_range + self._min_value ) - def set_value(self, value): + def setValue(self, value): """Set the value of the slider.""" super().set_value( int((value - self._min_value) / self._value_range * self._max_int) From 6159f8b3ca9fd7039622843876053f5a0b123a97 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 14:42:27 +0000 Subject: [PATCH 41/97] Fix pylint --- pyvistaqt/dialog.py | 2 +- pyvistaqt/window.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index ea437a5d..5d528a6c 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -99,7 +99,7 @@ def value(self): float(super().value()) / self._max_int * self._value_range + self._min_value ) - def setValue(self, value): + def setValue(self, value): # pylint: disable=invalid-name """Set the value of the slider.""" super().set_value( int((value - self._min_value) / self._value_range * self._max_int) diff --git a/pyvistaqt/window.py b/pyvistaqt/window.py index 5a4a0721..e80cf1c9 100644 --- a/pyvistaqt/window.py +++ b/pyvistaqt/window.py @@ -21,7 +21,7 @@ def event(self, event): return True return super().event(event) - def closeEvent(self, event): + def closeEvent(self, event): # pylint: disable=invalid-name """Manage the close event.""" self.signal_close.emit() event.accept() From e4db855f4f6176c1039f2093a719a00f6b430ddb Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 14:58:18 +0000 Subject: [PATCH 42/97] Fix too-few-public-method --- pyvistaqt/counter.py | 2 ++ pyvistaqt/dialog.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pyvistaqt/counter.py b/pyvistaqt/counter.py index c38b8669..e1bcd295 100644 --- a/pyvistaqt/counter.py +++ b/pyvistaqt/counter.py @@ -9,6 +9,8 @@ class Counter(QObject): Counter classCounter augmented with a Qt timer. """ + # pylint: disable=too-few-public-method + signal_finished = pyqtSignal() def __init__(self, count): diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 5d528a6c..7cb2f705 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -22,6 +22,8 @@ class FileDialog(QFileDialog): the dialog was property closed. """ + # pylint: disable=too-few-public-method + dlg_accepted = pyqtSignal(str) def __init__( From d3008d6219cd293c42a4439102a02282f77957b7 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:02:31 +0000 Subject: [PATCH 43/97] Fix too-few-public-methods --- pyvistaqt/counter.py | 2 +- pyvistaqt/dialog.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/counter.py b/pyvistaqt/counter.py index e1bcd295..a19398e7 100644 --- a/pyvistaqt/counter.py +++ b/pyvistaqt/counter.py @@ -9,7 +9,7 @@ class Counter(QObject): Counter classCounter augmented with a Qt timer. """ - # pylint: disable=too-few-public-method + # pylint: disable=too-few-public-methods signal_finished = pyqtSignal() diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 7cb2f705..f21e3bc5 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -22,7 +22,7 @@ class FileDialog(QFileDialog): the dialog was property closed. """ - # pylint: disable=too-few-public-method + # pylint: disable=too-few-public-methods dlg_accepted = pyqtSignal(str) From c937bc5fc16cf56ba2e0eff37846fcb494df2e7c Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:05:47 +0000 Subject: [PATCH 44/97] Remove enable F401 --- .github/workflows/pythonpackage.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index d2cf0215..9d75cdd5 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,7 +16,6 @@ jobs: with: python-root-list: pyvistaqt use-pylint: true - extra-pylint-options: --disable=F0401 use-pycodestyle: true use-flake8: false use-black: true From 41be8fe8b87637ce7a5d0b3397e8f5de418e8c9f Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:07:00 +0000 Subject: [PATCH 45/97] Revert "Remove enable F401" This reverts commit c937bc5fc16cf56ba2e0eff37846fcb494df2e7c. --- .github/workflows/pythonpackage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9d75cdd5..d2cf0215 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,6 +16,7 @@ jobs: with: python-root-list: pyvistaqt use-pylint: true + extra-pylint-options: --disable=F0401 use-pycodestyle: true use-flake8: false use-black: true From f2c482294b9f6cfee1410c3dc6a2b917b37ae76d Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:11:05 +0000 Subject: [PATCH 46/97] Fix attribute-defined-outside-init --- pyvistaqt/plotting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 72d52e1a..8e197c1e 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -412,6 +412,7 @@ def save_camera_position(self): if hasattr(self, "saved_cameras_tool_bar"): def load_camera_position(): + # pylint: disable=attribute-defined-outside-init self.camera_position = camera_position self.saved_cameras_tool_bar.addAction( From 340c256b9a6a110b8c9c5e9d5cf06ea945faa2e4 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:14:16 +0000 Subject: [PATCH 47/97] Fix too-few-public-methods --- pyvistaqt/dialog.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index f21e3bc5..0d6b275a 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -182,7 +182,11 @@ def value(self, new_value): class ScaleAxesDialog(QDialog): - """Dialog to control axes scaling.""" + """ + Dialog to control axes scaling. + """ + + # pylint: disable=too-few-public-methods accepted = pyqtSignal(float) signal_close = pyqtSignal() From 3c5ee71cf4380e815286e8161d2429975a146674 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:22:38 +0000 Subject: [PATCH 48/97] Fix unsubscriptable-object --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 8e197c1e..dd97ca85 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -658,7 +658,7 @@ def update_app_icon(self): img = pad_image(self.image) qimage = QtGui.QImage( img.copy(), img.shape[1], img.shape[0], QtGui.QImage.Format_RGB888 - ) + ) # pylint: disable=unsubscriptable-object icon = QtGui.QIcon(QtGui.QPixmap.fromImage(qimage)) self.app.setWindowIcon(icon) From 0f413baf3c71a63a5d6c630632bd6d55d1496719 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:27:14 +0000 Subject: [PATCH 49/97] Fix unsubscriptable-object --- pyvistaqt/plotting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index dd97ca85..6f28897d 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -656,9 +656,10 @@ def update_app_icon(self): # Update app icon as preview of the window img = pad_image(self.image) + # pylint: disable=unsubscriptable-object qimage = QtGui.QImage( img.copy(), img.shape[1], img.shape[0], QtGui.QImage.Format_RGB888 - ) # pylint: disable=unsubscriptable-object + ) icon = QtGui.QIcon(QtGui.QPixmap.fromImage(qimage)) self.app.setWindowIcon(icon) From 42e2272474da91f4f3f8d46878911b5ae0570ecb Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:30:51 +0000 Subject: [PATCH 50/97] Fix pycodestyle --- pyvistaqt/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 6f28897d..f11bf0b4 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -188,7 +188,7 @@ def __init__( polygon_smoothing=False, auto_update=5.0, **kwargs - ): # pylint: disable=too-many-arguments + ): # pylint: disable=too-many-arguments """Initialize Qt interactor.""" LOG.debug("QtInteractor init start") # Cannot use super() here because @@ -518,7 +518,7 @@ def __init__( toolbar=True, menu_bar=True, **kwargs - ): # pylint: disable=too-many-arguments + ): # pylint: disable=too-many-arguments """Initialize the qt plotter.""" LOG.debug("BackgroundPlotter init start") if not isinstance(menu_bar, bool): From 95f2363c1d5e5d11db77d7ddc7cd7db0f24cbe4e Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:34:08 +0000 Subject: [PATCH 51/97] Fix isort --- pyvistaqt/plotting.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index f11bf0b4..12986832 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -45,14 +45,13 @@ from functools import wraps import numpy as np +import pyvista import scooby import vtk -from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor - -import pyvista from pyvista.plotting.plotting import BasePlotter from pyvista.plotting.theme import rcParams from pyvista.utilities import conditional_decorator, threaded +from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor from .counter import Counter from .dialog import FileDialog, ScaleAxesDialog From 65285a82b17af14c4030992c1caaedafd032505c Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sat, 15 Aug 2020 15:36:28 +0000 Subject: [PATCH 52/97] Fix typo --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index f12b6fb1..91166a43 100644 --- a/.pylintrc +++ b/.pylintrc @@ -55,7 +55,7 @@ confidence= # can either give multiple identifiers separated by comma (,) or put this # option multiple times (only on the command line, not in the configuration # file where it should appear only once). You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if +# disable everything first and then re-enable specific checks. For example, if # you want to run only the similarities checker, you can use "--disable=all # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use "--disable=all --enable=classes From caa5d65b645e5828ddba5e213f8eb7f800ee56ca Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:07:35 +0900 Subject: [PATCH 53/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 12986832..25c2fd06 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -616,7 +616,7 @@ def reset_key_events(self): """ super(BackgroundPlotter, self).reset_key_events() if self.allow_quit_keypress: - self.add_key_event("q", self.close()) + self.add_key_event("q", lambda: self.close()) def scale_axes_dialog(self, show=True): """Open scale axes dialog.""" From 7fd1a494b20bca2f8ed6f19514774d524bcf6de0 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:09:57 +0900 Subject: [PATCH 54/97] Fix unnecessary-lambda --- pyvistaqt/plotting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 25c2fd06..02e3a40b 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -616,6 +616,7 @@ def reset_key_events(self): """ super(BackgroundPlotter, self).reset_key_events() if self.allow_quit_keypress: + # pylint: disable=unnecessary-lambda self.add_key_event("q", lambda: self.close()) def scale_axes_dialog(self, show=True): From 665ab60cb49d9fac485c3ea33a655f3a46801c96 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:19:48 +0900 Subject: [PATCH 55/97] Update dialog.py --- pyvistaqt/dialog.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 0d6b275a..70375988 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -103,7 +103,7 @@ def value(self): def setValue(self, value): # pylint: disable=invalid-name """Set the value of the slider.""" - super().set_value( + super().setValue( int((value - self._min_value) / self._value_range * self._max_int) ) @@ -113,7 +113,7 @@ def set_minimum(self, value): raise ValueError("Minimum limit cannot be higher than maximum") self._min_value = value - self.set_value(self.value()) + self.setValue(self.value()) def set_maximum(self, value): """Set the maximum value of the slider.""" @@ -121,7 +121,7 @@ def set_maximum(self, value): raise ValueError("Minimum limit cannot be higher than maximum") self._max_value = value - self.set_value(self.value()) + self.setValue(self.value()) # this is redefined from above because the above object is a dummy object @@ -138,7 +138,7 @@ def __init__( self.slider.setTickInterval(0.1) self.slider.set_minimum(minimum) self.slider.set_maximum(maximum) - self.slider.set_value(value) + self.slider.setValue(value) self.minimum = minimum self.maximum = maximum @@ -157,17 +157,17 @@ def __init__( def update_spinbox(self): """Set the value of the internal spinbox.""" - self.spinbox.set_value(self.slider.value()) + self.spinbox.setValue(self.slider.value()) def update_value(self): """Update the value of the internal slider.""" # if self.spinbox.value() < self.minimum: - # self.spinbox.set_value(self.minimum) + # self.spinbox.setValue(self.minimum) # elif self.spinbox.value() > self.maximum: - # self.spinbox.set_value(self.maximum) + # self.spinbox.setValue(self.maximum) self.slider.blockSignals(True) - self.slider.set_value(self.spinbox.value()) + self.slider.setValue(self.spinbox.value()) self.slider.blockSignals(False) @property @@ -178,7 +178,7 @@ def value(self): @value.setter def value(self, new_value): """Set the value of the internal slider.""" - self.slider.set_value(new_value) + self.slider.setValue(new_value) class ScaleAxesDialog(QDialog): From c211cdc7ae84c1c0d604fdebaa1cd1a6cd465a29 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:25:03 +0900 Subject: [PATCH 56/97] Update pyvistaqt/dialog.py --- pyvistaqt/dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 70375988..8bbe1509 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -195,7 +195,7 @@ def __init__(self, parent, plotter, show=True): """Initialize the scaling dialog.""" super(ScaleAxesDialog, self).__init__(parent) self.setGeometry(300, 300, 50, 50) - self.set_minimumWidth(500) + self.setMinimumWidth(500) self.signal_close.connect(self.close) self.plotter = plotter self.plotter.app_window.signal_close.connect(self.close) From aad892dd550745324087e1b8c71c27bb5b08afbd Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:28:11 +0900 Subject: [PATCH 57/97] Update pyvistaqt/dialog.py --- pyvistaqt/dialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 8bbe1509..af7953fa 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -84,8 +84,8 @@ def __init__(self, *args, **kwargs): self.decimals = 5 self._max_int = 10 ** self.decimals - super().set_minimum(0) - super().set_maximum(self._max_int) + super().setMinimum(0) + super().setMaximum(self._max_int) self._min_value = 0.0 self._max_value = 20.0 From 9454a50268f5813206557f7e6a7087b184a4380d Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:28:23 +0900 Subject: [PATCH 58/97] Update pyvistaqt/dialog.py --- pyvistaqt/dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index af7953fa..40c0c30e 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -107,7 +107,7 @@ def setValue(self, value): # pylint: disable=invalid-name int((value - self._min_value) / self._value_range * self._max_int) ) - def set_minimum(self, value): + def setMinimum(self, value): """Set the minimum value of the slider.""" if value > self._max_value: # pragma: no cover raise ValueError("Minimum limit cannot be higher than maximum") From 9bfbfb213cc2c5a284934e612ac34f0ea48db377 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:28:33 +0900 Subject: [PATCH 59/97] Update pyvistaqt/dialog.py --- pyvistaqt/dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 40c0c30e..c5bec68d 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -115,7 +115,7 @@ def setMinimum(self, value): self._min_value = value self.setValue(self.value()) - def set_maximum(self, value): + def setMaximum(self, value): """Set the maximum value of the slider.""" if value < self._min_value: # pragma: no cover raise ValueError("Minimum limit cannot be higher than maximum") From 9ca6c1d9f0f92b8cc2315903e623921b58b0fdc5 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:30:54 +0900 Subject: [PATCH 60/97] Fix invalid-name --- pyvistaqt/dialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index c5bec68d..bb7a45cd 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -107,7 +107,7 @@ def setValue(self, value): # pylint: disable=invalid-name int((value - self._min_value) / self._value_range * self._max_int) ) - def setMinimum(self, value): + def setMinimum(self, value): # pylint: disable=invalid-name """Set the minimum value of the slider.""" if value > self._max_value: # pragma: no cover raise ValueError("Minimum limit cannot be higher than maximum") @@ -115,7 +115,7 @@ def setMinimum(self, value): self._min_value = value self.setValue(self.value()) - def setMaximum(self, value): + def setMaximum(self, value): # pylint: disable=invalid-name """Set the maximum value of the slider.""" if value < self._min_value: # pragma: no cover raise ValueError("Minimum limit cannot be higher than maximum") From 3519bec9b1f5c3a402746de57d8d0e923bb142b7 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:35:57 +0900 Subject: [PATCH 61/97] Update pyvistaqt/dialog.py --- pyvistaqt/dialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index bb7a45cd..d9b9703d 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -136,8 +136,8 @@ def __init__( super(RangeGroup, self).__init__(parent) self.slider = DoubleSlider(QtCore.Qt.Horizontal) self.slider.setTickInterval(0.1) - self.slider.set_minimum(minimum) - self.slider.set_maximum(maximum) + self.slider.setMinimum(minimum) + self.slider.setMaximum(maximum) self.slider.setValue(value) self.minimum = minimum From ff11cc15a65ae6b904da24f20262b7e1f0aeaf0e Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:41:08 +0900 Subject: [PATCH 62/97] Update pyvistaqt/dialog.py --- pyvistaqt/dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index d9b9703d..0b2cc473 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -155,7 +155,7 @@ def __init__( self.spinbox.valueChanged.connect(self.update_value) self.spinbox.valueChanged.connect(callback) - def update_spinbox(self): + def update_spinbox(self, value): """Set the value of the internal spinbox.""" self.spinbox.setValue(self.slider.value()) From c432c174122ed21a9eef77b296395587f616c48c Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:41:21 +0900 Subject: [PATCH 63/97] Update pyvistaqt/dialog.py --- pyvistaqt/dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 0b2cc473..481ad64f 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -159,7 +159,7 @@ def update_spinbox(self, value): """Set the value of the internal spinbox.""" self.spinbox.setValue(self.slider.value()) - def update_value(self): + def update_value(self, value): """Update the value of the internal slider.""" # if self.spinbox.value() < self.minimum: # self.spinbox.setValue(self.minimum) From 8168e49f7a8dfb245ffffc0c2b0da47a9f2ea676 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:44:17 +0900 Subject: [PATCH 64/97] Fix unused-argument --- pyvistaqt/dialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 481ad64f..8ec4ed9d 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -155,11 +155,11 @@ def __init__( self.spinbox.valueChanged.connect(self.update_value) self.spinbox.valueChanged.connect(callback) - def update_spinbox(self, value): + def update_spinbox(self, value): # pylint: disable=unused-argument """Set the value of the internal spinbox.""" self.spinbox.setValue(self.slider.value()) - def update_value(self, value): + def update_value(self, value): # pylint: disable=unused-argument """Update the value of the internal slider.""" # if self.spinbox.value() < self.minimum: # self.spinbox.setValue(self.minimum) From 9e2bad58a27e86a7689de89188bbf35896470156 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:47:05 +0900 Subject: [PATCH 65/97] Fix at least two spaces before inline comment --- pyvistaqt/dialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 8ec4ed9d..2d5d3f60 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -155,11 +155,11 @@ def __init__( self.spinbox.valueChanged.connect(self.update_value) self.spinbox.valueChanged.connect(callback) - def update_spinbox(self, value): # pylint: disable=unused-argument + def update_spinbox(self, value): # pylint: disable=unused-argument """Set the value of the internal spinbox.""" self.spinbox.setValue(self.slider.value()) - def update_value(self, value): # pylint: disable=unused-argument + def update_value(self, value): # pylint: disable=unused-argument """Update the value of the internal slider.""" # if self.spinbox.value() < self.minimum: # self.spinbox.setValue(self.minimum) From 36e678e73eea93d4aa886ab1b8d25eb972cd2479 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:50:19 +0900 Subject: [PATCH 66/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 02e3a40b..24830f5e 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -200,16 +200,6 @@ def __init__( with _no_base_plotter_init(): QVTKRenderWindowInteractor.__init__(self, **qvtk_kwargs) BasePlotter.__init__(self, **kwargs) - - self.url = None - self.default_camera_tool_bar = None - self.saved_camera_positions = None - self.saved_cameras_tool_bar = None - self.main_menu = None - self._menu_close_action = None - self._edl_action = None - self._parallel_projection_action = None - # backward compat for when we had this as a separate class self.interactor = self From 6a9034fe97c619891bedda8145d6db5c56e2b38e Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:52:32 +0900 Subject: [PATCH 67/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 24830f5e..85474a09 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -119,22 +119,6 @@ def _no_base_plotter_init(): BasePlotter.__init__ = init -def drag_enter_event(event): - """Event is called when something is dropped onto the vtk window. - - Only triggers event when event contains file paths that - exist. User can drop anything in this window and we only want - to allow files. - """ - try: - for url in event.mimeData().urls(): - if os.path.isfile(url.path()): - # only call accept on files - event.accept() - except OSError as exception: - warnings.warn("Exception when dropping files: %s" % str(exception)) - - class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): """Extend QVTKRenderWindowInteractor class. From 2aa349b60b615dc11c748f656c7da0ed136e0fa0 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 01:52:43 +0900 Subject: [PATCH 68/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 85474a09..7b70e95f 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -273,6 +273,20 @@ def render(self): """Override the ``render`` method to handle threading issues.""" return self.render_signal.emit() + def dragEnterEvent(self, event): + """Event is called when something is dropped onto the vtk window. + Only triggers event when event contains file paths that + exist. User can drop anything in this window and we only want + to allow files. + """ + try: + for url in event.mimeData().urls(): + if os.path.isfile(url.path()): + # only call accept on files + event.accept() + except Exception as e: + warnings.warn("Exception when dropping files: %s" % str(e)) + def dropEvent(self, event): # pylint: disable=invalid-name """Event is called after drag_enter_event.""" for url in event.mimeData().urls(): From db9a3a8b623617343a3f68b8be1b4eecb651627c Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 02:32:05 +0900 Subject: [PATCH 69/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 7b70e95f..f0661a81 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -288,7 +288,7 @@ def dragEnterEvent(self, event): warnings.warn("Exception when dropping files: %s" % str(e)) def dropEvent(self, event): # pylint: disable=invalid-name - """Event is called after drag_enter_event.""" + """Event is called after dragEnterEvent.""" for url in event.mimeData().urls(): self.url = url filename = self.url.path() From 79cfe6f0e21762e9a6a91fa819498e0287f62702 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 02:35:23 +0900 Subject: [PATCH 70/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index f0661a81..89f74af1 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -326,7 +326,7 @@ def _view_vector(*args): for key, method in cvec_setters.items(): # pylint: disable=attribute-defined-outside-init self._view_action = _add_action(self.default_camera_tool_bar, key, method) - _add_action(self.default_camera_tool_bar, "Reset", self.reset_camera()) + _add_action(self.default_camera_tool_bar, "Reset", lambda: self.reset_camera())``` # Saved camera locations toolbar self.saved_camera_positions = [] From 44291e79b12b910d32e0e2d91123e043461038cb Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 02:50:24 +0900 Subject: [PATCH 71/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 89f74af1..eb03ee21 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -326,7 +326,7 @@ def _view_vector(*args): for key, method in cvec_setters.items(): # pylint: disable=attribute-defined-outside-init self._view_action = _add_action(self.default_camera_tool_bar, key, method) - _add_action(self.default_camera_tool_bar, "Reset", lambda: self.reset_camera())``` + _add_action(self.default_camera_tool_bar, "Reset", lambda: self.reset_camera()) # Saved camera locations toolbar self.saved_camera_positions = [] From 23e2a78e79ede4a73bd04c82a67446ac4df9acff Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 02:54:16 +0900 Subject: [PATCH 72/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index eb03ee21..cfd6493b 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -365,7 +365,8 @@ def add_menu_bar(self): tool_menu = self.main_menu.addMenu("Tools") tool_menu.addAction("Enable Cell Picking (through)", self.enable_cell_picking) tool_menu.addAction( - "Enable Cell Picking (visible)", self.enable_cell_picking(through=False), + "Enable Cell Picking (visible)", + lambda: self.enable_cell_picking(through=False), ) cam_menu = view_menu.addMenu("Camera") From 4fca4c0ad7b9758181b85215477aded486b36ffa Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:04:10 +0900 Subject: [PATCH 73/97] Fix invalid-name --- pyvistaqt/plotting.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index cfd6493b..d918db25 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -273,7 +273,7 @@ def render(self): """Override the ``render`` method to handle threading issues.""" return self.render_signal.emit() - def dragEnterEvent(self, event): + def dragEnterEvent(self, event): # pylint: disable=invalid-name """Event is called when something is dropped onto the vtk window. Only triggers event when event contains file paths that exist. User can drop anything in this window and we only want @@ -284,8 +284,8 @@ def dragEnterEvent(self, event): if os.path.isfile(url.path()): # only call accept on files event.accept() - except Exception as e: - warnings.warn("Exception when dropping files: %s" % str(e)) + except Exception as exception: + warnings.warn("Exception when dropping files: %s" % str(exception) def dropEvent(self, event): # pylint: disable=invalid-name """Event is called after dragEnterEvent.""" From 0d39cbb260e9dc5b128aeb599bc9030421776767 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:07:39 +0900 Subject: [PATCH 74/97] Update plotting.py --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index d918db25..b76e7a83 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -285,7 +285,7 @@ def dragEnterEvent(self, event): # pylint: disable=invalid-name # only call accept on files event.accept() except Exception as exception: - warnings.warn("Exception when dropping files: %s" % str(exception) + warnings.warn("Exception when dropping files: %s" % str(exception)) def dropEvent(self, event): # pylint: disable=invalid-name """Event is called after dragEnterEvent.""" From db595ba114549a3b5a8db138601b9953b5d8917d Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:11:33 +0900 Subject: [PATCH 75/97] Update plotting.py --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index b76e7a83..7f99da5d 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -284,7 +284,7 @@ def dragEnterEvent(self, event): # pylint: disable=invalid-name if os.path.isfile(url.path()): # only call accept on files event.accept() - except Exception as exception: + except IOError as exception: warnings.warn("Exception when dropping files: %s" % str(exception)) def dropEvent(self, event): # pylint: disable=invalid-name From c4721f34087921b35abc03ede69f5008ba7768a5 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:17:37 +0900 Subject: [PATCH 76/97] Fix no-self-use --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 7f99da5d..1a78a70f 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -273,7 +273,7 @@ def render(self): """Override the ``render`` method to handle threading issues.""" return self.render_signal.emit() - def dragEnterEvent(self, event): # pylint: disable=invalid-name + def dragEnterEvent(self, event): # pylint: disable=invalid-name,no-self-use """Event is called when something is dropped onto the vtk window. Only triggers event when event contains file paths that exist. User can drop anything in this window and we only want From a6f40cc271c4c7c57d214e39b910dfc04d5ff288 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:24:06 +0900 Subject: [PATCH 77/97] Fix attribute-defined-outside-init --- pyvistaqt/plotting.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 1a78a70f..c134a946 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -173,6 +173,9 @@ def __init__( **kwargs ): # pylint: disable=too-many-arguments """Initialize Qt interactor.""" + + self.url=None + LOG.debug("QtInteractor init start") # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs From e3fe281702bc1374bc04658cf3bca34a43af2a7b Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:39:22 +0900 Subject: [PATCH 78/97] Fix attribute-defined-outside-init --- pyvistaqt/plotting.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index c134a946..9cfe8257 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -174,7 +174,14 @@ def __init__( ): # pylint: disable=too-many-arguments """Initialize Qt interactor.""" - self.url=None + self.default_camera_tool_bar = None + self.saved_camera_positions = None + self.saved_camera_positions = None + self.saved_cameras_tool_bar = None + self.main_menu = None + self._menu_close_action = None + self._edl_action = None + self._parallel_projection_action = None LOG.debug("QtInteractor init start") # Cannot use super() here because From e333ba800f0ecbb4a3f38f719e11efa4300ae0a6 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:47:32 +0900 Subject: [PATCH 79/97] Fix attribute-defined-outside-init --- pyvistaqt/plotting.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 9cfe8257..63056063 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -174,6 +174,7 @@ def __init__( ): # pylint: disable=too-many-arguments """Initialize Qt interactor.""" + self.url = None self.default_camera_tool_bar = None self.saved_camera_positions = None self.saved_camera_positions = None @@ -336,6 +337,7 @@ def _view_vector(*args): for key, method in cvec_setters.items(): # pylint: disable=attribute-defined-outside-init self._view_action = _add_action(self.default_camera_tool_bar, key, method) + # pylint: disable=unnecessary-lambda _add_action(self.default_camera_tool_bar, "Reset", lambda: self.reset_camera()) # Saved camera locations toolbar From b75506b4d5b318963841b4ccb225955fde04b02f Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:49:01 +0900 Subject: [PATCH 80/97] Fix E261 at least two spaces before inline comment --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 63056063..f28dd547 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -284,7 +284,7 @@ def render(self): """Override the ``render`` method to handle threading issues.""" return self.render_signal.emit() - def dragEnterEvent(self, event): # pylint: disable=invalid-name,no-self-use + def dragEnterEvent(self, event): # pylint: disable=invalid-name,no-self-use """Event is called when something is dropped onto the vtk window. Only triggers event when event contains file paths that exist. User can drop anything in this window and we only want From c3ff66ab06bac74300e87fb4e118c022b2b2bb33 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:54:05 +0900 Subject: [PATCH 81/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index f28dd547..3754bd85 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -173,6 +173,7 @@ def __init__( **kwargs ): # pylint: disable=too-many-arguments """Initialize Qt interactor.""" + LOG.debug("QtInteractor init start") self.url = None self.default_camera_tool_bar = None From 7b03b36813d86b2952449fe055528ad635fdefc0 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:55:50 +0900 Subject: [PATCH 82/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 3754bd85..05090ba6 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -185,7 +185,6 @@ def __init__( self._edl_action = None self._parallel_projection_action = None - LOG.debug("QtInteractor init start") # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs # because they use **kwargs in their constructor... From ae3603f864882bf970c6c46322e75b0fa0eebd2a Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:59:18 +0900 Subject: [PATCH 83/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 05090ba6..36a86d58 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -184,6 +184,7 @@ def __init__( self._menu_close_action = None self._edl_action = None self._parallel_projection_action = None + self._view_action = None # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs From f055de4c5029a5a6147e630774ec000c7f2b330d Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 03:59:26 +0900 Subject: [PATCH 84/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 36a86d58..6e9c4de1 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -336,7 +336,6 @@ def _view_vector(*args): "Isometric": lambda: _view_vector((1, 1, 1), (0, 0, 1)), } for key, method in cvec_setters.items(): - # pylint: disable=attribute-defined-outside-init self._view_action = _add_action(self.default_camera_tool_bar, key, method) # pylint: disable=unnecessary-lambda _add_action(self.default_camera_tool_bar, "Reset", lambda: self.reset_camera()) From 2748f8fe6fe16d2ce99a49228c8ab60d39044bc4 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 04:03:40 +0900 Subject: [PATCH 85/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 6e9c4de1..75476fea 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -185,6 +185,7 @@ def __init__( self._edl_action = None self._parallel_projection_action = None self._view_action = None + self.camera_position = None # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs From 083d38a4817bf2aec066b52e34459c73475ea1b3 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 04:03:50 +0900 Subject: [PATCH 86/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 75476fea..a59ad576 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -413,7 +413,6 @@ def save_camera_position(self): if hasattr(self, "saved_cameras_tool_bar"): def load_camera_position(): - # pylint: disable=attribute-defined-outside-init self.camera_position = camera_position self.saved_cameras_tool_bar.addAction( From 3ebd1ea266136775f5dd6905bc9ec3ce0799046f Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 04:18:50 +0900 Subject: [PATCH 87/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index a59ad576..fd2d4652 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -185,7 +185,6 @@ def __init__( self._edl_action = None self._parallel_projection_action = None self._view_action = None - self.camera_position = None # Cannot use super() here because # QVTKRenderWindowInteractor silently swallows all kwargs From 765ac8dd58b9093f524059b7159a8a446a2331cb Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 04:21:15 +0900 Subject: [PATCH 88/97] Fix attribute-defined-outside-init --- pyvistaqt/plotting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index fd2d4652..6e9c4de1 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -412,6 +412,7 @@ def save_camera_position(self): if hasattr(self, "saved_cameras_tool_bar"): def load_camera_position(): + # pylint: disable=attribute-defined-outside-init self.camera_position = camera_position self.saved_cameras_tool_bar.addAction( From c6b1a96825b98c32ae2a5cd9abe84d75f7498bb2 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 10:55:11 +0900 Subject: [PATCH 89/97] Update pyvistaqt/window.py --- pyvistaqt/window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/window.py b/pyvistaqt/window.py index e80cf1c9..c0f9359d 100644 --- a/pyvistaqt/window.py +++ b/pyvistaqt/window.py @@ -16,7 +16,7 @@ class MainWindow(QMainWindow): def event(self, event): """TODO: Add docstring""" - if event.type() == QtCore.QEvent.Gesture: + if event.type() == QtCore.QEvent.Gesture: # pragma: no cover self.signal_gesture.emit(event) return True return super().event(event) From c6c88c5b15e59a2cf03a9e8eb7ad08277fe43446 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 11:03:10 +0900 Subject: [PATCH 90/97] Fix no cover --- pyvistaqt/plotting.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 6e9c4de1..f220496c 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -291,6 +291,7 @@ def dragEnterEvent(self, event): # pylint: disable=invalid-name,no-self-use exist. User can drop anything in this window and we only want to allow files. """ + # pragma: no cover try: for url in event.mimeData().urls(): if os.path.isfile(url.path()): @@ -301,6 +302,7 @@ def dragEnterEvent(self, event): # pylint: disable=invalid-name,no-self-use def dropEvent(self, event): # pylint: disable=invalid-name """Event is called after dragEnterEvent.""" + # pragma: no cover for url in event.mimeData().urls(): self.url = url filename = self.url.path() From fa0e3cdf8e58d9ff49b2eb8fbc153e7418b44125 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 11:10:15 +0900 Subject: [PATCH 91/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index f220496c..cfcffc0c 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -297,7 +297,7 @@ def dragEnterEvent(self, event): # pylint: disable=invalid-name,no-self-use if os.path.isfile(url.path()): # only call accept on files event.accept() - except IOError as exception: + except IOError as exception: # pragma: no cover warnings.warn("Exception when dropping files: %s" % str(exception)) def dropEvent(self, event): # pylint: disable=invalid-name From c99a831b60e9611c9c3ce24934c81770ff0f4466 Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Sun, 16 Aug 2020 11:10:25 +0900 Subject: [PATCH 92/97] Update pyvistaqt/plotting.py --- pyvistaqt/plotting.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index cfcffc0c..ef2e675b 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -302,8 +302,7 @@ def dragEnterEvent(self, event): # pylint: disable=invalid-name,no-self-use def dropEvent(self, event): # pylint: disable=invalid-name """Event is called after dragEnterEvent.""" - # pragma: no cover - for url in event.mimeData().urls(): + for url in event.mimeData().urls(): # pragma: no cover self.url = url filename = self.url.path() if os.path.isfile(filename): From 50f2a73724dfee590449c2b81b76e7a9305ba44a Mon Sep 17 00:00:00 2001 From: Tetsuo Koyama Date: Tue, 18 Aug 2020 09:22:20 +0000 Subject: [PATCH 93/97] Fix pylint --- Makefile | 8 +++++--- pyvistaqt/plotting.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 916acc11..8ada487c 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,12 @@ FLAKE8_DIRS ?= ./pyvistaqt/ CODESPELL_DIRS ?= ./ CODESPELL_SKIP ?= "*.pyc,*.txt,*.gif,*.png,*.jpg,*.ply,*.vtk,*.vti,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./docs/_build/*,./docs/images/*,./dist/*,./.ci/*" CODESPELL_IGNORE ?= "ignore_words.txt" -EXTRA_PYCODESTYLE_OPTIONS ?= --ignore="E501,E203" -EXTRA_FLAKE8_OPTIONS ?= --ignore="E501,E203" +EXTRA_PYCODESTYLE_OPTIONS ?= --ignore="E501,E203,W503" +EXTRA_FLAKE8_OPTIONS ?= --ignore="E501,E203,W503" -all: doctest +all: srcstyle doctest + +srcstyle: black isort pylint pycodestyle flake8 doctest: codespell pydocstyle diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 1a1d2c95..113b97b3 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -152,7 +152,6 @@ class QtInteractor(QVTKRenderWindowInteractor, BasePlotter): being automatically ``Modified``. """ - # pylint: disable=too-many-branches # pylint: disable=too-many-instance-attributes # pylint: disable=too-many-statements @@ -172,6 +171,7 @@ def __init__( auto_update=5.0, **kwargs ): # pylint: disable=too-many-arguments + # pylint: disable=too-many-branches """Initialize Qt interactor.""" LOG.debug("QtInteractor init start") @@ -525,6 +525,7 @@ def __init__( update_app_icon=False, **kwargs ): # pylint: disable=too-many-arguments + # pylint: disable=too-many-branches """Initialize the qt plotter.""" LOG.debug("BackgroundPlotter init start") if not isinstance(menu_bar, bool): From 1ed9cd879a75ddeaa60b8cabe8d212fd21ac4e8d Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Tue, 18 Aug 2020 13:53:01 +0200 Subject: [PATCH 94/97] Restore imports and adds docstrings --- pyvistaqt/counter.py | 4 ++-- pyvistaqt/dialog.py | 2 +- pyvistaqt/plotting.py | 12 +++++++----- pyvistaqt/window.py | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pyvistaqt/counter.py b/pyvistaqt/counter.py index a19398e7..56bd6199 100644 --- a/pyvistaqt/counter.py +++ b/pyvistaqt/counter.py @@ -1,12 +1,12 @@ """ -TODO: Add docstring. +This module contains a basic Qt-compatible counter class. """ from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot class Counter(QObject): """ - Counter classCounter augmented with a Qt timer. + Counter class with Qt signal/slot. """ # pylint: disable=too-few-public-methods diff --git a/pyvistaqt/dialog.py b/pyvistaqt/dialog.py index 2d5d3f60..b2fa6d0b 100644 --- a/pyvistaqt/dialog.py +++ b/pyvistaqt/dialog.py @@ -1,5 +1,5 @@ """ -TODO: Add docstring +This module contains Qt dialog widgets. """ import os diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 113b97b3..4f5a238a 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -45,13 +45,17 @@ from functools import wraps import numpy as np -import pyvista import scooby import vtk +from PyQt5 import QtCore +from PyQt5.QtCore import QTimer, pyqtSignal +from PyQt5.QtWidgets import QAction, QFrame, QMenuBar, QVBoxLayout +from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor + +import pyvista from pyvista.plotting.plotting import BasePlotter from pyvista.plotting.theme import rcParams from pyvista.utilities import conditional_decorator, threaded -from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor from .counter import Counter from .dialog import FileDialog, ScaleAxesDialog @@ -61,9 +65,7 @@ from IPython import get_ipython from IPython.external.qt_for_kernel import QtGui else: - from PyQt5.QtCore import QTimer, pyqtSignal - from PyQt5.QtWidgets import QAction, QFrame, QMenuBar, QVBoxLayout - from PyQt5 import QtCore, QtGui + from PyQt5 import QtGui LOG = logging.getLogger("pyvistaqt") LOG.setLevel(logging.CRITICAL) diff --git a/pyvistaqt/window.py b/pyvistaqt/window.py index c0f9359d..dff0d69c 100644 --- a/pyvistaqt/window.py +++ b/pyvistaqt/window.py @@ -1,5 +1,5 @@ """ -TODO: Add docstring +This module contains a Qt-compatible MainWindow class. """ from PyQt5 import QtCore from PyQt5.QtCore import pyqtSignal From 60feec9f0577348da3c9fb13c1df46dbd001107d Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Tue, 18 Aug 2020 13:58:53 +0200 Subject: [PATCH 95/97] Deal with PyQt5 ungrouped-imports --- pyvistaqt/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index 4f5a238a..dbcc8e86 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -65,7 +65,7 @@ from IPython import get_ipython from IPython.external.qt_for_kernel import QtGui else: - from PyQt5 import QtGui + from PyQt5 import QtGui # pylint: disable=ungrouped-imports LOG = logging.getLogger("pyvistaqt") LOG.setLevel(logging.CRITICAL) From 7883590094a469214ee29b6224bebf1176268278 Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Tue, 18 Aug 2020 14:02:50 +0200 Subject: [PATCH 96/97] Make isort --- pyvistaqt/plotting.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyvistaqt/plotting.py b/pyvistaqt/plotting.py index dbcc8e86..e9afd2cf 100644 --- a/pyvistaqt/plotting.py +++ b/pyvistaqt/plotting.py @@ -45,17 +45,16 @@ from functools import wraps import numpy as np +import pyvista import scooby import vtk from PyQt5 import QtCore from PyQt5.QtCore import QTimer, pyqtSignal from PyQt5.QtWidgets import QAction, QFrame, QMenuBar, QVBoxLayout -from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor - -import pyvista from pyvista.plotting.plotting import BasePlotter from pyvista.plotting.theme import rcParams from pyvista.utilities import conditional_decorator, threaded +from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor from .counter import Counter from .dialog import FileDialog, ScaleAxesDialog From 627dcf758a39fcbaa40095a67fa28e26141c3b5b Mon Sep 17 00:00:00 2001 From: Guillaume Favelier Date: Tue, 18 Aug 2020 14:13:46 +0200 Subject: [PATCH 97/97] Add docstring --- pyvistaqt/window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyvistaqt/window.py b/pyvistaqt/window.py index dff0d69c..c595539a 100644 --- a/pyvistaqt/window.py +++ b/pyvistaqt/window.py @@ -15,7 +15,7 @@ class MainWindow(QMainWindow): signal_gesture = pyqtSignal(QtCore.QEvent) def event(self, event): - """TODO: Add docstring""" + """Manage window events and filter the gesture event.""" if event.type() == QtCore.QEvent.Gesture: # pragma: no cover self.signal_gesture.emit(event) return True