def db_search_DB(self, table_class, field, value):
        self.table_class = table_class
        self.field = field
        self.value = value

        search_dict = {self.field: "'" + str(self.value) + "'"}

        u = Utility()
        search_dict = u.remove_empty_items_fr_dict(search_dict)

        res = self.DB_MANAGER.query_bool(search_dict, self.table_class)

        return res
    def on_pushButton_exp_images_pressed(self):
        sito = str(self.comboBox_sito.currentText())
        if self.checkBox_US.isChecked() == True:
            us_res = self.db_search_DB('US', 'sito', sito)
            sito_path = ('%s%s%s') % (self.HOME, os.sep, 'Esportazione')
            self.OS_UTILITY.create_dir(sito_path)
            if bool(us_res) == True:
                US_path = ('%s%s%s') % (sito_path, os.sep,
                                        'Unita_Stratigrafiche')
                self.OS_UTILITY.create_dir(US_path)
                for sing_us in us_res:
                    sing_us_num = str(sing_us.us)
                    prefix = '0'
                    sing_us_num_len = len(sing_us_num)
                    if sing_us_num_len == 1:
                        prefix = prefix * 4
                    elif sing_us_num_len == 2:
                        prefix = prefix * 3
                    elif sing_us_num_len == 3:
                        prefix = prefix * 2
                    else:
                        pass

                    sing_us_dir = prefix + str(sing_us_num)
                    sing_US_path = ('%s%sUS%s') % (US_path, os.sep,
                                                   sing_us_dir)
                    self.OS_UTILITY.create_dir(sing_US_path)

                    search_dict = {
                        'id_entity': sing_us.id_us,
                        'entity_type': "'" + "US" + "'"
                    }

                    u = Utility()
                    search_dict = u.remove_empty_items_fr_dict(search_dict)
                    search_images_res = self.DB_MANAGER.query_bool(
                        search_dict, 'MEDIATOENTITY')

                    for sing_media in search_images_res:
                        self.OS_UTILITY.copy_file_img(str(sing_media.filepath),
                                                      sing_US_path)


##						QMessageBox.warning(self, "Alert", str(sing_media.filepath),  QMessageBox.Ok)
##						QMessageBox.warning(self, "Alert", str(sing_US_path),  QMessageBox.Ok)

                    search_images_res = ""
                QMessageBox.warning(self, "Alert",
                                    "Creazione directories terminata",
                                    QMessageBox.Ok)
