From efd8960e1eb4857f5a478e1c0c5aaf933d16a000 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Mon, 22 Apr 2024 16:46:50 +0200 Subject: [PATCH] Pamhyr2: Fix pep8. --- src/View/Network/GraphWidget.py | 20 ++++++++++---------- src/View/RunSolver/Window.py | 11 +++++++++-- src/View/Tools/PamhyrPlot.py | 14 +++++++------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/View/Network/GraphWidget.py b/src/View/Network/GraphWidget.py index 8f993785..8d01954c 100644 --- a/src/View/Network/GraphWidget.py +++ b/src/View/Network/GraphWidget.py @@ -818,18 +818,18 @@ class GraphWidget(QGraphicsView): # If state is "move" if self._state == "move": # Move on scene - if (not self.selected_item() and - (event.buttons() & Qt.LeftButton)): - old_p = self.mapToScene( - int(self.m_origin_x), int(self.m_origin_y) - ) - new_p = self.mapToScene(event.pos()) - translation = new_p - old_p + if not self.selected_item(): + if event.buttons() & Qt.LeftButton: + old_p = self.mapToScene( + int(self.m_origin_x), int(self.m_origin_y) + ) + new_p = self.mapToScene(event.pos()) + translation = new_p - old_p - self.translate(translation.x(), translation.y()) + self.translate(translation.x(), translation.y()) - self.m_origin_x = event.x() - self.m_origin_y = event.y() + self.m_origin_x = event.x() + self.m_origin_y = event.y() # Propagate event self.update() diff --git a/src/View/RunSolver/Window.py b/src/View/RunSolver/Window.py index eb6533c5..6f9bf5e6 100644 --- a/src/View/RunSolver/Window.py +++ b/src/View/RunSolver/Window.py @@ -162,7 +162,10 @@ class SolverLogWindow(PamhyrWindow): if ok: self.run() else: - self._log(f" *** Failed to export study to {self._solver._type}", color="red") + self._log( + f" *** Failed to export study to {self._solver._type}", + color="red" + ) def setup_action(self): self.find(QAction, "action_start").setEnabled(False) @@ -324,7 +327,11 @@ class SolverLogWindow(PamhyrWindow): def start(self): if self._solver.is_stoped(): self._log(f" *** Export study {self._solver.name}", color="blue") - ok = self._solver.export(self._study, self._workdir, qlog=self._output) + + ok = self._solver.export( + self._study, self._workdir, qlog=self._output + ) + if not ok: self._log(f" *** Failed to export", color="red") self.update() diff --git a/src/View/Tools/PamhyrPlot.py b/src/View/Tools/PamhyrPlot.py index b934a3ac..08232273 100644 --- a/src/View/Tools/PamhyrPlot.py +++ b/src/View/Tools/PamhyrPlot.py @@ -70,17 +70,17 @@ class PamhyrPlot(APlot): self._label_x = "X" self._label_y = "Y" - self._isometric_axis = True #: Use isometric view + self._isometric_axis = True #: Use isometric view - self._auto_relim = True #: Auto relim axes at plot creation - self._autoscale = True #: Auto scale at plot creation + self._auto_relim = True #: Auto relim axes at plot creation + self._autoscale = True #: Auto scale at plot creation - self._auto_relim_update = False #: Auto relim axes at plot update - self._autoscale_update = False #: Auto scale at plot creation + self._auto_relim_update = False #: Auto relim axes at plot update + self._autoscale_update = False #: Auto scale at plot creation - self._highlight_data = None #: Data identifier to highlight (free type) + self._highlight_data = None #: Data identifier to highlight self._highlight_data_update = False - self._current_data = None #: Current data identifier (free type) + self._current_data = None #: Current data identifier self._current_data_update = False super(PamhyrPlot, self).__init__(data=data) -- GitLab