gui/gui_mainLayout.py
def check_values(self):
        """
        This function checks if there is no problem about values given.
        If there is a problem with a or some values, their label's color is changed to red,
        and call a function to display an error message.
        If there is no problem, their label, if it is necessary, is changed to grey (default color).
        """

        error_color = 'color: red'
        no_error_color = 'color: 0.75'  # light gray
        self.error_batch_name = False
        self.error_report_parameter = False
        self.error_saa_result = False
        self.error_sza_result = False
        self.error_p_result = False
        self.error_wavelength_result = False
        self.error_x_result = False
        self.error_y_result = False
        self.error_g_result = False
        self.error_s_result = False
        self.error_z_result = False
        self.error_verbose_result = False
        self.error_phytoplankton_path_result = False
        self.error_bottom_path_result = False
        self.error_executive_path_result = False

        """
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        No particular checking for paths!
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        """

        if self.ui.tabWidget.currentIndex() == TabWidget.NORMAL_MODE:

            check_num = '(.*)'  # Regular expression to use
            self.prog = re.compile(check_num)  # Analysis object creation
            batch_name_result = self.prog.search(
                self.batch_name_value)  # String retrieval thanks to the regular expression
            report_parameter_result = self.prog.search(self.report_parameter_value)
            try:
                if (self.ui.batch_name_value.text().isEmpty()) | (
                            batch_name_result.group() != self.ui.batch_name_value.text()):
                    self.ui.batch_name_label.setStyleSheet(error_color)
                    self.error_batch_name = True
                else:
                    self.ui.batch_name_label.setStyleSheet(no_error_color)
                    self.error_batch_name = False
            except AttributeError:
                self.ui.batch_name_label.setStyleSheet(error_color)
                self.error_batch_name = True
            try:
                if (self.ui.report_parameter_value.text().isEmpty()) | (
                            report_parameter_result.group() != self.ui.report_parameter_value.text()):
                    self.ui.report_parameter_label.setStyleSheet(error_color)
                    self.error_report_parameter = True
                else:
                    self.ui.report_parameter_label.setStyleSheet(no_error_color)
                    self.error_report_parameter = False
            except AttributeError:
                self.ui.report_parameter_label.setStyleSheet(error_color)
                self.error_report_parameter = True

            # -----------------------------------------------------------#
            # The following checks values separate by comas without space.
            # -----------------------------------------------------------#

            """
            Problem : The user can write just one letter or starts with a dot or finishes the list with a dot.
            """

            # check_num_1 = '(^([0-9]+[.]?[0-9]*[,]?){0,}[^,])|(^([0-9]*[,]){1,}[^,])'  # Regular expression to use
            # self.prog_1 = re.compile(check_num_1)  # Analysis object creation
            # self.wavelength_values = str(self.wavelength_values).translate(None, ' ').strip(' ')
            # # print(self.wavelength_values)
            # p_result = self.prog_1.search(self.p_values)  # String retrieval thanks to the regular expression
            # saa_result = self.prog_1.search(self.saa_values)
            # sza_result = self.prog_1.search(self.sza_values)
            # wavelength_result = self.prog_1.search(self.wavelength_values)
            # # print(wavelength_result.group())
            #
            # try:
            #
            #     if saa_result.group() != self.ui.saa_values.text():
            #         self.ui.saa_label.setStyleSheet(error_color)
            #         self.error_sza_result = True
            #     else:
            #         self.ui.saa_label.setStyleSheet(no_error_color)
            #         self.error_sza_result = False
            # except AttributeError:
            #     self.ui.saa_label.setStyleSheet(error_color)
            #     self.error_sza_result = True
            # try:
            #     if sza_result.group() != self.ui.sza_values.text():
            #         self.ui.sza_label.setStyleSheet(error_color)
            #         self.error_saa_result = True
            #     else:
            #         self.ui.sza_label.setStyleSheet(no_error_color)
            #         self.error_saa_result = False
            # except AttributeError:
            #     self.ui.sza_label.setStyleSheet(error_color)
            #     self.error_saa_result = True
            # try:
            #     if p_result.group() != self.ui.p_values.text():
            #         self.ui.p_label.setStyleSheet(error_color)
            #         self.error_p_result = True
            #     else:
            #         self.ui.p_label.setStyleSheet(no_error_color)
            #         self.error_p_result = False
            # except AttributeError:
            #     self.ui.p_label.setStyleSheet(error_color)
            #     self.error_p_result = True
            # try:
            #     if wavelength_result.group() != str(self.ui.wavelength_values.text()).translate(None, ' ').strip(' '):
            #         self.ui.waveL_label.setStyleSheet(error_color)
            #         self.error_wavelength_result = True
            #     else:
            #         self.ui.waveL_label.setStyleSheet(no_error_color)
            #         self.error_wavelength_result = False
            # except AttributeError:
            #     self.ui.waveL_label.setStyleSheet(error_color)
            #     self.error_wavelength_result = True

            # ---------------------------------------------------#
            # The following checks values containing only numbers.
            # ---------------------------------------------------#
            check_num_2 = '(^([0-9]+[.]?[0-9]*[,]?){0,}[^,])|(^([0-9]+[,]){1,}[^,])'
            self.prog_2 = re.compile(check_num_2)
            x_result = self.prog_2.search(self.x_value)
            y_result = self.prog_2.search(self.y_value)
            g_result = self.prog_2.search(self.g_value)
            s_result = self.prog_2.search(self.s_value)
            z_result = self.prog_2.search(self.z_value)

            try:
                if x_result.group() != self.ui.x_value.text():
                    self.ui.particles_label.setStyleSheet(error_color)
                    self.ui.x_label.setStyleSheet(error_color)
                    self.error_x_result = True
                else:
                    self.ui.particles_label.setStyleSheet(no_error_color)
                    self.ui.x_label.setStyleSheet(no_error_color)
                    self.error_x_result = False
            except AttributeError:
                self.ui.particles_label.setStyleSheet(no_error_color)
                self.ui.x_label.setStyleSheet(error_color)
                self.error_x_result = True
            try:
                if y_result.group() != self.ui.y_value.text():
                    self.ui.particles_label.setStyleSheet(error_color)
                    self.ui.y_label.setStyleSheet(error_color)
                    self.error_y_result = True
                else:
                    self.ui.particles_label.setStyleSheet(no_error_color)
                    self.ui.y_label.setStyleSheet(no_error_color)
                    self.error_y_result = False
            except AttributeError:
                self.ui.particles_label.setStyleSheet(error_color)
                self.ui.y_label.setStyleSheet(error_color)
                self.error_y_result = True
            try:
                if g_result.group() != self.ui.g_value.text():
                    self.ui.organic_label.setStyleSheet(error_color)
                    self.ui.g_label.setStyleSheet(error_color)
                    self.error_g_result = True
                else:
                    self.ui.organic_label.setStyleSheet(no_error_color)
                    self.ui.g_label.setStyleSheet(no_error_color)
                    self.error_g_result = False
            except AttributeError:
                self.ui.organic_label.setStyleSheet(error_color)
                self.ui.g_label.setStyleSheet(error_color)
                self.error_g_result = True
            try:
                if s_result.group() != self.ui.s_value.text():
                    self.ui.organic_label.setStyleSheet(error_color)
                    self.ui.s_label.setStyleSheet(error_color)
                    self.error_s_result = True
                else:
                    self.ui.organic_label.setStyleSheet(no_error_color)
                    self.ui.s_label.setStyleSheet(no_error_color)
                    self.error_x_result = False
            except AttributeError:
                self.ui.organic_label.setStyleSheet(error_color)
                self.ui.s_label.setStyleSheet(error_color)
                self.error_x_result = True
            try:
                if z_result.group() != self.ui.z_value.text():
                    self.ui.z_label.setStyleSheet(error_color)
                    self.error_z_result = True
                else:
                    self.ui.z_label.setStyleSheet(no_error_color)
                    self.error_z_result = False
            except AttributeError:
                self.ui.z_label.setStyleSheet(error_color)
                self.error_z_result = True

            check_num_3 = '[1-6]+'
            self.prog_3 = re.compile(check_num_3)
            verbose_result = self.prog_3.search(self.verbose_value)

            try:
                if verbose_result.group() != self.ui.verbose_value.text():
                    self.ui.verbose_label.setStyleSheet(error_color)
                    self.error_verbose_result = True
                else:
                    self.ui.verbose_label.setStyleSheet(no_error_color)
                    self.error_verbose_result = False
            except AttributeError:
                self.ui.verbose_label.setStyleSheet(error_color)
                self.error_verbose_result = True

            # ------------------------------------------------#
            # The following checks values containing only path.
            # ------------------------------------------------#

            """
            #!!!!!!!!!!!!!!!!!!!!!!!!!!
            #Syntax test doesn't work ! ->  #check_num4 = '[/]([A-Za-z]+[/]?)+[A-Za-z]$'
            #!!!!!!!!!!!!!!!!!!!!!!!!!!
            """

            check_num_4 = '(.*)'  # Take all strings possible.
            self.prog_4 = re.compile(check_num_4)
            phytoplankton_path_result = self.prog_4.search(self.phytoplankton_path)
            bottom_path_result = self.prog_4.search(self.bottom_path)
            executive_path_result = self.prog_4.search(self.executive_path)

            try:
                if phytoplankton_path_result.group() != self.ui.phyto_path.text():
                    self.ui.phyto_label.setStyleSheet(error_color)
                    self.error_phytoplankton_path_result = True
                else:
                    self.ui.phyto_label.setStyleSheet(no_error_color)
                    self.error_phytoplankton_path_result = False
            except AttributeError:
                self.ui.phyto_label.setStyleSheet(error_color)
                self.error_phytoplankton_path_result = True
            try:
                if bottom_path_result.group() != self.ui.bottom_path.text():
                    self.ui.bottom_label.setStyleSheet(error_color)
                    self.error_bottom_path_result = True
                else:
                    self.ui.bottom_label.setStyleSheet(no_error_color)
                    self.error_bottom_path_result = False
            except AttributeError:
                self.ui.bottom_label.setStyleSheet(error_color)
                self.error_bottom_path_result = True
            try:
                if executive_path_result.group() != self.ui.exec_path.text():
                    self.ui.execPath_label.setStyleSheet(error_color)
                    self.error_executive_path_result = True
                else:
                    self.ui.execPath_label.setStyleSheet(no_error_color)
                    self.error_executive_path_result = False
            except AttributeError:
                self.ui.execPath_label.setStyleSheet(error_color)
                self.error_executive_path_result = True

        if (self.error_batch_name == True) | (self.error_report_parameter == True) | (
                    self.error_saa_result == True) | (self.error_sza_result == True) | (
                    self.error_p_result == True) | (self.error_wavelength_result == True) | (
                    self.error_x_result == True) | (self.error_y_result == True) | (
                    self.error_g_result == True) | (self.error_s_result == True) | (
                    self.error_z_result == True) | (self.error_verbose_result == True) | (
                    self.error_phytoplankton_path_result == True) | (self.error_bottom_path_result == True) | (
                    self.error_executive_path_result == True):
            self.without_error = False
        else:
            self.without_error = True
