Source code for src.menubar.menubar_controller
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Main controller
"""
import sys
from menubar.menubar_listener import menubarListener
from menubar.menubar_view import menubarView
__author__ = "Lemahieu Antoine"
__copyright__ = "Copyright 2022"
__credits__ = ["Lemahieu Antoine"]
__license__ = "GNU General Public License v3.0"
__maintainer__ = "Lemahieu Antoine"
__email__ = "Antoine.Lemahieu@ulb.be"
__status__ = "Dev"
[docs]class menubarController(menubarListener):
def __init__(self):
"""
Controller for the menubar on top of the main window.
Does the link between the main menus of the main window and the main controller.
"""
self.main_listener = None
self.menubar_view = menubarView()
self.menubar_view.set_listener(self)
[docs] def enable_menu(self):
"""
Make the menus accessible when a dataset is loaded.
"""
self.menubar_view.enable_menu()
[docs] def disable_menu(self):
"""
Make the menus disabled when no dataset is loaded.
"""
self.menubar_view.disable_menu()
[docs] def add_dataset(self, dataset_index, dataset_name, study_available):
"""
Add a dataset in the dataset menu.
:param dataset_index: The index of new dataset.
:type dataset_index: int
:param dataset_name: The name of the new dataset.
:type dataset_name: str
:param study_available: Enable the menu for selecting the study_creation if it is available.
:type study_available: bool
"""
self.menubar_view.add_dataset(dataset_index, dataset_name, study_available)
[docs] def remove_dataset(self, dataset_index, study_available):
"""
Remove a dataset from the dataset menu.
:param dataset_index: The index of dataset to remove
:type dataset_index: int
:param study_available: Enable the menu for selecting the study_creation if it is available.
:type study_available: bool
"""
self.menubar_view.remove_dataset(dataset_index, study_available)
[docs] def study_selection_activation(self):
"""
Activate the menu for study_creation selection because a study_creation has been created.
"""
self.menubar_view.study_selected_menu_activation()
[docs] def study_selection_deactivation(self, study_exist):
"""
Deactivate the menu for study_creation selection because a study_creation has been cleared.
:param study_exist: True if the study exists, false otherwise
:type study_exist: bool
"""
self.menubar_view.dataset_selected_menu_activation(study_exist)
"""
Menu buttons clicked
"""
# File menu
[docs] def open_fif_file_clicked(self, path_to_file):
self.main_listener.open_fif_file_clicked(path_to_file)
[docs] def open_cnt_file_clicked(self, path_to_file):
self.main_listener.open_cnt_file_clicked(path_to_file)
[docs] def open_set_file_clicked(self, path_to_file):
self.main_listener.open_set_file_clicked(path_to_file)
[docs] def read_events_file_clicked(self, path_to_file):
self.main_listener.read_events_file_clicked(path_to_file)
[docs] def find_events_from_channel_clicked(self):
self.main_listener.find_events_from_channel_clicked()
[docs] def export_data_to_csv_file_clicked(self, path_to_file):
self.main_listener.export_data_to_csv_file_clicked(path_to_file)
[docs] def export_data_to_set_file_clicked(self, path_to_file):
self.main_listener.export_data_to_set_file_clicked(path_to_file)
# Edit menu
# Tools menu
# Plot menu
[docs] def plot_channel_locations_clicked(self):
self.main_listener.plot_channel_locations_clicked()
# Connectivity menu
[docs] def source_space_connectivity_clicked(self):
self.main_listener.source_space_connectivity_clicked()
[docs] def sensor_space_connectivity_clicked(self):
self.main_listener.sensor_space_connectivity_clicked()
[docs] def spectro_temporal_connectivity_clicked(self):
self.main_listener.spectro_temporal_connectivity_clicked()
# Classification menu
# Statistics menu
[docs] def statistics_connectivity_clicked(self):
self.main_listener.statistics_connectivity_clicked()
# Study menu
# Dataset menu
# Help menu
"""
Setters
"""
"""
Getters
"""