Esempio n. 3
0
    def query_bool(self, params, table):
        u = Utility()
        params = u.remove_empty_items_fr_dict(params)

        list_keys_values = list(params.items())

        field_value_string = ""

        for sing_couple_n in range(len(list_keys_values)):
            if sing_couple_n == 0:
                if type(list_keys_values[sing_couple_n][1]) != "<type 'str'>":
                    field_value_string = table + ".%s == %s" % (
                        list_keys_values[sing_couple_n][0],
                        list_keys_values[sing_couple_n][1])
                else:
                    field_value_string = table + ".%s == u%s" % (
                        list_keys_values[sing_couple_n][0],
                        list_keys_values[sing_couple_n][1])
            else:
                if type(list_keys_values[sing_couple_n][1]) == "<type 'str'>":
                    field_value_string = field_value_string + "," + table + ".%s == %s" % (
                        list_keys_values[sing_couple_n][0],
                        list_keys_values[sing_couple_n][1])
                else:
                    field_value_string = field_value_string + "," + table + ".%s == %s" % (
                        list_keys_values[sing_couple_n][0],
                        list_keys_values[sing_couple_n][1])

                    # field_value_string = ", ".join([table + ".%s == u%s" % (k, v) for k, v in params.items()])
        """
        Per poter utilizzare l'operatore LIKE è necessario fare una iterazione attraverso il dizionario per discriminare tra
        stringhe e numeri
        #field_value_string = ", ".join([table + ".%s.like(%s)" % (k, v) for k, v in params.items()])
        """
        # self.connection()
        Session = sessionmaker(bind=self.engine,
                               autoflush=True,
                               autocommit=True)
        session = Session()
        query_str = "session.query(" + table + ").filter(and_(" + field_value_string + ")).all()"
        res = eval(query_str)
        '''
        t = open("/test_import.txt", "w")
        t.write(str(query_str))
        t.close()
        '''
        return res
    def on_pushButton_search_go_pressed(self):
        if self.BROWSE_STATUS != "f":
            QMessageBox.warning(
                self, "ATTENZIONE",
                "Per eseguire una nuova ricerca clicca sul pulsante 'new search' ",
                QMessageBox.Ok)
        else:
            search_dict = {
                self.TABLE_FIELDS[0]:
                "'" + str(self.comboBox_nome_tabella.currentText()) +
                "'",  #1 - Nome tabella
                self.TABLE_FIELDS[1]:
                "'" + str(self.comboBox_sigla.currentText()) + "'",  #2 - sigla
                self.TABLE_FIELDS[2]:
                "'" + str(self.comboBox_sigla_estesa.currentText()) +
                "'",  #3 - sigla estesa
                self.TABLE_FIELDS[4]:
                "'" + str(self.comboBox_tipologia_sigla.currentText()) +
                "'"  #3 - tipologia sigla
            }

            u = Utility()
            search_dict = u.remove_empty_items_fr_dict(search_dict)

            if bool(search_dict) == False:
                QMessageBox.warning(
                    self, "ATTENZIONE",
                    "Non e' stata impostata alcuna ricerca!!!", QMessageBox.Ok)
            else:
                res = self.DB_MANAGER.query_bool(search_dict,
                                                 self.MAPPER_TABLE_CLASS)
                if bool(res) == False:
                    QMessageBox.warning(self, "ATTENZIONE",
                                        "Non e' stato trovato alcun record!",
                                        QMessageBox.Ok)

                    self.set_rec_counter(len(self.DATA_LIST),
                                         self.REC_CORR + 1)
                    self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[
                        0]

                    self.fill_fields(self.REC_CORR)
                    self.BROWSE_STATUS = "b"
                    self.label_status.setText(
                        self.STATUS_ITEMS[self.BROWSE_STATUS])

                    self.setComboBoxEditable(["self.comboBox_sigla"], 1)
                    self.setComboBoxEditable(["self.comboBox_sigla_estesa"], 1)
                    self.setComboBoxEditable(["self.comboBox_tipologia_sigla"],
                                             1)
                    self.setComboBoxEditable(["self.comboBox_nome_tabella"], 1)

                    self.setComboBoxEnable(["self.comboBox_sigla"], "False")
                    self.setComboBoxEnable(["self.comboBox_sigla_estesa"],
                                           "False")
                    self.setComboBoxEnable(["self.comboBox_tipologia_sigla"],
                                           "False")
                    self.setComboBoxEnable(["self.comboBox_nome_tabella"],
                                           "False")

                    self.setComboBoxEnable(["self.textEdit_descrizione_sigla"],
                                           "True")

                else:
                    self.DATA_LIST = []

                    for i in res:
                        self.DATA_LIST.append(i)

                    self.REC_TOT, self.REC_CORR = len(self.DATA_LIST), 0
                    self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[
                        0]
                    self.fill_fields()
                    self.BROWSE_STATUS = "b"
                    self.label_status.setText(
                        self.STATUS_ITEMS[self.BROWSE_STATUS])
                    self.set_rec_counter(len(self.DATA_LIST),
                                         self.REC_CORR + 1)

                    if self.REC_TOT == 1:
                        strings = ("E' stato trovato", self.REC_TOT, "record")
                    else:
                        strings = ("Sono stati trovati", self.REC_TOT,
                                   "records")

                        self.setComboBoxEditable(["self.comboBox_sigla"], 1)
                        self.setComboBoxEditable(
                            ["self.comboBox_sigla_estesa"], 1)
                        self.setComboBoxEditable(
                            ["self.comboBox_tipologia_sigla"], 1)
                        self.setComboBoxEditable(
                            ["self.comboBox_nome_tabella"], 1)

                        self.setComboBoxEnable(["self.comboBox_sigla"],
                                               "False")
                        self.setComboBoxEnable(["self.comboBox_sigla_estesa"],
                                               "False")
                        self.setComboBoxEnable(
                            ["self.comboBox_tipologia_sigla"], "False")
                        self.setComboBoxEnable(["self.comboBox_nome_tabella"],
                                               "False")

                        self.setComboBoxEnable(
                            ["self.textEdit_descrizione_sigla"], "True")

                    QMessageBox.warning(self, "Messaggio",
                                        "%s %d %s" % strings, QMessageBox.Ok)

        self.enable_button_search(1)
