diff --git a/bcipy/gui/main.py b/bcipy/gui/main.py index 9d032dfa..b6455338 100644 --- a/bcipy/gui/main.py +++ b/bcipy/gui/main.py @@ -366,6 +366,7 @@ def init_control(self, value): spin_box = QSpinBox() spin_box.setMinimum(-100000) spin_box.setMaximum(100000) + spin_box.wheelEvent = lambda event: None # disable scroll wheel if value: spin_box.setValue(int(value)) return spin_box @@ -424,6 +425,7 @@ def init_control(self, value): spin_box.setDecimals(props.decimals) spin_box.setSingleStep(props.step) spin_box.setValue(float(value)) + spin_box.wheelEvent = lambda event: None # disable scroll wheel return spin_box def cast_value(self) -> float: @@ -656,6 +658,7 @@ def float_input(self, value: float) -> QWidget: spin_box.setDecimals(props.decimals) spin_box.setSingleStep(props.step) spin_box.setValue(value) + spin_box.wheelEvent = lambda event: None # disable scroll wheel return spin_box def int_input(self, value: int) -> QWidget: @@ -666,6 +669,7 @@ def int_input(self, value: int) -> QWidget: -100000 if self.input_min is None else self.input_min) spin_box.setMaximum( 100000 if self.input_max is None else self.input_max) + spin_box.wheelEvent = lambda event: None # disable scroll wheel if value: spin_box.setValue(value) return spin_box diff --git a/bcipy/gui/parameters/params_form.py b/bcipy/gui/parameters/params_form.py index 602d6a81..4c243f76 100644 --- a/bcipy/gui/parameters/params_form.py +++ b/bcipy/gui/parameters/params_form.py @@ -1,5 +1,6 @@ """GUI form for editing a Parameters file.""" # pylint: disable=E0611 +import argparse import sys from datetime import datetime from pathlib import Path @@ -9,7 +10,7 @@ from PyQt6.QtWidgets import (QApplication, QFileDialog, QHBoxLayout, QPushButton, QScrollArea, QVBoxLayout, QWidget) -from bcipy.config import BCIPY_ROOT +from bcipy.config import BCIPY_ROOT, DEFAULT_PARAMETERS_PATH from bcipy.gui.main import (BoolInput, DirectoryInput, FileInput, FloatInput, FormInput, IntegerInput, RangeInput, SearchInput, SelectionInput, TextInput, static_text_control) @@ -423,7 +424,7 @@ def on_save_as(self): self.repaint() -def main(json_file, title='BCI Parameters', size=(750, 800)) -> str: +def init(json_file, title='BCI Parameters', size=(750, 800)) -> str: """Set up the GUI components and start the main loop.""" app = QApplication(sys.argv) panel = MainPanel(json_file, title, size) @@ -433,12 +434,8 @@ def main(json_file, title='BCI Parameters', size=(750, 800)) -> str: return json_file -if __name__ == '__main__': - - import argparse - - from bcipy.config import DEFAULT_PARAMETERS_PATH - +def main(): + """Process command line arguments and initialize the GUI.""" parser = argparse.ArgumentParser() # Command line utility for adding arguments/ paths via command line @@ -449,4 +446,8 @@ def main(json_file, title='BCI Parameters', size=(750, 800)) -> str: args = parser.parse_args() # Note that this write to stdout is important for the interaction with # the BCInterface main GUI. - print(main(args.parameters), file=sys.stdout) + print(init(args.parameters), file=sys.stdout) + + +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py index 9c213b15..167bacdb 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ class UploadCommand(Command): """Support setup.py upload. - + Modified from https://github.com/kennethreitz/setup.py """ @@ -106,12 +106,13 @@ def run(self): 'data', )), entry_points={ - 'console_scripts': - [ + 'console_scripts': [ 'bcipy = bcipy.main:bcipy_main', 'bcipy-erp-viz = bcipy.helpers.visualization:erp', 'bcipy-sim = bcipy.simulator:main', - "bcipy-train = bcipy.signal.model.offline_analysis:main"], + 'bcipy-train = bcipy.signal.model.offline_analysis:main', + 'bcipy-params = bcipy.gui.parameters.params_form:main' + ], }, install_requires=REQUIRED, include_package_data=True, @@ -132,4 +133,4 @@ def run(self): cmdclass={ 'upload': UploadCommand, }, -) \ No newline at end of file +)