General Interface¶
Episcope general interface containing
- video player :
video playback
play/pause, skip>>, skip<<, review buttons
advance and rewind by 1s and pause
synchronised sound
good speed
progression bar sychronised
- annotations :
menus based on exel file (xls)
pre-load symptoms
cascading menus on left
search bar
correct initialization of symptoms
retrieve symptoms from a list
retrieve start and end times
display symptoms on the right
scrollable symptoms
pop-up to modify symptoms
- files :
generate frieze
generate a report
generate a symptom file
modification of the general design and buttons of the drop-down menus and the video progress management buttons everything is in english configuration of the progress bar(state of the cursor:pressed, not pressed) version : 0.10.1
- class general_interface.FriseSymptomes(InterfaceGenerale, MenuDeroulant)¶
Bases:
objectClass used to generate a timeline summarising all the symptoms present during an epileptic seizure.
- interfaceGenerale¶
the general interface with the symptoms list
- Type:
- MenuDeroulant¶
dropdown menus
- Type:
- afficher()¶
Retrieves the list of symptoms instantiated in the InterfaceGenerale class’s update_right_panel function.
This method retrieves the list of symptoms stored in the InterfaceGenerale class instance’s ListeSymptomes attribute. It then processes each symptom in the list, extracting relevant information such as name, start time, end time, ID, lateralization, topography, orientation, additional attributes, and comments. This information is then formatted and sorted based on the start time of each symptom.
- Returns:
None
- class general_interface.InterfaceGenerale(fenetre)¶
Bases:
objectGeneral interface class, which provides the overall look and feel of the graphical interface.
It is represented in the form of a window and allows the other classes to be integrated into it. It calls the LecteurVideo, FriseSymptomes and Menu_symptoms classes.
- fenetre¶
Represents the main window of the graphical interface.
- cap¶
Represents the video capture object.
- lec_video¶
An instance of the LecteurVideo class.
- frise¶
An instance of the FriseSymptomes class.
- set_end_time_mode¶
A boolean variable indicating whether the end time mode is set.
- current_symptom¶
Represents the current symptom being processed.
- ListeSymptomes¶
A list containing symptom objects, initially empty.
- theme¶
A list containing color theme values.
A menu bar for the interface.
A menu for opening different options like video and symptoms.
A menu for saving options like symptoms, report, and timeline.
- clic_x¶
The x-coordinate of the click event.
- clic_y¶
The y-coordinate of the click event.
- frame_left¶
Represents the left frame of the interface.
- frame_middle¶
Represents the middle frame of the interface.
- frame_right¶
Represents the right frame of the interface.
- scrollable1¶
A scrollable frame for the right panel.
- text_output¶
A scrollable frame for displaying text output.
- frame_CTkButton¶
A frame for buttons in the middle frame.
- bouton_revoir¶
Button for rewinding the video.
- bouton_reculer¶
Button for moving the video backward.
- bouton_play_pause¶
Button for playing or pausing the video.
- bouton_avancer¶
Button for moving the video forward.
- bouton_nul¶
A dummy button.
- frame_frise¶
A frame for displaying the symptom timeline.
- bouton_frise¶
Button for displaying the timeline.
- bouton_save¶
Button for saving the report.
- label_temps¶
Label for displaying elapsed time and total time.
- progress_slider¶
A slider for manual video progress.
- canvas¶
Canvas for displaying the video.
- zone_text¶
A text area for comments.
- get_current_video_time()¶
Get the current time of the video.
- Returns:
- A string representing the current time of the video in the format “HH:MM:SS”.
Returns “00:00:00” if the video is not opened.
- Return type:
str
- get_video_duration()¶
Get the total duration of the video.
- Returns:
- The total duration of the video in seconds.
Returns 0 if the video is not opened.
- Return type:
int
- lire_fichier(nom_fichier)¶
Opens a text file, reads it, and saves the information in a list.
- Parameters:
nom_fichier (str) – The path to the text file to be read.
- Returns:
A list containing all the lines read from the file.
- Return type:
list
- Raises:
FileNotFoundError – If the specified file is not found.
- load_symptoms()¶
Loads a list of symptoms from a text file.
This function prompts the user to select a text file containing symptom data. It then reads the symptom data from the file using the read_symptoms function from the load_symptomes module. For each symptom read from the file, it updates the right panel of the interface with the symptom attributes.
- Raises:
FileNotFoundError – If the selected file is not found.
Exception – If an unexpected error occurs during the file reading process.
- ouvrir_video()¶
Opens the video by calling the Lecteur_video class
- ouvrir_video_noire()¶
Opens the black_video by calling the Lecteur_video class
- rapport()¶
Writes the report of the seizure
- sauvegarde()¶
Saves the list of symptoms to a text file. It calls the save class for this purpose.
- supprimer(selection, container)¶
Remove a symptom from the list of symptoms and destroy its display container.
- Parameters:
selection – The symptom object to be removed.
container – The container containing the display elements of the symptom.
- Returns:
None
- text_sympt(sympt)¶
Creates the text to display in the right panel.
- Parameters:
sympt (Symptome) – The symptom for which to create the text.
- Returns:
The text to display containing the relevant information.
- Return type:
str
- update_right_panel(attributs=[], is_start_time=False)¶
manage the display of symptom start/end times on the right-hand side and pop-up management to modify a symptom.
- Parameters:
attributs (list) – symptom initialisation list | default = []
- class general_interface.LecteurVideo(InterfaceGenerale)¶
Bases:
objectVideo player class that manages the different functionalities of the video.
- Functionalities supported :
opening a video using the file explorer
opening a dark video - in case there is no video to actually open
sychronizing sound and video
buttons gestion
This class calls the InterfaceGenerale class
- interface_generale¶
The main interface in which to open the video player.
- Type:
- video_paused¶
Indicates whether the video is currently paused.
- Type:
bool
- current_frame_time¶
Current time of the video frame being displayed.
- Type:
int
- clock¶
Pygame clock to manage time-related operations.
- Type:
Clock
- vitesse_lecture¶
Speed factor for video playback.
- Type:
int
- valeur¶
A value indicating something, not clearly specified in the docstring.
- Type:
int
- temps_ecoule¶
Elapsed time of the video playback.
- Type:
int
- duree_totale¶
Total duration of the loaded video.
- Type:
int
Retrieve the coordinates by clicking on the video.
It currently displays a red cross. But you can use this red cross to display the symtoms by hovering over it with the cursor.
- afficher_video()¶
Allows to display and play the video.
Resizes the frames of the video to match thoses of the middle frame computes and displays the total and elapsed time of the video
- afficher_video_frame()¶
Displays the current video frame without continuing the playback.
This method reads the current frame from the video, displays it on the canvas, and stops the video from advancing. It also handles converting the frame to RGB color space, resizing it to fit the canvas dimensions, and updating the canvas image.
- Parameters:
None –
- Returns:
None
- Raises:
None –
- ajouter_plus_rouge(canvas, x, y, taille)¶
Displays the red cross for 1 second where one clicks on the video
- Parameters:
canvas (tk.Canvas) – the canvas of the video
x (int) – x-coordinate of the cross
y (int) – y-coordinate of the cross
taille (int) – size of the cross
- avance_progress()¶
Advances the video by a short duration and handles video and audio pausing correctly.
This method advances the video by 0.25 seconds (by default) and ensures that both video and audio are paused if the video was originally playing.
- Parameters:
None –
- Returns:
None
- Raises:
None –
- avancer()¶
Updates the position of the progress slider in the user interface.
This method sets the position of the progress slider to the elapsed time and schedules itself to run again after a delay of 1 millisecond.
- Parameters:
None –
- Returns:
None
- Raises:
None –
- charger_son_video(file_path)¶
Stops the previous audio, extracts and loads the new audio track from the selected video.
This method stops the previous audio playback, extracts the audio track from the selected video file, saves it as a temporary WAV file, and loads it into the pygame mixer for playback. It also cleans up the resources used during the process.
- Parameters:
file_path (str) – The path to the video file from which to extract the audio.
- Returns:
None
- Raises:
None –
- configurer_barre_progression()¶
Configures the progress bar’s range and binds events for slider interactions.
This method sets the total duration of the video as the range for the progress slider. It also binds events for when the slider is pressed and released to handle dragging.
- Parameters:
None –
- Returns:
None
- Raises:
None –
- format_duree(seconds)¶
Converts the time in seconds to a more readable format: minutes and seconds.
This method takes a duration in seconds and converts it to a string representation in the format “HH:MM:SS”.
- Parameters:
seconds (int or float) – The time duration in seconds.
- Returns:
The formatted time string in “HH:MM:SS” format.
- Return type:
str
- Raises:
None –
Example
>>> player = LecteurVideo() >>> formatted_time = player.format_duree(3665) "01:01:05"
- manual_update_progress(value)¶
Manually updates the video position without starting the audio.
This method updates the elapsed time based on the given value, calculates the frame number corresponding to the elapsed time, sets the video to that frame, and resumes audio playback from the updated position if the video was playing.
- Parameters:
value (float) – The new position value for the video in seconds.
- Returns:
None
- Raises:
None –
- mettre_a_jour_frame_video(frame)¶
Checks if each frame of the video is correctly processed, resized and displayed in the GUI
- mettre_a_jour_temps_video()¶
Ensures that the displayed time of the video is regularly updated and that the video plays smoothly. It also ensures the sinchronization between the video advancement and the real time
- on_drag_end(event)¶
Method called when the progress bar slider is released after dragging.
This method is triggered when the user releases the progress bar slider after dragging. It updates the video position based on the slider’s position and resumes video playback.
- Parameters:
event (Event) – The event object containing information about the event.
- Returns:
None
- Raises:
None –
- on_drag_start(event)¶
Method called when the progress bar slider is clicked and dragged.
This method is triggered when the user starts dragging the progress bar slider. It pauses the video playback.
- Parameters:
event (Event) – The event object containing information about the event.
- Returns:
None
- Raises:
None –
- ouvrir_video()¶
Opens a video with the file explorer. Once chosen, it plays the video in the middle_frame
- ouvrir_video_noire()¶
Opens the black video. The black video must be in the same folder as the code : “video_noire.mp4”
- pause_lecture()¶
Manage the play/pause state of the video
- preparer_mixer(file_path)¶
Initializes pygame mixer with audio properties extracted from a video file using moviepy.
- Parameters:
file_path (str) – The path to the video file.
- Returns:
None
- Raises:
None –
- preparer_son_video(file_path)¶
Prepares the mixer for each video and plays its audio.
- Parameters:
file_path (str) – The path to the video file.
- Returns:
None
- Raises:
None –
- recule_progress()¶
Rewinds the video by a short duration and handles video and audio pausing correctly.
This method rewinds the video by 0.25 seconds (by default) and ensures that both video and audio are paused if the video was originally playing.
- Parameters:
None –
- Returns:
None
- Raises:
None –
- resume_lecture()¶
Resumes video and audio playback.
This method resumes the paused video and audio playback, updates the play/pause button text, unpause the audio mixer, displays the video, and updates the video time.
- Parameters:
None –
- Returns:
None
- Raises:
None –
- revoir_video()¶
Resets the video and audio to the beginning and resumes video playback.
This method sets the video frame position and audio playback to the beginning, resumes video playback if it was paused, and updates the play/pause button text.
- Parameters:
None –
- Returns:
None
- Raises:
None –
- class general_interface.Menu_symptomes(master, interface_generale, couleur, bordure, largeur)¶
Bases:
CTkFrameClass used to instantiate drop-down menus displaying symptoms in a frame on the left of the interface.
Creates a drop-down menu containing the various symptoms classified according to whether they are objective or subjective.
- Parameters:
largeur (int) – width of the frame of the menus
- on_select(selection)¶
Symptoms selector
Sets the right attributes depending on the menu selection to update the symptom list Recovers data linked to the video to obtain the current time the selection is expected to be on the form designation > description > sub descrition> topography > lateralization
- Parameters:
selection (path) – selected symptom
- on_select_bar(selection)¶