GUI

Graphic interface to launch analyses

Main Window

class cicada.gui.cicada_main_window.CicadaMainWindow(config_handler)[source]

Main window of the GUI

about()[source]

Small about QMessageBox for the project

add_data()[source]

Open a directory

add_group_data(group_name)[source]

Add a group of saved sessions to the current list of session

Parameters:group_name (str) – Name of the group saved in YAML
closeEvent(event)[source]

Close all analyses windows on main window close

createActions()[source]

Create some QAction

createMenus()[source]

Create menu bar and put some menu in it

create_group_menu()[source]

Create group menu

create_sort_menu()[source]

Create sort menu

load_data_from_config()[source]

Check if the last dir opened is saved in config and load it automatically

load_data_from_dir(dir_name, method)[source]

Load data (currently only NWB) from selected directory

Parameters:
  • dir_name (str) – Path to data
  • method (str) – String to choose whether to add data to the existing dataset or open a new one, takes two values : ‘add’ or ‘clear’
load_group(group_name)[source]

Load a group of saved sessions, it will clear the current session list

Parameters:group_name (str) – Name of the group saved in YAML
load_group_from_config()[source]

Load groups from a YAML file in the config folder

on_group(param, state)[source]

Give group list and parameters value to populate QListWidget

Parameters:
  • param (str) – Parameter to group by
  • state (int) – State of the checkbox
on_sort(param, state)[source]

Give sorted list to populate QListWidget :param param: Parameter to sort by :type param: str :param state: State of the checkbox :type state: int

openWindow()[source]

Open all widgets in a CentralWidget and call some menus that needed those widgets

open_new_dataset()[source]

Open a directory

populate_menu()[source]

Populate the menu to load groups

save_last_data_location(dir_name)[source]

Keep path to last data directory selected in a YAML in config

Parameters:dir_name (str) – Path to data to be saved
see_all_groups()[source]

Display a widget with all existing groups

select_group(group_name)[source]

Select all sessions of a group

Parameters:group_name (str) – Name of the group saved in YAML
uncheck_all_sort()[source]

Uncheck all checkboxes in sort menu

uncheck_group(param='')[source]

Uncheck group menu parameter

Parameters:param (str) – Parameter name to uncheck
class cicada.gui.cicada_main_window.MusketeersWidget(config_handler, cicada_main_window=None)[source]

Gather in a layout the 3 main sub-windows composing the gui: displaying the subject sessions, the analysis tree and an overview of the running analysis

Filter/group sessions

Display metadata

Analysises list

class cicada.gui.cicada_analysis_tree_gui.AnalysisTreeApp(parent, config_handler, to_parameters_button=None)[source]
create_tree_model()[source]

Create the tree model Returns: the tree model, an instance of QAnalysisTreeModel

doubleClickedItem(idx)[source]

Method called when the user double click in the tree :param idx: Index of the branch clicked

Returns:

init_ui()[source]

Set some of the elements used to build the tree Returns:

invalidate_all_items()[source]

invalidate all items if the tree Returns:

load_arguments_parameters_section()[source]

Used to load the parameters section with widgets, based on the current selection in the tree. If the selection is not on any valid tree item, nothing will happen Returns: None

set_data(data_to_analyse, data_format)[source]

Give to the tree the data that the analysis classes will be given to analyze. Allows the tree to inactivate the analyses for which the data don’t fulfill the requierements :param data_to_analyse: a list of data in a given format (could be nwb or other) :param data_format: format of the data, must be a string. So far only “nwb” is supported

Returns: None

class cicada.gui.cicada_analysis_tree_gui.QAnalysisTreeModel(tree_item, parent=None)[source]
columnCount(self, parent: QModelIndex = QModelIndex()) → int[source]
data(index, role)[source]
Parameters:
  • index
  • role
Returns:

flags(self, QModelIndex) → Qt.ItemFlags[source]
headerData(self, int, Qt.Orientation, role: int = Qt.DisplayRole) → Any[source]
index(self, int, int, parent: QModelIndex = QModelIndex()) → QModelIndex[source]
parent(self, QModelIndex) → QModelIndex[source]