Esempio n. 5
0
    def on_pushButton_search_go_pressed(self):
        if self.BROWSE_STATUS != "f":
            QMessageBox.warning(
                self, "ATTENZIONE",
                "Per eseguire una nuova ricerca clicca sul pulsante 'new search' ",
                QMessageBox.Ok)
        else:
            if self.lineEdit_us.text() != "":
                us = int(self.lineEdit_us.text())
            else:
                us = ""

            if self.lineEdit_individuo.text() != "":
                individuo = int(self.lineEdit_individuo.text())
            else:
                individuo = ""

            if self.comboBox_eta_min.currentText() != "":
                eta_min = int(self.comboBox_eta_min.currentText())
            else:
                eta_min = ""

            if self.comboBox_eta_max.currentText() != "":
                eta_max = int(self.comboBox_eta_max.currentText())
            else:
                eta_max = ""

            search_dict = {
                self.TABLE_FIELDS[0]:
                "'" + str(self.comboBox_sito.currentText()) + "'",  #1 - Sito
                self.TABLE_FIELDS[1]:
                "'" + str(self.lineEdit_area.text()) + "'",  #2 - Area
                self.TABLE_FIELDS[2]:
                us,  #3 - US
                self.TABLE_FIELDS[3]:
                individuo,  #4 - individuo
                self.TABLE_FIELDS[4]:
                "'" + str(self.lineEdit_data_schedatura.text()) +
                "'",  #5 - data schedatura
                self.TABLE_FIELDS[5]:
                "'" + str(self.lineEdit_schedatore.text()) +
                "'",  #6 - schedatore
                self.TABLE_FIELDS[6]:
                "'" + str(self.comboBox_sesso.currentText()) + "'",  #7 - sesso
                self.TABLE_FIELDS[7]:
                eta_min,  #8 - eta min
                self.TABLE_FIELDS[8]:
                eta_max,  #9 - eta max
                self.TABLE_FIELDS[9]:
                "'" + str(self.comboBox_classi_eta.currentText()) +
                "'",  #10 - classi eta
                self.TABLE_FIELDS[10]:
                str(self.textEdit_osservazioni.toPlainText()
                    )  #11 - osservazioni
            }

            u = Utility()
            search_dict = u.remove_empty_items_fr_dict(search_dict)

            if bool(search_dict) == False:
                QMessageBox.warning(
                    self, "ATTENZIONE",
                    "Non e' stata impostata alcuna ricerca!!!", QMessageBox.Ok)
            else:
                res = self.DB_MANAGER.query_bool(search_dict,
                                                 self.MAPPER_TABLE_CLASS)
                if bool(res) == False:
                    QMessageBox.warning(self, "ATTENZIONE",
                                        "Non e' stato trovato alcun record!",
                                        QMessageBox.Ok)

                    self.set_rec_counter(len(self.DATA_LIST),
                                         self.REC_CORR + 1)
                    self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[
                        0]
                    self.fill_fields(self.REC_CORR)
                    self.BROWSE_STATUS = "b"
                    self.label_status.setText(
                        self.STATUS_ITEMS[self.BROWSE_STATUS])

                    self.setComboBoxEnable(["self.comboBox_sito"], "False")
                    self.setComboBoxEnable(["self.lineEdit_area"], "False")
                    self.setComboBoxEnable(["self.lineEdit_us"], "False")
                    self.setComboBoxEnable(["self.lineEdit_individuo"],
                                           "False")
                    self.setComboBoxEnable(["self.textEdit_osservazioni"],
                                           "True")
                else:
                    self.DATA_LIST = []
                    for i in res:
                        self.DATA_LIST.append(i)
                    self.REC_TOT, self.REC_CORR = len(self.DATA_LIST), 0
                    self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[
                        0]
                    self.fill_fields()
                    self.BROWSE_STATUS = "b"
                    self.label_status.setText(
                        self.STATUS_ITEMS[self.BROWSE_STATUS])
                    self.set_rec_counter(len(self.DATA_LIST),
                                         self.REC_CORR + 1)

                    if self.REC_TOT == 1:
                        strings = ("E' stato trovato", self.REC_TOT, "record")
                        if self.toolButtonGis.isChecked() == True:
                            id_us_list = self.charge_id_us_for_individuo()
                            self.pyQGIS.charge_individui_us(id_us_list)
                            self.pyQGIS.charge_individui_from_research(
                                self.DATA_LIST)

                    else:
                        strings = ("Sono stati trovati", self.REC_TOT,
                                   "records")
                        if self.toolButtonGis.isChecked() == True:
                            id_us_list = self.charge_id_us_for_individuo()
                            self.pyQGIS.charge_individui_us(id_us_list)
                            self.pyQGIS.charge_individui_from_research(
                                self.DATA_LIST)

                    self.setComboBoxEnable(["self.comboBox_sito"], "False")
                    self.setComboBoxEnable(["self.lineEdit_area"], "False")
                    self.setComboBoxEnable(["self.lineEdit_us"], "False")
                    self.setComboBoxEnable(["self.lineEdit_individuo"],
                                           "False")
                    self.setComboBoxEnable(["self.textEdit_osservazioni"],
                                           "True")
                    QMessageBox.warning(self, "Messaggio",
                                        "%s %d %s" % strings, QMessageBox.Ok)

        self.enable_button_search(1)
