-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] pre-commit autoupdate (#283)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
cfa0f60
commit 6bed7d3
Showing
8 changed files
with
19 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Backports for older installations.""" | ||
|
||
# Author: Martin Schulz <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Base classes and functions for 2D browser backends.""" | ||
|
||
# Author: Martin Schulz <[email protected]> | ||
|
@@ -1457,7 +1456,7 @@ def mouseDragEvent(self, event, axis=None): | |
self.mne.overview_bar.update_annotations() | ||
else: | ||
x_to = self.mapSceneToView(event.scenePos()).x() | ||
with SignalBlocker(self._drag_region): | ||
with QSignalBlocker(self._drag_region): | ||
self._drag_region.setRegion((self._drag_start, x_to)) | ||
|
||
elif event.isFinish(): | ||
|
@@ -2481,7 +2480,7 @@ def _region_changed(self): | |
for region in overlapping_regions: | ||
self.weakmain()._remove_region(region, from_annot=False) | ||
# re-set while blocking the signal to avoid re-running this function | ||
with SignalBlocker(self): | ||
with QSignalBlocker(self): | ||
self.setRegion((onset, offset)) | ||
|
||
self.update_label_pos() | ||
|
@@ -2654,7 +2653,7 @@ def mouseDragEvent(self, ev): | |
for pos in new_pos: | ||
pos.setX(pos.x() - shift) | ||
|
||
with SignalBlocker(self.lines[0]): | ||
with QSignalBlocker(self.lines[0]): | ||
for pos, line in zip(new_pos, self.lines): | ||
line.setPos(pos) | ||
self.prepareGeometryChange() | ||
|
@@ -3066,9 +3065,9 @@ def update_values(self, region): | |
rgn = region.getRegion() | ||
self.start_bx.setEnabled(True) | ||
self.stop_bx.setEnabled(True) | ||
with SignalBlocker(self.start_bx): | ||
with QSignalBlocker(self.start_bx): | ||
self.start_bx.setValue(rgn[0]) | ||
with SignalBlocker(self.stop_bx): | ||
with QSignalBlocker(self.stop_bx): | ||
self.stop_bx.setValue(rgn[1]) | ||
|
||
def _update_description_cmbx(self): | ||
|
@@ -3087,9 +3086,9 @@ def reset(self): | |
if self.description_cmbx.count() > 0: | ||
self.description_cmbx.setCurrentIndex(0) | ||
self.mne.current_description = self.description_cmbx.currentText() | ||
with SignalBlocker(self.start_bx): | ||
with QSignalBlocker(self.start_bx): | ||
self.start_bx.setValue(0) | ||
with SignalBlocker(self.stop_bx): | ||
with QSignalBlocker(self.stop_bx): | ||
self.stop_bx.setValue(1 / self.mne.info["sfreq"]) | ||
|
||
def _show_help(self): | ||
|
@@ -4096,7 +4095,7 @@ def hscroll(self, step): | |
del step | ||
|
||
# Get current range and add step to it | ||
xmin, xmax = [i + rel_step for i in self.mne.viewbox.viewRange()[0]] | ||
xmin, xmax = (i + rel_step for i in self.mne.viewbox.viewRange()[0]) | ||
|
||
if xmin < 0: | ||
xmin = 0 | ||
|
@@ -4125,7 +4124,7 @@ def vscroll(self, step): | |
step = self.mne.n_channels | ||
elif step == "-full": | ||
step = -self.mne.n_channels | ||
ymin, ymax = [i + step for i in self.mne.viewbox.viewRange()[1]] | ||
ymin, ymax = (i + step for i in self.mne.viewbox.viewRange()[1]) | ||
|
||
if ymin < 0: | ||
ymin = 0 | ||
|
@@ -4696,9 +4695,9 @@ def _remove_region(self, region, from_annot=True): | |
# disable, reset start/stop doubleSpinBox until another region is selected | ||
self.mne.fig_annotation.start_bx.setEnabled(False) | ||
self.mne.fig_annotation.stop_bx.setEnabled(False) | ||
with SignalBlocker(self.mne.fig_annotation.start_bx): | ||
with QSignalBlocker(self.mne.fig_annotation.start_bx): | ||
self.mne.fig_annotation.start_bx.setValue(0) | ||
with SignalBlocker(self.mne.fig_annotation.stop_bx): | ||
with QSignalBlocker(self.mne.fig_annotation.stop_bx): | ||
self.mne.fig_annotation.stop_bx.setValue(1 / self.mne.info["sfreq"]) | ||
|
||
# Remove from annotations | ||
|
@@ -5191,12 +5190,12 @@ def _fake_click( | |
add_points[idx] = self.mne.viewbox.mapViewToScene(Point(*apoint)) | ||
|
||
elif xform == "none" or xform is None: | ||
if isinstance(point, (tuple, list)): | ||
if isinstance(point, tuple | list): | ||
point = Point(*point) | ||
else: | ||
point = Point(point) | ||
for idx, apoint in enumerate(add_points): | ||
if isinstance(apoint, (tuple, list)): | ||
if isinstance(apoint, tuple | list): | ||
add_points[idx] = Point(*apoint) | ||
else: | ||
add_points[idx] = Point(apoint) | ||
|
@@ -5452,22 +5451,6 @@ def _init_browser(**kwargs): | |
return browser | ||
|
||
|
||
class SignalBlocker(QSignalBlocker): | ||
"""Wrapper to use QSignalBlocker as a context manager in PySide2.""" | ||
|
||
def __enter__(self): | ||
if hasattr(super(), "__enter__"): | ||
super().__enter__() | ||
else: | ||
super().reblock() | ||
|
||
def __exit__(self, exc_type, exc_value, traceback): | ||
if hasattr(super(), "__exit__"): | ||
super().__exit__(exc_type, exc_value, traceback) | ||
else: | ||
super().unblock() | ||
|
||
|
||
def _set_window_flags(widget): | ||
if os.getenv("_MNE_BROWSER_BACK", "").lower() == "true": | ||
widget.setWindowFlags(widget.windowFlags() | Qt.WindowStaysOnBottomHint) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# Authors: Eric Larson <[email protected]> | ||
# Martin Schulz <[email protected]> | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# Author: Martin Schulz <[email protected]> | ||
# | ||
# License: BSD-3-Clause | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# Authors: Eric Larson <[email protected]> | ||
# Martin Schulz <[email protected]> | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build" | |
name = "mne-qt-browser" | ||
description = "A new backend based on pyqtgraph for the 2D-Data-Browser in MNE-Python" | ||
readme = "README.md" | ||
requires-python = ">=3.9" | ||
requires-python = ">=3.10" | ||
license = { file = "LICENSE" } | ||
keywords = ["science", "neuroscience", "psychology"] | ||
authors = [{ name = "Martin Schulz", email = "[email protected]" }] | ||
|
@@ -68,7 +68,7 @@ filterwarnings = [ | |
] | ||
|
||
[tool.ruff.lint] | ||
select = ["E", "F", "W", "D", "I"] | ||
select = ["E", "F", "W", "D", "I", "UP"] | ||
exclude = ["__init__.py"] | ||
ignore = [ | ||
"D100", # Missing docstring in public module | ||
|