parent(self) -> QObject

rowCount(self, parent: QModelIndex = QModelIndex()) → int[source]
class cicada.gui.cicada_analysis_tree_gui.QAnalysisTreeView(tree_item, config_handler, parent=None)[source]
drawBranches(self, QPainter, QRect, QModelIndex)[source]
isIndexHidden(q_model_index)[source]

Avoid to select the line that display the family name :param q_model_index: :return:

keyPressEvent(event)[source]
Parameters:event – P -> set background picture

Returns:

cicada.gui.cicada_analysis_tree_gui.fill_tree_item_with_dict(root_tree, instances_dict)[source]

Recursive function that fills the root_tree according to data in instances_dict. :param root_tree: instance of TreeItem :param instances_dict: Contains instance of cicada_analysis, in a hierarchy similar to the one we want the tree to be :return:

Overview of analysises

class cicada.gui.cicada_analysis_overview.AnalysisOverview(config_handler, parent=None)[source]

Class containing the overview linked to an analysis

add_analysis_overview(cicada_analysis, analysis_id, obj)[source]

Add widgets to track the corresponding analysis :param cicada_analysis: CicadaAnalysis instance :type cicada_analysis: CicadaAnalysis :param analysis_id: Randomly generated ID linked to the analysis :type analysis_id: str :param obj: The analysis window’s object itself :type obj: object

keyPressEvent(self, QKeyEvent)[source]
class cicada.gui.cicada_analysis_overview.AnalysisState(analysis_id, cicada_analysis, parent=None, without_bringing_to_front=False)[source]

Class containing the name of the analysis and the subjects analysed

bring_to_front(window_id, event)[source]

Bring corresponding analysis window to the front (re-routed from the double click method)

Parameters:
  • window_id (QWidget) – Analysis Widget object
  • event (QEvent) – Double click event
deleteLater()[source]

Re-implementation of the deleteLater method to properly delete the whole widget

class cicada.gui.cicada_analysis_overview.ResultsButton(cicada_analysis)[source]

Class containing the button to open the result folder

deleteLater()[source]

Re-implementation of the deleteLater method to properly delete the widget

open_explorer()[source]

Open the file explorer depending on the OS

Analysis parameters

class cicada.gui.cicada_analysis_parameters_gui.AnalysisData(cicada_analysis, arguments_section_widget, config_handler, parent=None)[source]
keyPressEvent(event)[source]
Parameters:event – P -> set background picture

Returns:

populate_session_list(session_list)[source]

Add all session to the QListWidget :param session_list: List of all sessions’ identifier :type session_list: list

class cicada.gui.cicada_analysis_parameters_gui.AnalysisPackage(cicada_analysis, analysis_name, name, main_window, config_handler, parent=None)[source]

Widget containing the whole analysis window

bring_to_front(window_id, event)[source]

Bring corresponding window to the front (re-routed from the double click method)

Parameters:
  • window_id (QWidget) – Analysis Widget object
  • event (QEvent) – Double click event
errOutputWritten(text, path)[source]

Append std.err text to the QLabel and create an err file.

Parameters:
  • text (str) – Output of the standard output in python interpreter
  • path (str) – path where we will output the err file
normalOutputWritten(text, path)[source]

Append std.out text to the QLabel and create a log file.

Parameters:
  • text (str) – Output of the standard output in python interpreter
  • path (str) – path where we will output the log file
on_close(event)[source]

Check if an analysis is still on going and prompt the user to let him know then ask whether he still wants to close. If yes, delete the associated overview and stop the thread

Parameters:event (QEvent) – Qt Event triggered when attempting to close the window
class cicada.gui.cicada_analysis_parameters_gui.AnalysisParametersApp(thread_name, progress_bar, analysis_name, config_handler, parent=None)[source]

Class containing the parameters widgets

