Util

@author: L. Calvo-Bartolome

src.graphical_user_interface.util.change_background_color_text_edit(text_edit, prediction)

Method to that changes the border color of the QTextEdit associated with the documents to be annotated, based on the predicted class selected by the user.

Parameters
  • text_edit (QTextEdit) – QTextEdit (document) whose border color is going to be updated based on the

  • prediction (int (0 or 1)) – Predicted class specified by the user. If prediction == 1, the document’s associated QTextEdit’s border color is set to #6A7288; if prediction == 0, it is set to #DB8678.

src.graphical_user_interface.util.execute_in_thread(gui, function, function_output, progress_bar)

Method to execute a function in the secondary thread while showing a progress bar at the time the function is being executed if a progress bar object is provided. When finished, it forces the execution of the method to be executed after the function executing in a thread is completed. Based on the functions provided in the manual available at: https://www.pythonguis.com/tutorials/multithreading-pyqt-applications-qthreadpool/

Parameters
  • function (UDF) – Function to be executed in thread

  • function_output (UDF) – Function to be executed at the end of the thread

  • progress_bar (QProgressBar) – If a QProgressBar object is provided, it shows a progress bar in the main thread while the main task is being carried out in a secondary thread

src.graphical_user_interface.util.signal_accept(progress_bar)

Makes the progress bar passed as an argument visible and configures it for an event whose duration is unknown by setting both its minimum and maximum both to 0, thus the bar shows a busy indicator instead of a percentage of steps.

Parameters

progress_bar (QProgressBar) – Progress bar object in which the progress is going to be displayed.

src.graphical_user_interface.util.toggle_menu(gui, max_width)

Method to control the movement of the Toggle menu located on the left. When collapsed, only the icon for each of the options is shown; when expanded, both icons and name indicating the description of the functionality are shown. Based on the code available at: https://github.com/Wanderson-Magalhaes/Toggle_Burguer_Menu_Python_PySide2/blob/master/ui_functions.py

Parameters
  • gui (MainWindow) – MainWindow object to which the toggle menu will be appended.

  • maxWidth (int) – Maximum width to which the toggle menu is going to be expanded.