Esempio n. 6
0
	def on_pushButton_search_go_pressed(self):
		if self.BROWSE_STATUS != "f":
			QMessageBox.warning(self, "ATTENZIONE", "Per eseguire una nuova ricerca clicca sul pulsante 'new search' ",  QMessageBox.Ok)
		else:

			if self.lineEdit_nr_campione.text() == "":
				nr_campione = None
			else:
				nr_campione = int(self.lineEdit_nr_campione.text())

			if self.lineEdit_us.text() == "":
				us = None
			else:
				us = int(self.lineEdit_us.text())

			if self.lineEdit_cassa.text() == "":
				nr_cassa = None
			else:
				nr_cassa = int(self.lineEdit_cassa.text())

			if self.lineEdit_n_inv_mat.text() == "":
				numero_inventario_materiale = None
			else:
				numero_inventario_materiale = int(self.lineEdit_n_inv_mat.text())

			search_dict = {
			self.TABLE_FIELDS[0] : "'"+str(self.comboBox_sito.currentText())+"'",							#1 - Sito
			self.TABLE_FIELDS[1] : nr_campione, 																		#2 - numero_campione
			self.TABLE_FIELDS[2] : "'"+str(self.comboBox_tipo_campione.currentText())+"'",			#3 - tipo campione
			self.TABLE_FIELDS[4] : "'"+str(self.lineEdit_area.text()) +"'", 										#4- area
			self.TABLE_FIELDS[5] : us, 																					#5 - us
			self.TABLE_FIELDS[6] : numero_inventario_materiale,													#6 - numero inventario materiale
			self.TABLE_FIELDS[7] : nr_cassa,																			#7- nr cassa
			self.TABLE_FIELDS[8] : "'"+str(self.lineEdit_luogo_conservazione.text())+"'"					#8 - periodo finale
			}

			u = Utility()
			search_dict = u.remove_empty_items_fr_dict(search_dict)

			if bool(search_dict) == False:
				QMessageBox.warning(self, "ATTENZIONE", "Non e' stata impostata alcuna ricerca!!!",  QMessageBox.Ok)
			else:
				res = self.DB_MANAGER.query_bool(search_dict, self.MAPPER_TABLE_CLASS)
				if bool(res) == False:
					QMessageBox.warning(self, "ATTENZIONE", "Non e' stato trovato alcun record!",  QMessageBox.Ok)

					self.set_rec_counter(len(self.DATA_LIST), self.REC_CORR+1)
					self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[0]

					self.fill_fields(self.REC_CORR)
					self.BROWSE_STATUS = "b"
					self.label_status.setText(self.STATUS_ITEMS[self.BROWSE_STATUS])

					self.setComboBoxEnable(["self.comboBox_sito"],"False")
					self.setComboBoxEnable(["self.lineEdit_nr_campione"],"True")
					self.setComboBoxEnable(["self.textEdit_descrizione_camp"],"True")

				else:
					self.DATA_LIST = []

					for i in res:
						self.DATA_LIST.append(i)

					self.REC_TOT, self.REC_CORR = len(self.DATA_LIST), 0
					self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[0]
					self.fill_fields()
					self.BROWSE_STATUS = "b"
					self.label_status.setText(self.STATUS_ITEMS[self.BROWSE_STATUS])
					self.set_rec_counter(len(self.DATA_LIST), self.REC_CORR+1)

					if self.REC_TOT == 1:
						strings = ("E' stato trovato", self.REC_TOT, "record")
					else:
						strings = ("Sono stati trovati", self.REC_TOT, "records")

					self.setComboBoxEnable(["self.comboBox_sito"],"False")
					self.setComboBoxEnable(["self.lineEdit_nr_campione"],"True")
					self.setComboBoxEnable(["self.textEdit_descrizione_camp"],"True")

					QMessageBox.warning(self, "Messaggio", "%s %d %s" % strings, QMessageBox.Ok)

		self.enable_button_search(1)
    def on_pushButton_search_go_pressed(self):
        if self.BROWSE_STATUS != "f":
            QMessageBox.warning(
                self, "ATTENZIONE",
                "Per eseguire una nuova ricerca clicca sul pulsante 'new search' ",
                QMessageBox.Ok)
        else:
            search_dict = {
                'sito':
                "'" + str(self.comboBox_sito.currentText()) + "'",  #1 - Sito
                'nazione':
                "'" + str(self.comboBox_nazione.currentText()) +
                "'",  #2 - Nazione
                'regione':
                "'" + str(self.comboBox_regione.currentText()) +
                "'",  #3 - Regione
                'comune':
                "'" + str(self.comboBox_comune.currentText()) +
                "'",  #4 - Comune
                'descrizione':
                str(self.textEdit_descrizione_site.toPlainText()
                    ),  #5 - Descrizione
                'provincia':
                "'" + str(self.comboBox_provincia.currentText()) +
                "'",  #6 - Provincia
                'definizione_sito':
                "'" + str(self.comboBox_definizione_sito.currentText()) +
                "'"  #67- definizione_sito
            }

            u = Utility()
            search_dict = u.remove_empty_items_fr_dict(search_dict)

            if bool(search_dict) == False:
                QMessageBox.warning(
                    self, "ATTENZIONE",
                    "Non e' stata impostata alcuna ricerca!!!", QMessageBox.Ok)
            else:
                res = self.DB_MANAGER.query_bool(search_dict,
                                                 self.MAPPER_TABLE_CLASS)

                if bool(res) == False:
                    QMessageBox.warning(self, "ATTENZIONE",
                                        "Non e' stato trovato alcun record!",
                                        QMessageBox.Ok)

                    self.set_rec_counter(len(self.DATA_LIST),
                                         self.REC_CORR + 1)
                    self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[
                        0]

                    self.fill_fields(self.REC_CORR)
                    self.BROWSE_STATUS = "b"
                    self.label_status.setText(
                        self.STATUS_ITEMS[self.BROWSE_STATUS])

                    self.setComboBoxEnable(["self.comboBox_sito"], "False")
                    self.setComboBoxEnable(["self.comboBox_definizione_sito"],
                                           "True")
                    self.setComboBoxEnable(["self.textEdit_descrizione_site"],
                                           "True")
                else:
                    self.DATA_LIST = []
                    for i in res:
                        self.DATA_LIST.append(i)