create_widgets(cicada_analysis)[source]
Parameters:cicada_analysis (CicadaAnalysis) – Chosen analysis
keyPressEvent(event)[source]
Parameters:event – P -> set background picture

Returns:

load_arguments()[source]

Will open a FileDialog to select a yaml file used to load arguments used for a previous analysis

reset_arguments()[source]

Reset all arguments to default value

run_analysis()[source]

Check if the parameters are valid and then create a thread which will run the analysis

save_yaml_with_name()[source]

Save parameters as a YAML file under the name given by the user. The path is retrieved from the config file and if it doesn’t exist a QFileDialog will be displayed to select the path

tabula_rasa()[source]

Erase the widgets and make an empty section

class cicada.gui.cicada_analysis_parameters_gui.CheckBoxWidget(analysis_arg, parent=None)[source]

Used to set a boolean value

get_value()[source]

Return the value of the widget Returns:

set_value(value)[source]

Set the widget value to the value passed Returns:

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

class cicada.gui.cicada_analysis_parameters_gui.ColorDialogWidget(analysis_arg, show_alpha_channel, parent=None)[source]

Widget used to select a color

get_value()[source]

Returns: a tuple of 4 floats representing RGBA with values from 0.0 to 1.0

open_dialog()[source]

Open the color dialog Returns:

set_value(value)[source]
Parameters:value – a list or tuple of 3 or 4 float between 0.0 to 1.0, RGB or RGBA values, the A representing the alpha

Returns:

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

update_button_color()[source]

Returns:

class cicada.gui.cicada_analysis_parameters_gui.ComboBoxWidget(analysis_arg, parent=None)[source]
add_multiple_combo_boxes(session_id, choices_dict, legends, index)[source]

Allows to add multiple combo boxes, each changing the content of the next one for on given session_id :param session_id: :param choices_dict: each key represent a content to put in the list and the value could be either None, either :param another dict which keys will be the content of the next ComboBox etc… or instead of a dict as value it: :param could be a list that will define the content.: :param legends: :param index:

Returns:

get_value()[source]

Returns:

set_value(value)[source]

Set a new value. Either value is None and nothing will happen If value is a list instance, :param value:

Returns:

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

class cicada.gui.cicada_analysis_parameters_gui.EmittingErrStream(parent=None)[source]

Class managing the std.err redirection

write(text)[source]

Override of the write function used to display output :param text: Python output from stdout :type text: str

class cicada.gui.cicada_analysis_parameters_gui.EmittingStream(parent=None)[source]

Class managing the std.out redirection

write(text)[source]

Override of the write function used to display output :param text: Python output from stdout :type text: str

class cicada.gui.cicada_analysis_parameters_gui.FileDialogWidget(analysis_arg, directory_only, extensions=None, parent=None)[source]

Create a widget that will contain a button to open a FileDialog and a label to display the file or directory choosen A label will also explain what this parameter do

get_value()[source]

Return the argument

Returns:Dictionary with the set value
Return type:result_dict (dict)
one_for_all()[source]

Allows to select the same dir of files for all session Returns:

set_value(value)[source]

Set the value :param value: either None, either a string or etiher a dictionary

Returns:

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

class cicada.gui.cicada_analysis_parameters_gui.FinalMeta[source]
class cicada.gui.cicada_analysis_parameters_gui.LineEditWidget(analysis_arg, parent=None)[source]
get_value()[source]

Return the value of the widget Returns:

set_value(value)[source]

Set the widget value to the value passed Returns:

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

class cicada.gui.cicada_analysis_parameters_gui.ListCheckboxWidget(analysis_arg, choices_attr_name, parent=None)[source]

Allows multiple choices

get_value()[source]

Returns:

set_value(value)[source]

Set the value. :param value: value is either a string or integer or float, or a list. If a list, then item whose value matches :param one of the elements in the list will be checkeds:

Returns: None

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

class cicada.gui.cicada_analysis_parameters_gui.MyFileDialogQButton(key_name, file_dialog, file_dialogs_dict, parent=None)[source]

Special button for opening file dialog

open_dialog()[source]