def check_values(self):
        """
        This function checks if there is no problem about values given.
        If there is a problem with a or some values, their label's color is changed to red,
        and call a function to display an error message.
        If there is no problem, their label, if it is necessary, is changed to grey (default color).
        """

        error_color = 'color: red'
        no_error_color = 'color: 0.75'  # light gray
        self.error_batch_name = False
        self.error_report_parameter = False
        self.error_saa_result = False
        self.error_sza_result = False
        self.error_p_result = False
        self.error_wavelength_result = False
        self.error_x_result = False
        self.error_y_result = False
        self.error_g_result = False
        self.error_s_result = False
        self.error_z_result = False
        self.error_verbose_result = False
        self.error_phytoplankton_path_result = False
        self.error_bottom_path_result = False
        self.error_executive_path_result = False

        """
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        No particular checking for paths!
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        """

        if self.ui.tabWidget.currentIndex() == TabWidget.NORMAL_MODE:

            check_num = '(.*)'  # Regular expression to use
            self.prog = re.compile(check_num)  # Analysis object creation
            batch_name_result = self.prog.search(
                self.batch_name_value)  # String retrieval thanks to the regular expression
            report_parameter_result = self.prog.search(self.report_parameter_value)
            try:
                if (self.ui.batch_name_value.text().isEmpty()) | (
                            batch_name_result.group() != self.ui.batch_name_value.text()):
                    self.ui.batch_name_label.setStyleSheet(error_color)
                    self.error_batch_name = True
                else:
                    self.ui.batch_name_label.setStyleSheet(no_error_color)
                    self.error_batch_name = False
            except AttributeError:
                self.ui.batch_name_label.setStyleSheet(error_color)
                self.error_batch_name = True
            try:
                if (self.ui.report_parameter_value.text().isEmpty()) | (
                            report_parameter_result.group() != self.ui.report_parameter_value.text()):
                    self.ui.report_parameter_label.setStyleSheet(error_color)
                    self.error_report_parameter = True
                else:
                    self.ui.report_parameter_label.setStyleSheet(no_error_color)
                    self.error_report_parameter = False
            except AttributeError:
                self.ui.report_parameter_label.setStyleSheet(error_color)
                self.error_report_parameter = True

            # -----------------------------------------------------------#
            # The following checks values separate by comas without space.
            # -----------------------------------------------------------#

            """
            Problem : The user can write just one letter or starts with a dot or finishes the list with a dot.
            """

            # check_num_1 = '(^([0-9]+[.]?[0-9]*[,]?){0,}[^,])|(^([0-9]*[,]){1,}[^,])'  # Regular expression to use
            # self.prog_1 = re.compile(check_num_1)  # Analysis object creation
            # self.wavelength_values = str(self.wavelength_values).translate(None, ' ').strip(' ')
            # # print(self.wavelength_values)
            # p_result = self.prog_1.search(self.p_values)  # String retrieval thanks to the regular expression
            # saa_result = self.prog_1.search(self.saa_values)
            # sza_result = self.prog_1.search(self.sza_values)
            # wavelength_result = self.prog_1.search(self.wavelength_values)
            # # print(wavelength_result.group())
            #
            # try:
            #
            #     if saa_result.group() != self.ui.saa_values.text():
            #         self.ui.saa_label.setStyleSheet(error_color)
            #         self.error_sza_result = True
            #     else:
            #         self.ui.saa_label.setStyleSheet(no_error_color)
            #         self.error_sza_result = False
            # except AttributeError:
            #     self.ui.saa_label.setStyleSheet(error_color)
            #     self.error_sza_result = True
            # try:
            #     if sza_result.group() != self.ui.sza_values.text():
            #         self.ui.sza_label.setStyleSheet(error_color)
            #         self.error_saa_result = True
            #     else:
            #         self.ui.sza_label.setStyleSheet(no_error_color)
            #         self.error_saa_result = False
            # except AttributeError:
            #     self.ui.sza_label.setStyleSheet(error_color)
            #     self.error_saa_result = True
            # try:
            #     if p_result.group() != self.ui.p_values.text():
            #         self.ui.p_label.setStyleSheet(error_color)
            #         self.error_p_result = True
            #     else:
            #         self.ui.p_label.setStyleSheet(no_error_color)
            #         self.error_p_result = False
            # except AttributeError:
            #     self.ui.p_label.setStyleSheet(error_color)
            #     self.error_p_result = True
            # try:
            #     if wavelength_result.group() != str(self.ui.wavelength_values.text()).translate(None, ' ').strip(' '):
            #         self.ui.waveL_label.setStyleSheet(error_color)
            #         self.error_wavelength_result = True
            #     else:
            #         self.ui.waveL_label.setStyleSheet(no_error_color)
            #         self.error_wavelength_result = False
            # except AttributeError:
            #     self.ui.waveL_label.setStyleSheet(error_color)
            #     self.error_wavelength_result = True

            # ---------------------------------------------------#
            # The following checks values containing only numbers.
            # ---------------------------------------------------#
            check_num_2 = '(^([0-9]+[.]?[0-9]*[,]?){0,}[^,])|(^([0-9]+[,]){1,}[^,])'
            self.prog_2 = re.compile(check_num_2)
            x_result = self.prog_2.search(self.x_value)
            y_result = self.prog_2.search(self.y_value)
            g_result = self.prog_2.search(self.g_value)
            s_result = self.prog_2.search(self.s_value)
            z_result = self.prog_2.search(self.z_value)

            try:
                if x_result.group() != self.ui.x_value.text():
                    self.ui.particles_label.setStyleSheet(error_color)
                    self.ui.x_label.setStyleSheet(error_color)
                    self.error_x_result = True
                else:
                    self.ui.particles_label.setStyleSheet(no_error_color)
                    self.ui.x_label.setStyleSheet(no_error_color)
                    self.error_x_result = False
            except AttributeError:
                self.ui.particles_label.setStyleSheet(no_error_color)
                self.ui.x_label.setStyleSheet(error_color)
                self.error_x_result = True
            try:
                if y_result.group() != self.ui.y_value.text():
                    self.ui.particles_label.setStyleSheet(error_color)
                    self.ui.y_label.setStyleSheet(error_color)
                    self.error_y_result = True
                else:
                    self.ui.particles_label.setStyleSheet(no_error_color)
                    self.ui.y_label.setStyleSheet(no_error_color)
                    self.error_y_result = False
            except AttributeError:
                self.ui.particles_label.setStyleSheet(error_color)
                self.ui.y_label.setStyleSheet(error_color)
                self.error_y_result = True
            try:
                if g_result.group() != self.ui.g_value.text():
                    self.ui.organic_label.setStyleSheet(error_color)
                    self.ui.g_label.setStyleSheet(error_color)
                    self.error_g_result = True
                else:
                    self.ui.organic_label.setStyleSheet(no_error_color)
                    self.ui.g_label.setStyleSheet(no_error_color)
                    self.error_g_result = False
            except AttributeError:
                self.ui.organic_label.setStyleSheet(error_color)
                self.ui.g_label.setStyleSheet(error_color)
                self.error_g_result = True
            try:
                if s_result.group() != self.ui.s_value.text():
                    self.ui.organic_label.setStyleSheet(error_color)
                    self.ui.s_label.setStyleSheet(error_color)
                    self.error_s_result = True
                else:
                    self.ui.organic_label.setStyleSheet(no_error_color)
                    self.ui.s_label.setStyleSheet(no_error_color)
                    self.error_x_result = False
            except AttributeError:
                self.ui.organic_label.setStyleSheet(error_color)
                self.ui.s_label.setStyleSheet(error_color)
                self.error_x_result = True
            try:
                if z_result.group() != self.ui.z_value.text():
                    self.ui.z_label.setStyleSheet(error_color)
                    self.error_z_result = True
                else:
                    self.ui.z_label.setStyleSheet(no_error_color)
                    self.error_z_result = False
            except AttributeError:
                self.ui.z_label.setStyleSheet(error_color)
                self.error_z_result = True

            check_num_3 = '[1-6]+'
            self.prog_3 = re.compile(check_num_3)
            verbose_result = self.prog_3.search(self.verbose_value)

            try:
                if verbose_result.group() != self.ui.verbose_value.text():
                    self.ui.verbose_label.setStyleSheet(error_color)
                    self.error_verbose_result = True
                else:
                    self.ui.verbose_label.setStyleSheet(no_error_color)
                    self.error_verbose_result = False
            except AttributeError:
                self.ui.verbose_label.setStyleSheet(error_color)
                self.error_verbose_result = True

            # ------------------------------------------------#
            # The following checks values containing only path.
            # ------------------------------------------------#

            """
            #!!!!!!!!!!!!!!!!!!!!!!!!!!
            #Syntax test doesn't work ! ->  #check_num4 = '[/]([A-Za-z]+[/]?)+[A-Za-z]$'
            #!!!!!!!!!!!!!!!!!!!!!!!!!!
            """

            check_num_4 = '(.*)'  # Take all strings possible.
            self.prog_4 = re.compile(check_num_4)
            phytoplankton_path_result = self.prog_4.search(self.phytoplankton_path)
            bottom_path_result = self.prog_4.search(self.bottom_path)
            executive_path_result = self.prog_4.search(self.executive_path)

            try:
                if phytoplankton_path_result.group() != self.ui.phyto_path.text():
                    self.ui.phyto_label.setStyleSheet(error_color)
                    self.error_phytoplankton_path_result = True
                else:
                    self.ui.phyto_label.setStyleSheet(no_error_color)
                    self.error_phytoplankton_path_result = False
            except AttributeError:
                self.ui.phyto_label.setStyleSheet(error_color)
                self.error_phytoplankton_path_result = True
            try:
                if bottom_path_result.group() != self.ui.bottom_path.text():
                    self.ui.bottom_label.setStyleSheet(error_color)
                    self.error_bottom_path_result = True
                else:
                    self.ui.bottom_label.setStyleSheet(no_error_color)
                    self.error_bottom_path_result = False
            except AttributeError:
                self.ui.bottom_label.setStyleSheet(error_color)
                self.error_bottom_path_result = True
            try:
                if executive_path_result.group() != self.ui.exec_path.text():
                    self.ui.execPath_label.setStyleSheet(error_color)
                    self.error_executive_path_result = True
                else:
                    self.ui.execPath_label.setStyleSheet(no_error_color)
                    self.error_executive_path_result = False
            except AttributeError:
                self.ui.execPath_label.setStyleSheet(error_color)
                self.error_executive_path_result = True

        if (self.error_batch_name == True) | (self.error_report_parameter == True) | (
                    self.error_saa_result == True) | (self.error_sza_result == True) | (
                    self.error_p_result == True) | (self.error_wavelength_result == True) | (
                    self.error_x_result == True) | (self.error_y_result == True) | (
                    self.error_g_result == True) | (self.error_s_result == True) | (
                    self.error_z_result == True) | (self.error_verbose_result == True) | (
                    self.error_phytoplankton_path_result == True) | (self.error_bottom_path_result == True) | (
                    self.error_executive_path_result == True):
            self.without_error = False
        else:
            self.without_error = True