##					if self.DB_SERVER == 'sqlite':
##						for i in self.DATA_LIST:
##							self.DB_MANAGER.update(self.MAPPER_TABLE_CLASS, self.ID_TABLE, [i.id_sito], ['find_check'], [1])

                    self.REC_TOT, self.REC_CORR = len(self.DATA_LIST), 0
                    self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[
                        0]  ####darivedere
                    self.fill_fields()
                    self.BROWSE_STATUS = "b"
                    self.label_status.setText(
                        self.STATUS_ITEMS[self.BROWSE_STATUS])
                    self.set_rec_counter(len(self.DATA_LIST),
                                         self.REC_CORR + 1)

                    if self.REC_TOT == 1:
                        strings = ("E' stato trovato", self.REC_TOT, "record")
                        if self.toolButton_draw_siti.isChecked() == True:
                            sing_layer = [self.DATA_LIST[self.REC_CORR]]
                            self.pyQGIS.charge_sites_from_research(sing_layer)
                    else:
                        strings = ("Sono stati trovati", self.REC_TOT,
                                   "records")
                        self.pyQGIS.charge_sites_from_research(self.DATA_LIST)

                    self.setComboBoxEnable(["self.comboBox_sito"], "False")
                    self.setComboBoxEnable(["self.comboBox_definizione_sito"],
                                           "True")
                    self.setComboBoxEnable(["self.textEdit_descrizione_site"],
                                           "True")

                    QMessageBox.warning(self, "Messaggio",
                                        "%s %d %s" % strings, QMessageBox.Ok)

        self.enable_button_search(1)
    def on_pushButton_search_go_pressed(self):
        if self.BROWSE_STATUS != "f":
            QMessageBox.warning(
                self, "ATTENZIONE",
                "Per eseguire una nuova ricerca clicca sul pulsante 'new search' ",
                QMessageBox.Ok)
        else:
            if self.lineEdit_cron_iniz.text() != "":
                cron_iniziale = "'" + str(self.lineEdit_cron_iniz.text()) + "'"
            else:
                cron_iniziale = ""

            if self.lineEdit_cron_fin.text() != "":
                cron_finale = "'" + str(self.lineEdit_cron_fin.text()) + "'"
            else:
                cron_finale = ""

            if self.comboBox_periodo.currentText() != "":
                periodo = "'" + str(self.comboBox_periodo.currentText()) + "'"
            else:
                periodo = ""

            if self.comboBox_fase.currentText() != "":
                fase = "'" + str(self.comboBox_fase.currentText()) + "'"
            else:
                fase = ""

            search_dict = {
                'sito':
                "'" + str(self.comboBox_sito.currentText()) + "'",  #1 - Sito
                'periodo': periodo,  #2 - Periodo
                'fase': fase,  #3 - Fase
                'cron_iniziale': cron_iniziale,  #4 - Cron iniziale
                'cron_finale': cron_finale,  #5 - Crion finale
                'descrizione': str(self.textEdit_descrizione_per.toPlainText()
                                   ),  #6 - Descrizione
                'datazione_estesa':
                "'" + str(self.lineEdit_per_estesa.text()) +
                "'",  #7 - Periodizzazione estesa
                'cont_per': "'" + str(self.lineEdit_codice_periodo.text()) +
                "'"  #8 - Codice periodo
            }

            u = Utility()
            search_dict = u.remove_empty_items_fr_dict(search_dict)

            if bool(search_dict) == False:
                QMessageBox.warning(
                    self, "ATTENZIONE",
                    "Non e' stata impostata alcuna ricerca!!!", QMessageBox.Ok)
            else:
                res = self.DB_MANAGER.query_bool(search_dict,
                                                 self.MAPPER_TABLE_CLASS)
                if bool(res) == False:
                    QMessageBox.warning(self, "ATTENZIONE",
                                        "Non e' stato trovato alcun record!",
                                        QMessageBox.Ok)

                    self.set_rec_counter(len(self.DATA_LIST),
                                         self.REC_CORR + 1)
                    self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[
                        0]

                    self.fill_fields(self.REC_CORR)
                    self.BROWSE_STATUS = "b"
                    self.label_status.setText(
                        self.STATUS_ITEMS[self.BROWSE_STATUS])

                    self.setComboBoxEditable(["self.comboBox_sito"], 1)
                    self.setComboBoxEditable(["self.comboBox_periodo"], 1)
                    self.setComboBoxEditable(["self.comboBox_fase"], 1)

                    self.setComboBoxEnable(["self.comboBox_sito"], "False")
                    self.setComboBoxEnable(["self.comboBox_periodo"], "False")
                    self.setComboBoxEnable(["self.comboBox_fase"], "False")

                    self.setComboBoxEnable(["self.textEdit_descrizione_per"],
                                           "True")

                else:
                    self.DATA_LIST = []
                    for i in res:
                        self.DATA_LIST.append(i)
                    self.REC_TOT, self.REC_CORR = len(self.DATA_LIST), 0
                    self.DATA_LIST_REC_TEMP = self.DATA_LIST_REC_CORR = self.DATA_LIST[
                        0]
                    self.fill_fields()
                    self.BROWSE_STATUS = "b"
                    self.label_status.setText(
                        self.STATUS_ITEMS[self.BROWSE_STATUS])
                    self.set_rec_counter(len(self.DATA_LIST),
                                         self.REC_CORR + 1)

                    if self.REC_TOT == 1:
                        strings = ("E' stato trovato", self.REC_TOT, "record")
                    else:
                        strings = ("Sono stati trovati", self.REC_TOT,
                                   "records")

                    self.setComboBoxEditable(["self.comboBox_sito"], 1)
                    self.setComboBoxEditable(["self.comboBox_periodo"], 1)
                    self.setComboBoxEditable(["self.comboBox_fase"], 1)
                    self.setComboBoxEnable(["self.comboBox_sito"], "False")
                    self.setComboBoxEnable(["self.comboBox_periodo"], "False")
                    self.setComboBoxEnable(["self.comboBox_fase"], "False")
                    self.setComboBoxEnable(["self.textEdit_descrizione_per"],
                                           "True")

                    QMessageBox.warning(self, "Messaggio",
                                        "%s %d %s" % strings, QMessageBox.Ok)

        self.enable_button_search(1)