Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of qt5 entirely in optional requirements #326

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions mne_lsl/stream_viewer/stream_viewer.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
import sys
import time

from qtpy.QtWidgets import QApplication

from ..lsl import StreamInlet, resolve_streams
from ..utils._checks import check_type
from ..utils.logs import _use_log_level, logger
from .control_gui.control_eeg import ControlGUI_EEG
from .scope.scope_eeg import ScopeEEG


class StreamViewer:
"""Class for visualizing the signals coming from an LSL stream.

The stream viewer will connect to only one LSL stream. If ``stream_name``
is set to ``None``, an automatic search is performed followed by a prompt
if multiple non-markers streams are found.
The stream viewer will connect to only one LSL stream.

Parameters
----------
stream_name : str | None
Servers' name to connect to. ``None`` will prompt the user.
Servers' name to connect to.
"""

def __init__(self, stream_name=None):
Expand All @@ -29,16 +23,18 @@ def __init__(self, stream_name=None):
def start(self, bufsize=0.2):
"""Connect to the selected amplifier and plot the streamed data.

If ``stream_name`` is not provided, look for available streams on the
network.

Parameters
----------
bufsize : int | float
Buffer/window size of the attached Viewer.
The default ``0.2`` should work in most cases since data is fetched
every 20 ms.
"""
from qtpy.QtWidgets import QApplication
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than any of this stuff you could in theory use MNE-Python's app framework, which also has the advantage of setting a nice icon etc. like in mne-qt-browser

https://github.com/mne-tools/mne-qt-browser/blob/a267775f2d0edcf188507c4a66c566cc25182fa2/mne_qt_browser/_pg_figure.py#L44

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but I'll keep that for whenever I get the motivation to continue #174 ;)


from .control_gui.control_eeg import ControlGUI_EEG
from .scope.scope_eeg import ScopeEEG

self._inlet = StreamInlet(self._sinfo)
self._inlet.open_stream()
time.sleep(bufsize) # Delay to fill the LSL buffer.
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ doc = [
'matplotlib',
'memory-profiler',
'numpydoc',
'pyqt5',
'scikit-learn',
'sphinx!=7.2.*',
'sphinx-copybutton',
Expand All @@ -91,7 +90,7 @@ style = [
'toml-sort',
'yamllint',
]
test = ['pyqt5', 'pytest-cov', 'pytest-randomly', 'pytest-timeout', 'pytest>=8.0']
test = ['pytest-cov', 'pytest-randomly', 'pytest-timeout', 'pytest>=8.0']

[project.scripts]
mne-lsl = 'mne_lsl.commands.main:run'
Expand Down