def __init__(self): super().__init__() # global variables self.X_train = None self.y_train = None self.X_test = None self.y_test = None self.precision = None self.recall = None self.accuracy = None self.random_state = None self.max_iter = 1000 #GUI self.random_state_field = style.create_field(str(self.random_state)) self.max_iter_field = style.create_field(str(self.max_iter)) layout = QGridLayout() box = gui.widgetBox(self.controlArea, "Info", orientation=layout) box.setAlignment(Qt.AlignCenter) info = QLabel( "Enter random state and maximum iteration to classificate classes." ) layout.addWidget(info) boxMarker = gui.widgetBox(self.controlArea, "Results") self.marker_info = gui.widgetLabel(boxMarker, "No results") gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) random_state_label = QLabel("random state") random_state_label.setFont(QFont("Helvetica", pointSize=11)) random_state_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(random_state_label) self.field_layout.addWidget(self.random_state_field) # gui.separator(self.controlArea) max_iter_label = QLabel("max iter") max_iter_label.setFont(QFont("Helvetica", pointSize=11)) max_iter_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(max_iter_label) self.field_layout.addWidget(self.max_iter_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() self.tmin = -0.1 self.tmax = 1 self.segment_len = 1000 self.prestimulus_field = style.create_field(str(self.tmin)) self.poststimulus_field = style.create_field(str(self.tmax)) self.segment_len_field = style.create_field(str(self.segment_len)) layout = QGridLayout() box = gui.widgetBox(self.controlArea, "Info", orientation=layout) box.setAlignment(Qt.AlignCenter) info = QLabel( "Enter the segment length to segment the specific parts of the data." ) layout.addWidget(info) gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) prestimulus_label = QLabel("PreStimulus offset: (seconds)") prestimulus_label.setFont(QFont("Helvetica", pointSize=11)) prestimulus_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(prestimulus_label) self.field_layout.addWidget(self.prestimulus_field) # gui.separator(self.controlArea) poststimulus_label = QLabel("PostStimulus offset: (seconds)") poststimulus_label.setFont(QFont("Helvetica", pointSize=11)) poststimulus_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(poststimulus_label) self.field_layout.addWidget(self.poststimulus_field) segment_len_label = QLabel("Segment length") segment_len_label.setFont(QFont("Helvetica", pointSize=11)) segment_len_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(segment_len_label) self.field_layout.addWidget(self.segment_len_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() self.channel = 0 self.channel_field = style.create_field(str(self.channel)) box = gui.widgetBox(self.controlArea, "Epochs -> Table") #box.setMinimumSize(80, 10) self.convert_info = gui.widgetLabel(box, "No epochs converted.") self.info = gui.widgetLabel(box, 'Fill channel to convert.') gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) channel_label = QLabel("Channel to convert.") channel_label.setFont(QFont("Helvetica", pointSize=11)) channel_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(channel_label) self.field_layout.addWidget(self.channel_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def add_field(self): """Adds a new text field to the field layout in the GUI. And calls the reorder_tabs function.""" field = style.create_field() self.fields.append(field) self.field_layout.addWidget(field) self.reorder_tabs()
def __init__(self): super().__init__() self.sfreq = 200 self.sfreq_field = style.create_field(str(self.sfreq)) box = gui.widgetBox(self.controlArea, "Info") box.setAlignment(Qt.AlignCenter) self.info = gui.widgetLabel(box, 'Fill sample rate to use.') gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) sfreq_label = QLabel("Sample rate to use.") sfreq_label.setFont(QFont("Helvetica", pointSize=11)) sfreq_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(sfreq_label) self.field_layout.addWidget(self.sfreq_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() self.n_components = None self.random_state = None self.max_iter = 200 self.n_components_field = style.create_field(str(self.n_components)) self.random_state_field = style.create_field(str(self.random_state)) self.max_iter_field = style.create_field(str(self.max_iter)) box = gui.widgetBox(self.controlArea, "Info") box.setAlignment(Qt.AlignCenter) self.info = gui.widgetLabel(box, 'Fill in the necessary parameters.') gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) n_components_label = QLabel("Number of components.") n_components_label.setFont(QFont("Helvetica", pointSize=11)) n_components_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(n_components_label) self.field_layout.addWidget(self.n_components_field) random_state_label = QLabel("Random state") random_state_label.setFont(QFont("Helvetica", pointSize=11)) random_state_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(random_state_label) self.field_layout.addWidget(self.random_state_field) max_iter_label = QLabel("Maximum number of iterations") max_iter_label.setFont(QFont("Helvetica", pointSize=11)) max_iter_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(max_iter_label) self.field_layout.addWidget(self.max_iter_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() # global variables self.data = None self.epochs = None self.smaller = 2 self.larger = 4 self.min_field = style.create_field(str(self.smaller)) self.max_field = style.create_field(str(self.larger)) layout = QGridLayout() box = gui.widgetBox(self.controlArea, "Info", orientation=layout) box.setAlignment(Qt.AlignCenter) info = QLabel("Enter the prestimulus and poststimulus offset in seconds to extract the specific parts of the data.") layout.addWidget(info) gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) prestimulus_label = QLabel("Event ID with a smaller number") prestimulus_label.setFont(QFont("Helvetica", pointSize=11)) prestimulus_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(prestimulus_label) self.field_layout.addWidget(self.min_field) # gui.separator(self.controlArea) poststimulus_label = QLabel("Event ID with a larger number") poststimulus_label.setFont(QFont("Helvetica", pointSize=11)) poststimulus_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(poststimulus_label) self.field_layout.addWidget(self.max_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() self.wave_family = 'db1' self.degrees = 1 self.family_field = style.create_field(self.wave_family) self.degrees_field = style.create_field(str(self.degrees)) box = gui.widgetBox(self.controlArea, "Info") box.setAlignment(Qt.AlignCenter) self.info = gui.widgetLabel(box, 'Fill wavelet family and number of degrees of transformation.') gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) family_label = QLabel("Wavelet family") family_label.setFont(QFont("Helvetica", pointSize=11)) family_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(family_label) self.field_layout.addWidget(self.family_field) degrees_label = QLabel("Number of degrees of transformation") degrees_label.setFont(QFont("Helvetica", pointSize=11)) degrees_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(degrees_label) self.field_layout.addWidget(self.degrees_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() self.start_time = 0 self.end_time = 1 self.data = None self.baseline_start_field = style.create_field(str(self.start_time)) self.baseline_end_field = style.create_field(str(self.end_time)) box = gui.widgetBox(self.controlArea, "Info") box.setAlignment(Qt.AlignCenter) self.info = gui.widgetLabel(box, 'Fill start and end time.') gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) start_time_label = QLabel("Start time: (seconds)") start_time_label.setFont(QFont("Helvetica", pointSize=11)) start_time_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(start_time_label) self.field_layout.addWidget(self.baseline_start_field) end_time_label = QLabel("End time: (seconds)") end_time_label.setFont(QFont("Helvetica", pointSize=11)) end_time_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(end_time_label) self.field_layout.addWidget(self.baseline_end_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() self.file_type = "EEG header files (*.vhdr)" self.file_path = None self.already_output = False self.data = None self.kind = 'standard_1020' # GUI box = gui.widgetBox(self.controlArea, "Info") self.info_file = gui.widgetLabel(box, "No file has been selected yet.") self.kind_field = style.create_field(str(self.kind)) field_layout = QGridLayout() field_layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, margin=10, orientation=field_layout) kind_label = QLabel("The name of the montage file.") kind_label.setFont(QFont("Helvetica", pointSize=11)) kind_label.setAlignment(Qt.AlignCenter) field_layout.addWidget(kind_label) field_layout.addWidget(self.kind_field) layout = QVBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, margin=10, orientation=layout) file_button = QPushButton("Choose an EEG header file") file_button.setStyleSheet(style.btn_primary) file_button.clicked.connect(self.choose_file) file_button.setSizePolicy(Policy.Maximum, Policy.Fixed) file_button.setMinimumSize(QSize(160, 25)) layout.addWidget(file_button) self.reset_button = QPushButton("Reset") self.reset_button.setStyleSheet(style.btn_success) self.reset_button.clicked.connect(self.reset) self.reset_button.setSizePolicy(Policy.Maximum, Policy.Fixed) self.reset_button.setMinimumSize(QSize(160, 25)) layout.addWidget(self.reset_button)
def __init__(self): super().__init__() self.fmin = -1000 self.fmax = 1000 self.tmin = -1000 self.tmax = 1000 self.n_fft = 2500 self.fmin_field = style.create_field(str(self.fmin)) self.fmax_field = style.create_field(str(self.fmax)) self.tmin_field = style.create_field(str(self.tmin)) self.tmax_field = style.create_field(str(self.tmax)) self.n_fft_field = style.create_field(str(self.n_fft)) box = gui.widgetBox(self.controlArea, "Info") box.setAlignment(Qt.AlignCenter) self.info = gui.widgetLabel( box, 'Fill start and end frequency and time to consider.') gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) fmin_label = QLabel("Start frequency") fmin_label.setFont(QFont("Helvetica", pointSize=11)) fmin_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(fmin_label) self.field_layout.addWidget(self.fmin_field) fmax_label = QLabel("End frequency") fmax_label.setFont(QFont("Helvetica", pointSize=11)) fmax_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(fmax_label) self.field_layout.addWidget(self.fmax_field) tmin_label = QLabel("Start time") tmin_label.setFont(QFont("Helvetica", pointSize=11)) tmin_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(tmin_label) self.field_layout.addWidget(self.tmin_field) tmax_label = QLabel("End time") tmax_label.setFont(QFont("Helvetica", pointSize=11)) tmax_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(tmax_label) self.field_layout.addWidget(self.tmax_field) n_fft_label = QLabel("Number of points") n_fft_label.setFont(QFont("Helvetica", pointSize=11)) n_fft_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(n_fft_label) self.field_layout.addWidget(self.n_fft_field) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() # Default settings for the widget self.default_channels = ["Pz", ""] self.fields = [ style.create_field(self.default_channels[i]) for i in range(len(self.default_channels)) ] self.selected_channels = self.default_channels if __name__ == "__main__": data = mne.io.read_raw_brainvision( "../data/LED_28_06_2012_104.vhdr", preload=True, stim_channel=True) self.set_input_data(data) else: self.data = None layout = QGridLayout() box = gui.widgetBox(self.controlArea, "Info", orientation=layout) box.setAlignment(Qt.AlignCenter) info = QLabel( "Select the channels to keep in the data flow by typing out their names.\n" "Channels are selected when data is input into this node.\n") note = QLabel( "Note: empty fields will be ignored. Invalid channel names will also be ignored." ) layout.addWidget(info) layout.addWidget(note) gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) label = QLabel("Channel names: ") label.setFont(QFont("Helvetica", pointSize=11)) label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(label) for field in self.fields: self.field_layout.addWidget(field) gui.separator(self.controlArea) button_layout = QHBoxLayout() button_layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=button_layout) add_button = QPushButton("Add") add_button.setToolTip("Add a new text field") add_button.clicked.connect(self.add_field) add_button.setStyleSheet(style.btn_primary) add_button.setMinimumSize(QSize(90, 25)) button_layout.addWidget(add_button) remove_button = QPushButton("Remove") remove_button.setToolTip("Remove the last text field") remove_button.clicked.connect(self.remove_field) remove_button.setStyleSheet(style.btn_warning) remove_button.setMinimumSize(QSize(90, 25)) remove_button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) button_layout.addWidget(remove_button) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_names) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() self.data = None self.data_inlet = None self.marker_inlet = None self.data_pointer = -1 self.events = [] self.running = True self.ch_names = None self.ch_types = None self.has_stim = False self.timeout = 2 self.main_thread = threading.current_thread() self.data_stream_property = "type" self.data_stream_value = "EEG" self.markers_stream_property = "type" self.markers_stream_value = "Markers" elements_width = 135 # GUI layout = QGridLayout() box = gui.widgetBox(self.controlArea, "Info", orientation=layout) box.setAlignment(Qt.AlignCenter) self.info_data_stream = QLabel("Data stream: no stream yet.") self.info_markers_stream = QLabel("Markers stream: no stream yet.") layout.addWidget(self.info_data_stream) layout.addWidget(self.info_markers_stream) stream_box = QVBoxLayout() box = gui.widgetBox(self.controlArea, "Streams settings", orientation=stream_box) box.setAlignment(Qt.AlignCenter) data_stream_box = QHBoxLayout() data_label_box = QVBoxLayout() data_field_box = QVBoxLayout() data_stream_property_label = QLabel("Data stream property: ") data_stream_property_label.setToolTip( "The StreamInfo property that should have a specific value (e.g., 'name', 'type', 'source_id' 'desc/manufaturer'." ) data_label_box.addWidget(data_stream_property_label) self.data_stream_property_field = style.create_field( self.data_stream_property, width=elements_width) data_field_box.addWidget(self.data_stream_property_field) data_stream_value_label = QLabel("Data stream property value: ") data_stream_value_label.setToolTip( "The string value that the property should have (e.g., 'EEG' as the type property)." ) data_label_box.addWidget(data_stream_value_label) self.data_stream_value_field = style.create_field( self.data_stream_value, width=elements_width) data_field_box.addWidget(self.data_stream_value_field) data_stream_box.addLayout(data_label_box) data_stream_box.addLayout(data_field_box) markers_stream_box = QHBoxLayout() markers_label_box = QVBoxLayout() markers_field_box = QVBoxLayout() markers_stream_property_label = QLabel("Markers stream property: ") markers_stream_property_label.setToolTip( "The StreamInfo property that should have a specific value (e.g., 'name', 'type', 'source_id' 'desc/manufaturer'." ) markers_label_box.addWidget(markers_stream_property_label) self.markers_stream_property_field = style.create_field( self.markers_stream_property, width=elements_width) markers_field_box.addWidget(self.markers_stream_property_field) markers_stream_value_label = QLabel("Markers stream property value: ") markers_stream_value_label.setToolTip( "The string value that the property should have (e.g., 'Markers' as the type property)." ) markers_label_box.addWidget(markers_stream_value_label) self.markers_stream_value_field = style.create_field( self.markers_stream_value, width=elements_width) markers_field_box.addWidget(self.markers_stream_value_field) markers_stream_box.addLayout(markers_label_box) markers_stream_box.addLayout(markers_field_box) stream_box.setSpacing(10) stream_box.addLayout(data_stream_box) stream_box.addLayout(markers_stream_box) btn_box = QVBoxLayout() timeout_box = QHBoxLayout() timeout_label = QLabel("Timeout: ") timeout_label.setToolTip( "How long to look for the streams in seconds.") timeout_box.addWidget(timeout_label) btn_box.addLayout(timeout_box) self.timeout_field = style.create_field(str(self.timeout), width=elements_width) timeout_box.addWidget(self.timeout_field) btn_box.setAlignment(Qt.AlignCenter) save_settings_btn = QPushButton("Save stream settings") save_settings_btn.setStyleSheet(style.btn_success) save_settings_btn.clicked.connect(self.save_stream_settings) save_settings_btn.setSizePolicy(Policy.Maximum, Policy.Fixed) save_settings_btn.setMinimumSize(QSize(elements_width, 25)) btn_box.addWidget(save_settings_btn) stream_box.addLayout(btn_box) layout = QGridLayout() gui.widgetBox(self.controlArea, orientation=layout) self.find_stream_btn = QPushButton("Find streams") self.find_stream_btn.setStyleSheet(style.btn_primary) self.find_stream_btn.clicked.connect(self.find_stream) self.find_stream_btn.setSizePolicy(Policy.Maximum, Policy.Fixed) self.find_stream_btn.setMinimumSize(QSize(elements_width, 25)) layout.addWidget(self.find_stream_btn) output = QPushButton("Send data") output.setToolTip( "Sends the accumulated data from the streams on the output.") output.setStyleSheet(style.btn_primary) output.clicked.connect(self.commit) output.setSizePolicy(Policy.Maximum, Policy.Fixed) output.setMinimumSize(QSize(elements_width, 25)) layout.addWidget(output) self.stop_collecting_btn = QPushButton("Stop") self.stop_collecting_btn.setStyleSheet(style.btn_warning) self.stop_collecting_btn.clicked.connect(self.stop_collecting) self.stop_collecting_btn.setSizePolicy(Policy.Maximum, Policy.Fixed) self.stop_collecting_btn.setMinimumSize(QSize(elements_width, 25)) layout.addWidget(self.stop_collecting_btn) self.setMinimumSize(self.layout().sizeHint())
def __init__(self): super().__init__() self.default_ranges = ["-0.5,0.5", ""] self.fields = [ style.create_field(self.default_ranges[i]) for i in range(len(self.default_ranges)) ] self.selected_ranges = self.default_ranges layout = QGridLayout() box = gui.widgetBox(self.controlArea, "Info", orientation=layout) box.setAlignment(Qt.AlignCenter) info = QLabel( "Select the time ranges of time windows to make time window for each epoch and each channel.\n" ) note = QLabel( "Note: empty fields will be ignored. Invalid float ranges will also be ignored." ) layout.addWidget(info) layout.addWidget(note) gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) label = QLabel("Time ranges: ") label.setFont(QFont("Helvetica", pointSize=11)) label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(label) for field in self.fields: self.field_layout.addWidget(field) gui.separator(self.controlArea) button_layout = QHBoxLayout() button_layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=button_layout) add_button = QPushButton("Add") add_button.setToolTip("Add a new text field") add_button.clicked.connect(self.add_field) add_button.setStyleSheet(style.btn_primary) add_button.setMinimumSize(QSize(90, 25)) button_layout.addWidget(add_button) remove_button = QPushButton("Remove") remove_button.setToolTip("Remove the last text field") remove_button.clicked.connect(self.remove_field) remove_button.setStyleSheet(style.btn_warning) remove_button.setMinimumSize(QSize(90, 25)) remove_button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) button_layout.addWidget(remove_button) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_times) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn)
def __init__(self): super().__init__() self.freqs = numpy.array([1, 2, 3, 4]) self.n_cycles = "scale" self.baselineA = None self.baselineB = None self.mode = "logratio" self.channel = 0 self.freqs_field = style.create_field(str("1, 2, 3, 4")) self.n_cycles_field = style.create_field(str(self.n_cycles)) self.baselineA_field = style.create_field(str(self.baselineA)) self.baselineB_field = style.create_field(str(self.baselineB)) self.mode_field = style.create_field(str(self.mode)) self.channel_field = style.create_field(str(self.channel)) box = gui.widgetBox(self.controlArea, "Info") box.setAlignment(Qt.AlignCenter) self.info = gui.widgetLabel(box, 'Plot TF Maps.') gui.separator(self.controlArea) self.field_layout = QGridLayout() gui.widgetBox(self.controlArea, margin=10, orientation=self.field_layout) freqs_label = QLabel("freqs ") freqs_label.setFont(QFont("Helvetica", pointSize=11)) freqs_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(freqs_label) self.field_layout.addWidget(self.freqs_field) n_cycles_label = QLabel("n_cycles") n_cycles_label.setFont(QFont("Helvetica", pointSize=11)) n_cycles_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(n_cycles_label) self.field_layout.addWidget(self.n_cycles_field) baselineA_label = QLabel("baseline a") baselineA_label.setFont(QFont("Helvetica", pointSize=11)) baselineA_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(baselineA_label) self.field_layout.addWidget(self.baselineA_field) baselineB_label = QLabel("baseline b") baselineB_label.setFont(QFont("Helvetica", pointSize=11)) baselineB_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(baselineB_label) self.field_layout.addWidget(self.baselineB_field) mode_label = QLabel("mode") mode_label.setFont(QFont("Helvetica", pointSize=11)) mode_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(mode_label) self.field_layout.addWidget(self.mode_field) channel_label = QLabel("channel") channel_label.setFont(QFont("Helvetica", pointSize=11)) channel_label.setAlignment(Qt.AlignCenter) self.field_layout.addWidget(channel_label) self.field_layout.addWidget(self.channel_field) self.b1 = QCheckBox("Plot TF of channel") self.b1.setChecked(True) self.field_layout.addWidget(self.b1) self.b2 = QCheckBox("Plot topography") self.field_layout.addWidget(self.b2) layout = QHBoxLayout() layout.setAlignment(Qt.AlignCenter) gui.widgetBox(self.controlArea, orientation=layout) save_btn = QPushButton("Save") save_btn.clicked.connect(self.save_values) save_btn.setStyleSheet(style.btn_success) save_btn.setMinimumSize(QSize(90, 25)) save_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) layout.addWidget(save_btn) self.show_plot_btn = QPushButton("Show plot") self.show_plot_btn.setEnabled(False) self.show_plot_btn.setMinimumSize(QSize(120, 25)) self.show_plot_btn.clicked.connect(self.plotTFMaps) layout.addWidget(self.show_plot_btn)