def check_values ( self ) : error_color = 'color: red' no_error_color = 'color: 0.75' # light gray self . error_batch_name = False self . error_report_parameter = False self . error_saa_result = False self . error_sza_result = False self . error_p_result = False self . error_wavelength_result = False self . error_x_result = False self . error_y_result = False self . error_g_result = False self . error_s_result = False self . error_z_result = False self . error_verbose_result = False self . error_phytoplankton_path_result = False self . error_bottom_path_result = False self . error_executive_path_result = False """
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        No particular checking for paths!
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        """ if self . ui . tabWidget . currentIndex ( ) == TabWidget . NORMAL_MODE : check_num = '(.*)' # Regular expression to use self . prog = re . compile ( check_num ) # Analysis object creation batch_name_result = self . prog . search ( self . batch_name_value ) # String retrieval thanks to the regular expression report_parameter_result = self . prog . search ( self . report_parameter_value ) try : if ( self . ui . batch_name_value . text ( ) . isEmpty ( ) ) | ( batch_name_result . group ( ) != self . ui . batch_name_value . text ( ) ) : self . ui . batch_name_label . setStyleSheet ( error_color ) self . error_batch_name = True else : self . ui . batch_name_label . setStyleSheet ( no_error_color ) self . error_batch_name = False except AttributeError : self . ui . batch_name_label . setStyleSheet ( error_color ) self . error_batch_name = True try : if ( self . ui . report_parameter_value . text ( ) . isEmpty ( ) ) | ( report_parameter_result . group ( ) != self . ui . report_parameter_value . text ( ) ) : self . ui . report_parameter_label . setStyleSheet ( error_color ) self . error_report_parameter = True else : self . ui . report_parameter_label . setStyleSheet ( no_error_color ) self . error_report_parameter = False except AttributeError : self . ui . report_parameter_label . setStyleSheet ( error_color ) self . error_report_parameter = True # -----------------------------------------------------------# # The following checks values separate by comas without space. # -----------------------------------------------------------# """
            Problem : The user can write just one letter or starts with a dot or finishes the list with a dot.
            """ # check_num_1 = '(^([0-9]+[.]?[0-9]*[,]?){0,}[^,])|(^([0-9]*[,]){1,}[^,])'  # Regular expression to use # self.prog_1 = re.compile(check_num_1)  # Analysis object creation # self.wavelength_values = str(self.wavelength_values).translate(None, ' ').strip(' ') # # print(self.wavelength_values) # p_result = self.prog_1.search(self.p_values)  # String retrieval thanks to the regular expression # saa_result = self.prog_1.search(self.saa_values) # sza_result = self.prog_1.search(self.sza_values) # wavelength_result = self.prog_1.search(self.wavelength_values) # # print(wavelength_result.group()) # # try: # #     if saa_result.group() != self.ui.saa_values.text(): #         self.ui.saa_label.setStyleSheet(error_color) #         self.error_sza_result = True #     else: #         self.ui.saa_label.setStyleSheet(no_error_color) #         self.error_sza_result = False # except AttributeError: #     self.ui.saa_label.setStyleSheet(error_color) #     self.error_sza_result = True # try: #     if sza_result.group() != self.ui.sza_values.text(): #         self.ui.sza_label.setStyleSheet(error_color) #         self.error_saa_result = True #     else: #         self.ui.sza_label.setStyleSheet(no_error_color) #         self.error_saa_result = False # except AttributeError: #     self.ui.sza_label.setStyleSheet(error_color) #     self.error_saa_result = True # try: #     if p_result.group() != self.ui.p_values.text(): #         self.ui.p_label.setStyleSheet(error_color) #         self.error_p_result = True #     else: #         self.ui.p_label.setStyleSheet(no_error_color) #         self.error_p_result = False # except AttributeError: #     self.ui.p_label.setStyleSheet(error_color) #     self.error_p_result = True # try: #     if wavelength_result.group() != str(self.ui.wavelength_values.text()).translate(None, ' ').strip(' '): #         self.ui.waveL_label.setStyleSheet(error_color) #         self.error_wavelength_result = True #     else: #         self.ui.waveL_label.setStyleSheet(no_error_color) #         self.error_wavelength_result = False # except AttributeError: #     self.ui.waveL_label.setStyleSheet(error_color) #     self.error_wavelength_result = True # ---------------------------------------------------# # The following checks values containing only numbers. # ---------------------------------------------------# check_num_2 = '(^([0-9]+[.]?[0-9]*[,]?){0,}[^,])|(^([0-9]+[,]){1,}[^,])' self . prog_2 = re . compile ( check_num_2 ) x_result = self . prog_2 . search ( self . x_value ) y_result = self . prog_2 . search ( self . y_value ) g_result = self . prog_2 . search ( self . g_value ) s_result = self . prog_2 . search ( self . s_value ) z_result = self . prog_2 . search ( self . z_value ) try : if x_result . group ( ) != self . ui . x_value . text ( ) : self . ui . particles_label . setStyleSheet ( error_color ) self . ui . x_label . setStyleSheet ( error_color ) self . error_x_result = True else : self . ui . particles_label . setStyleSheet ( no_error_color ) self . ui . x_label . setStyleSheet ( no_error_color ) self . error_x_result = False except AttributeError : self . ui . particles_label . setStyleSheet ( no_error_color ) self . ui . x_label . setStyleSheet ( error_color ) self . error_x_result = True try : if y_result . group ( ) != self . ui . y_value . text ( ) : self . ui . particles_label . setStyleSheet ( error_color ) self . ui . y_label . setStyleSheet ( error_color ) self . error_y_result = True else : self . ui . particles_label . setStyleSheet ( no_error_color ) self . ui . y_label . setStyleSheet ( no_error_color ) self . error_y_result = False except AttributeError : self . ui . particles_label . setStyleSheet ( error_color ) self . ui . y_label . setStyleSheet ( error_color ) self . error_y_result = True try : if g_result . group ( ) != self . ui . g_value . text ( ) : self . ui . organic_label . setStyleSheet ( error_color ) self . ui . g_label . setStyleSheet ( error_color ) self . error_g_result = True else : self . ui . organic_label . setStyleSheet ( no_error_color ) self . ui . g_label . setStyleSheet ( no_error_color ) self . error_g_result = False except AttributeError : self . ui . organic_label . setStyleSheet ( error_color ) self . ui . g_label . setStyleSheet ( error_color ) self . error_g_result = True try : if s_result . group ( ) != self . ui . s_value . text ( ) : self . ui . organic_label . setStyleSheet ( error_color ) self . ui . s_label . setStyleSheet ( error_color ) self . error_s_result = True else : self . ui . organic_label . setStyleSheet ( no_error_color ) self . ui . s_label . setStyleSheet ( no_error_color ) self . error_x_result = False except AttributeError : self . ui . organic_label . setStyleSheet ( error_color ) self . ui . s_label . setStyleSheet ( error_color ) self . error_x_result = True try : if z_result . group ( ) != self . ui . z_value . text ( ) : self . ui . z_label . setStyleSheet ( error_color ) self . error_z_result = True else : self . ui . z_label . setStyleSheet ( no_error_color ) self . error_z_result = False except AttributeError : self . ui . z_label . setStyleSheet ( error_color ) self . error_z_result = True check_num_3 = '[1-6]+' self . prog_3 = re . compile ( check_num_3 ) verbose_result = self . prog_3 . search ( self . verbose_value ) try : if verbose_result . group ( ) != self . ui . verbose_value . text ( ) : self . ui . verbose_label . setStyleSheet ( error_color ) self . error_verbose_result = True else : self . ui . verbose_label . setStyleSheet ( no_error_color ) self . error_verbose_result = False except AttributeError : self . ui . verbose_label . setStyleSheet ( error_color ) self . error_verbose_result = True # ------------------------------------------------# # The following checks values containing only path. # ------------------------------------------------# """
            #!!!!!!!!!!!!!!!!!!!!!!!!!!
            #Syntax test doesn't work ! ->  #check_num4 = '[/]([A-Za-z]+[/]?)+[A-Za-z]$'
            #!!!!!!!!!!!!!!!!!!!!!!!!!!
            """ check_num_4 = '(.*)' # Take all strings possible. self . prog_4 = re . compile ( check_num_4 ) phytoplankton_path_result = self . prog_4 . search ( self . phytoplankton_path ) bottom_path_result = self . prog_4 . search ( self . bottom_path ) executive_path_result = self . prog_4 . search ( self . executive_path ) try : if phytoplankton_path_result . group ( ) != self . ui . phyto_path . text ( ) : self . ui . phyto_label . setStyleSheet ( error_color ) self . error_phytoplankton_path_result = True else : self . ui . phyto_label . setStyleSheet ( no_error_color ) self . error_phytoplankton_path_result = False except AttributeError : self . ui . phyto_label . setStyleSheet ( error_color ) self . error_phytoplankton_path_result = True try : if bottom_path_result . group ( ) != self . ui . bottom_path . text ( ) : self . ui . bottom_label . setStyleSheet ( error_color ) self . error_bottom_path_result = True else : self . ui . bottom_label . setStyleSheet ( no_error_color ) self . error_bottom_path_result = False except AttributeError : self . ui . bottom_label . setStyleSheet ( error_color ) self . error_bottom_path_result = True try : if executive_path_result . group ( ) != self . ui . exec_path . text ( ) : self . ui . execPath_label . setStyleSheet ( error_color ) self . error_executive_path_result = True else : self . ui . execPath_label . setStyleSheet ( no_error_color ) self . error_executive_path_result = False except AttributeError : self . ui . execPath_label . setStyleSheet ( error_color ) self . error_executive_path_result = True if ( self . error_batch_name == True ) | ( self . error_report_parameter == True ) | ( self . error_saa_result == True ) | ( self . error_sza_result == True ) | ( self . error_p_result == True ) | ( self . error_wavelength_result == True ) | ( self . error_x_result == True ) | ( self . error_y_result == True ) | ( self . error_g_result == True ) | ( self . error_s_result == True ) | ( self . error_z_result == True ) | ( self . error_verbose_result == True ) | ( self . error_phytoplankton_path_result == True ) | ( self . error_bottom_path_result == True ) | ( self . error_executive_path_result == True ) : self . without_error = False else : self . without_error = True
This function checks if there is no problem about values given.
        If there is a problem with a or some values, their label's color is changed to red,
        and call a function to display an error message.
        If there is no problem, their label, if it is necessary, is changed to grey (default color).
This function checks if there is no problem about values given . If there is a problem with a or some values their label s color is changed to red and call a function to display an error message . If there is no problem their label if it is necessary is changed to grey ( default color ) .