Open the QFileDialog :param key_name:

Returns:

class cicada.gui.cicada_analysis_parameters_gui.MyQComboBox[source]

Special instance of ComboBox allowing to handle change so that it is connected to other combo_boxes

selection_change(index)[source]

Called if the selection is changed either by the user or by the code :param index:

Returns:

class cicada.gui.cicada_analysis_parameters_gui.MyQFrame(analysis_arg=None, parent=None, with_description=True)[source]
change_mandatory_property(value)[source]

Changing the property allowing to change the style sheet depending on the mandatory aspect of the argument :param value:

Returns:

set_property_to_missing()[source]

Allows the change the stylesheet and indicate the user that a Returns:

class cicada.gui.cicada_analysis_parameters_gui.ParameterWidgetModel[source]
get_value()[source]

Return the value of the widget Returns:

set_value(value)[source]

Set the widget value to the value passed Returns:

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

class cicada.gui.cicada_analysis_parameters_gui.ProgressBar(remaining_time_label, parent=None)[source]

Class containing the progress bar of the current analysis

update_progress_bar(time_elapsed, increment_value=0, new_set_value=0)[source]

Update the progress bar in the analysis widget and the corresponding remaining time :param time_elapsed: Time elepased since beginning of analysis, in seconds :type time_elapsed: float :param increment_value: Value that should be added to the current value of the progress bar :type increment_value: float :param new_set_value: Value that should be set as the current value of the progress bar :type new_set_value: float

Returns:

update_progress_bar_overview(name, increment_value=0, new_set_value=0)[source]

Update the overview progress bar

Parameters:
  • name (str) – Analysis ID
  • time_started (float) – Start time of the analysis
  • increment_value (float) – Value that should be added to the current value of the progress bar
  • new_set_value (float) – Value that should be set as the current value of the progress bar
class cicada.gui.cicada_analysis_parameters_gui.RemainingTime(parent=None)[source]

Class containing the remaining time of the analysis

static correct_time_converter(time_to_convert)[source]

Convert a float in a correct duration value :param time_to_convert: Float value representing seconds to be converted in a correct duration with MM.SS :type time_to_convert: float

Returns:String of the correct duration
Return type:time_text (str)
update_remaining_time(progress_value, time_elapsed, done=False)[source]

Update the remaining time :param progress_value: Current progress bar value :type progress_value: float :param time_elapsed: Time elepased since the beginning of the analysis (in sec) :type time_elapsed: float :param done: True if the analysis is done and false if still running :type done: bool

class cicada.gui.cicada_analysis_parameters_gui.SameFamilyWidgetsContainer(widgets, parent=None)[source]

A QFrame used to group widgets that belongs to a same group. Just useful for visual purposes

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

class cicada.gui.cicada_analysis_parameters_gui.SliderWidget(analysis_arg, parent=None)[source]

Used to set a numerical value

get_value()[source]

Return the value of the widget Returns:

set_value(value)[source]

Set the widget value to the value passed Returns:

to_stretch()[source]

Indicate if the widget should take all the space of a horizontal layout how might share the space with another widget Returns: Boolean

class cicada.gui.cicada_analysis_parameters_gui.Worker(name, cicada_analysis, analysis_arguments_handler, parent)[source]

Thread to manage multiple analysises at the same time

run()[source]

Run the analysis

setProgress(name, time_elapsed=0, increment_value=0, new_set_value=0)[source]

Emit the new value of the progress bar and time remaining

Parameters:
  • name (str) – Analysis ID
  • time_elapsed (float) – Start elpased (in sec)
  • increment_value (float) – Value that should be added to the current value of the progress bar
  • new_set_value (float) – Value that should be set as the current value of the progress bar
set_results_path(results_path)[source]

Set the selected path to the results in the “Open result folder” button in the corresponding overview

Parameters:results_path (str) – Path to the results
cicada.gui.cicada_analysis_parameters_gui.except_hook(cls, exception, traceback)[source]

Redirect exception to std.err so we can display stack trace on exceptions