Example #1
0
 def _create_folder(self):
     DEBUG("Creating a folder...")
     current_item = self.currentItem()
     qinput = QInputDialog(self)
     qinput.setInputMode(QInputDialog.TextInput)
     qinput.setWindowTitle(self.tr("Nueva Carpeta"))
     qinput.setLabelText(self.tr("Nombre:"))
     qinput.resize(400, 100)
     ok = qinput.exec_()
     folder_name = qinput.textValue()
     if ok:
         path = os.path.join(current_item.path, folder_name)
         if os.path.exists(path):
             QMessageBox.information(self, self.tr("Información"),
                                     self.tr("La carpeta ya existe"),
                                     QMessageBox.Yes)
             DEBUG("The folder already exists...")
             return
         # Creo la carpeta
         os.mkdir(path)
         # Agrego el ítem al árbol
         folder_item = TreeItem(current_item, [folder_name])
         folder_item.path = path
         folder_item.isFile = False
         folder_item.setExpanded(True)
Example #2
0
def ask_password_dialog(parent, title, prompt, timeout=None):
    if parent is None:
        qt4tools.create_qapplication()

    import icon
    dialog = QInputDialog()

    timer = QTimer()
    if not timeout is None:
        dialog.connect(timer, SIGNAL("timeout()"), dialog.reject)
        timer.setInterval(timeout * 1000)
        timer.start()

    dialog.setWindowIcon(icon.BIT_LOGO)
    dialog.setWindowTitle(title)
    dialog.setLabelText(prompt)
    dialog.setTextEchoMode(QLineEdit.Password)
    QApplication.processEvents()

    ret = dialog.exec_()

    timer.stop()
    if ret:
        password = dialog.textValue()
    else:
        password = ''
    del (dialog)

    return (password)
Example #3
0
    def _specify_hdd(self):
        """
        Specify which HDD to unmount.

        Arguments:
        None

        Return:
        HDD text
        """
        text, result = QInputDialog().getText(
            self,
            'Specify hdd',
            'choose hdd to unmount,\n"all" will unmount all mounted hdd\'s',
            QLineEdit.Normal,
            'all'
            )
        if result:
            text = text.lower()
            if text.startswith('hdd_'):
                return text
            elif text.startswith('hdd '):
                return text
            elif text == 'all':
                return text
            else:
                tu.message('Input needs to be "all" or "hdd_{number}" or "hdd {number}')
                return None
        else:
            tu.message('Input needs to be "all" or "hdd_{number} or "hdd {number}"')
            return None
Example #4
0
    def __call__(self, val):
        dialog = QInputDialog(parent=self.parent)
#         dialog.setLabelText("")
        dialog.setLabelText("set label for minimum: " + str(self.minimum.energy))
        dialog.setInputMode(0)
        dialog.exec_()
        if dialog.result():
            label = dialog.textValue()
            self.parent._minima_labels[self.minimum] = label
Example #5
0
 def motor_current_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(360)
     qid.setIntMaximum(1640)
     qid.setIntStep(100)
     async_call(self.silent_stepper.get_motor_current, None, qid.setIntValue, self.increase_error_count)
     qid.intValueSelected.connect(self.motor_current_selected)
     qid.setLabelText("Choose motor current in mA.")
     qid.open()
Example #6
0
 def __call__(self, val):
     dialog = QInputDialog(parent=self.parent)
     #         dialog.setLabelText("")
     dialog.setLabelText("Temperature for MFPT calculation")
     dialog.setInputMode(2)
     dialog.setDoubleValue(1.)
     dialog.exec_()
     if dialog.result():
         T = dialog.doubleValue()
         self.parent._color_by_mfpt(self.minimum1, T=T)
Example #7
0
    def show_save_profile_dialog(self):
        name, ok = QInputDialog().getText(self, "Save Profile", "Profile Name", QLineEdit.Normal)

        if ok:
            if re.match('^[\w-]+$', name):
                # TODO: This is a hack. Instead, there should be a option to
                # copy the current profile or something.
                pass
            else:
                QMessageBox.information(None, "Invalid name", "Invalid characters used. Only alphanumeric and dashes allowed.")
Example #8
0
 def __call__(self, val):
     dialog = QInputDialog(parent=self.parent)
     #         dialog.setLabelText("")
     dialog.setLabelText("Temperature for committor calculation")
     dialog.setInputMode(2)
     dialog.setDoubleValue(1.)
     dialog.exec_()
     if dialog.result():
         T = dialog.doubleValue()
         self.parent._layout_by_committor(self.minimum1, self.minimum2, T=T)
Example #9
0
 def minimum_motor_voltage_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(0)
     qid.setIntMaximum(40000)
     qid.setIntStep(100)
     async_call(self.stepper.get_minimum_voltage, None, qid.setIntValue, self.increase_error_count)
     qid.intValueSelected.connect(self.minimum_motor_voltage_selected)
     qid.setLabelText("Choose minimum motor voltage in mV.")
     qid.open()
Example #10
0
    def motor_current_button_clicked(self):
        qid = QInputDialog(self)
        qid.setInputMode(QInputDialog.IntInput)
        qid.setIntMinimum(0)
        qid.setIntMaximum(2500)
        qid.setIntStep(100)
        async_call(self.stepper.get_motor_current, None, qid.setIntValue, self.increase_error_count)
        qid.intValueSelected.connect(self.motor_current_selected)
        qid.setLabelText("Choose motor current in mA.")
#                         "<font color=red>Setting this too high can destroy your Motor.</font>")
        qid.open()
Example #11
0
    def show_save_profile_dialog(self):
        profile, ok = QInputDialog().getText(self, "Save Profile",
                                             "Profile Name", QLineEdit.Normal)

        if ok:
            if re.match('^[\w-]+$', profile):
                self.config.saveProfile(profile)
            else:
                QMessageBox.information(
                    None, "Invalid name",
                    "Invalid characters used. Only alphanumeric and dashes allowed."
                )
Example #12
0
 def output_voltage_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(2000)
     qid.setIntMaximum(9000)
     qid.setIntStep(100)
     async_call(self.servo.get_output_voltage, None, qid.setIntValue,
                self.increase_error_count)
     qid.intValueSelected.connect(self.output_voltage_selected)
     qid.setLabelText("Choose Output Voltage in mV.")
     #                         "<font color=red>Setting this too high can destroy your servo.</font>")
     qid.open()
Example #13
0
    def backup(self):
        try:
            selected_index = self.treeViewStorage.selectedIndexes()[0]
            selected_path = self.model_storage.filePath(selected_index).split(
                '/')[::-1]
            storage = ''
            for i, dir in enumerate(selected_path):
                if dir == "Backups":
                    storage = str(selected_path[i - 1])
            dialog = QInputDialog()
            dialog.setModal(True)
            key, ok = dialog.getText(self,
                                     "Key",
                                     "Enter key for <b>%s</b> storage" %
                                     storage,
                                     mode=QLineEdit.Password)
            if ok:
                #try:
                key = str(key)
                with open(self.current_dir + storage + sep + "init",
                          'rb') as f:
                    hash_from_storage = f.read(64)
                    cipter_text = f.read()
                    encryptor = AES.new(key + self.padding[len(key):])
                    plain = encryptor.decrypt(cipter_text)
                    if hash_from_storage == SHA256.new(plain).hexdigest():
                        self.password = key
                        self.encrypt_and_save_to(storage)
                    else:
                        QMessageBox.about(self, "Error", "Incorrect password!")
            #except UnicodeError:
            #    QMessageBox.about(self, "Unicode error", "Incorrect password!")

        except IndexError:
            if self.selected_storage:
                with open(
                        self.current_dir + self.selected_storage + sep +
                        "init", 'rb') as f:
                    hash_from_storage = f.read(64)
                    cipter_text = f.read()
                    encryptor = AES.new(self.password +
                                        self.padding[len(self.password):])
                    plain = encryptor.decrypt(cipter_text)
                    if hash_from_storage == SHA256.new(plain).hexdigest():
                        self.encrypt_and_save_to(self.selected_storage)
                    else:
                        QMessageBox.about(self, "Error",
                                          "Incorrect password! sel")
            else:
                QMessageBox.about(
                    self, "Error",
                    "Select the storage before creating backup!")
                self.tabWidgetRoot.setCurrentWidget(self.tab_storage)
Example #14
0
 def minimum_voltage_button_pressed(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(5000)
     qid.setIntMaximum(0xFFFF)
     qid.setIntStep(100)
     try:
         qid.setIntValue(self.servo.get_minimum_voltage())
     except ip_connection.Error:
         return
     qid.intValueSelected.connect(self.minimum_voltage_selected)
     qid.setLabelText("Choose minimum servo voltage in mV.")
     qid.open()
Example #15
0
 def output_voltage_button_clicked(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(5000)
     qid.setIntMaximum(27000)
     qid.setIntStep(100)
     try:
         qid.setIntValue(self.servo.get_output_voltage())
     except ip_connection.Error:
         return
     qid.intValueSelected.connect(self.output_voltage_selected)
     qid.setLabelText("Choose Output Voltage in mV.")
     #                         "<font color=red>Setting this too high can destroy your servo.</font>")
     qid.open()
Example #16
0
 def motor_current_button_pressed(self):
     qid = QInputDialog(self)
     qid.setInputMode(QInputDialog.IntInput)
     qid.setIntMinimum(0)
     qid.setIntMaximum(2500)
     qid.setIntStep(100)
     try:
         qid.setIntValue(self.stepper.get_motor_current())
     except ip_connection.Error:
         return
     qid.intValueSelected.connect(self.motor_current_selected)
     qid.setLabelText("Choose motor current in mA.")
     #                         "<font color=red>Setting this too high can destroy your Motor.</font>")
     qid.open()
Example #17
0
def getFindMsg( parentWidget, prepText = None ):
    qd = QInputDialog(parentWidget)
    qd.setInputMode(QInputDialog.TextInput)
    qd.setOkButtonText(QString('Find'))
    qd.setLabelText(QString('Text to find'))
    if (prepText is not None):
        if prepText.size() > 40 :
            prepText.truncate(40)
        qd.setTextValue(prepText)
    b = (QDialog.Accepted == qd.exec_() )
    if b :
        return (True, qd.textValue())
    else:
        return (False, QString() )
Example #18
0
    def continue_dialog(self, text1, text2):
        """
        Check if the user wants to run the continue mode.

        Arguments:
        text1 - Dialog window name.
        text2 - Text of the dialog.

        Return:
        True, if the input is YES!
        """
        dialog = QInputDialog(self)
        result = dialog.getText(self, text1, text2)
        return bool(result[0] == 'YES!')
Example #19
0
 def new_city_clicked(self):
     dialog = QInputDialog(self)
     city_name = QInputDialog.getText(dialog, "Имя города",
                                      "Введите имя города:")
     if not city_name[1] and city_name[0] == '':
         return
     ill_percent = QInputDialog.getDouble(dialog, "Заболеваемость",
                                          "Введите процент заболевших:", 0,
                                          0, 100, 2)
     if not ill_percent[1] and ill_percent[0] == '':
         return
     town = Town(city_name[0], 1000000, 0, 0)
     state = TownInfectionState(town)
     ill_percent = ill_percent[0] * 0.01
     state.ill_population = (1000000 * ill_percent, 0, 0, 0)
     state.vaccinated_population = (1000000 * (1 - ill_percent), 0, 0, 0)
     town.infection_state = state
     self.model.towns.append(town)
    def sauvegader_projet(self):
        qid = QInputDialog()
        title = "Entrez le nom de votre projet"
        label = "le nom:" 
        mode = QLineEdit.Normal    
        text, ok = QInputDialog.getText(qid, title, label, mode)
        if text !="":
            try:
                print "hello my name is zere9"
                project = QgsProject.instance()
                project.write()
# ... or to a new file
                mypath='C:\Users\RET\.qgis2\python\plugins\Mini_Projet_Zone\Projets\SR_'+text+'.qgs'
                project.write(QFileInfo(mypath))
                QMessageBox.information(None, "information", " Succes!!")

            except:    
                QMessageBox.critical(None, "Erreur", " Fichier non sauvegardé")
                return False 
Example #21
0
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QApplication, QMessageBox, QInputDialog, QMainWindow
from sys import argv
import sys


def f(x):
    return x * x


print f(1), f(2), f(3)

for x in range(10):
    print f(x)

app = QApplication(argv)

mainwindow = QMainWindow()
mainwindow.show()
msgbox = QInputDialog()
text, ok = msgbox.getText(mainwindow, 'Enter text', 'Enter text')

if ok:
    print text

sys.exit(app.exec_())
Example #22
0
def updateField():
    maCouche = iface.activeLayer()
    layerName = maCouche.name()
    formTitle = layerName + u" - Attributs d'entités"
    layers = QgsMapLayerRegistry.instance().mapLayers(
    )  # liste des couches du projet

    for w in iface.mainWindow().findChildren(QDialog):
        if w.windowTitle() == formTitle and w.isActiveWindow():
            w.reject()

    vYear = u"year"
    vStatus = u"fk_status"
    year = datetime.now().year
    for feature in maCouche.getFeatures(QgsFeatureRequest(int(featureId))):
        msgBox = QMessageBox()
        if feature[vStatus] == 1301:
            text_service = u"La conduite ID =" + str(
                featureId) + u" est déjà en service, depuis " + str(
                    feature[vYear])
            msgBox.setText(text_service)
            msgBox.exec_()
        else:
            if not maCouche.isEditable():
                maCouche.startEditing()
            feature[vStatus] = 1301
            input_rep = QInputDialog()
            year, ok = input_rep.getInt(
                None, u"Annee de service ",
                u"indiquez l'ann\xe9e de mise en service (4 chiffres)",
                datetime.now().year, 1860,
                datetime.now().year, 1)
            if ok:
                if not feature[vYear] or feature[vYear] == 0:
                    #print(feature[vYear])
                    feature[vYear] = year
                elif feature[vYear] <> year:
                    reply = QMessageBox.question(
                        iface.mainWindow(),
                        u"Différence entre l'année de pose et l'année de mise en service",
                        u"Une année de pose a déjà été saisie : " +
                        str(feature[vYear]) + u" sur la conduite (ID : " +
                        str(feature.id()) +
                        u") , êtes-vous sûr de vouloir la modifier en " +
                        str(year) + u"?", QMessageBox.Yes | QMessageBox.No,
                        QMessageBox.No)
                    if reply == QMessageBox.Yes:
                        feature[vYear] = year
                    else:
                        year = feature[vYear]
                else:
                    #print(feature[vYear])
                    pass

                if iface.openFeatureForm(maCouche, feature):
                    maCouche.updateFeature(feature)
                    num_e = 0
                    num_v = 0
                    num_h = 0
                    num_i = 0
                    for i in range(0, len(layerIds)):
                        if layerIds[i] not in layers:
                            text_layer = u"La couche avec ID = " + str(
                                layerIds[i]
                            ) + u" n'existe plus ou pas dans le projet, merci de vérifier la structure du projet sinon elle ne sera pas prise en compte dans la mise en service"
                            msgBox.setText(text_layer)
                            msgBox.exec_()
                    for layer in layers.values():
                        uri = QgsDataSourceURI(layer.source())
                        name = uri.schema() + "." + uri.table()
                        #if name in ["qwat_od.valve", "qwat_od.part" , "qwat_od.hydrant", "qwat_od.subscriber"]:
                        if layer.id() in layerIds:
                            num_elements = 0
                            if not layer.isEditable():
                                layer.startEditing()
                            req = QgsFeatureRequest(
                                feature.geometry().boundingBox()
                            ).setFilterExpression(' "fk_status" = \'103\' ')
                            for feat in layer.getFeatures(req):
                                if feat.geometry().intersects(
                                        feature.geometry()):
                                    num = 0
                                    for f in maCouche.getFeatures(
                                            QgsFeatureRequest(
                                                feat.geometry().boundingBox()).
                                            setFilterExpression(
                                                ' "fk_status" != \'1301\' ')):
                                        if f.geometry().intersects(
                                                feat.geometry(
                                                )) and f.id() != featureId:
                                            num += 1
                                    if num == 0:
                                        if feat[vStatus] != 1301:
                                            feat[vStatus] = 1301
                                            if not feat[vYear] or feat[
                                                    vYear] == 0:
                                                feat[vYear] = year
                                            elif feat[vYear] <> year:
                                                reply_obj = QMessageBox.question(
                                                    iface.mainWindow(),
                                                    u"Différence entre l'année de pose et l'année de mise en service",
                                                    u"Une année de pose a déjà été saisie : "
                                                    + str(feat[vYear]) +
                                                    u" sur l'objet '" +
                                                    layer.name() +
                                                    u"' (ID : " +
                                                    str(feat.id()) +
                                                    u"), êtes-vous sûr de vouloir la modifier en "
                                                    + str(year) + u"?",
                                                    QMessageBox.Yes
                                                    | QMessageBox.No,
                                                    QMessageBox.No)
                                                if reply_obj == QMessageBox.Yes:
                                                    feat[vYear] = year
                                                else:
                                                    pass
                                            layer.updateFeature(feat)
                                            num_elements += 1
                            if name == "qwat_od.valve":
                                num_v = num_elements
                            if name == "qwat_od.part":
                                num_e = num_elements
                            if name == "qwat_od.hydrant":
                                num_h = num_elements
                            if name == "qwat_od.subscriber":
                                num_i = num_elements

                    text = u"La conduite ID =" + str(
                        featureId
                    ) + u" a \xe9t\xe9 mise en service avec l'ann\xe9e : " + str(
                        feature[vYear])
                    if num_v > 0 or num_e > 0 or num_h > 0 or num_i > 0:
                        text += u"\n ainsi que :"
                        if num_v > 0:
                            text += u"\n - " + str(num_v) + u" vannes"
                        if num_e > 0:
                            text += u"\n - " + str(
                                num_e) + u" \xe9l\xe9ments de montage"
                        if num_h > 0:
                            text += u"\n - " + str(num_h) + u" hydrants"
                        if num_i > 0:
                            text += u"\n - " + str(num_i) + u" introductions"
                    msgBox.setText(text)
                    msgBox.exec_()
                else:
                    pass
            else:
                pass
Example #23
0
    def restore(self):
        self.progressBarBackup.setMinimum(0)
        self.progressBarBackup.setMaximum(0)
        self.restoreButton.setEnabled(False)
        self.threads = []
        self.files_to_restore = {}
        for index, state in self.model_storage.checks.items():
            th = Thread(target=self.model_storage.exportChecked,
                        args=(self.lock, {
                            index: state
                        }, self.files_to_restore))
            th.start()
            self.threads.append(th)

        status = map(Thread.isAlive, self.threads)

        while any(status):
            qApp.processEvents()
            status = map(Thread.isAlive, self.threads)

        self.progressBarBackup.setMaximum(100)
        self.progressBarBackup.setValue(100)
        if self.files_to_restore:
            files_count = sum(
                len(f) for cat in self.files_to_restore.values()
                for date in cat.values() for f in date.values()[0])
            self.progressBarBackup.setMaximum(files_count)
            self.progressBarBackup.setValue(0)
            dialog = Restore_type(self)
            dialog.setModal(True)
            self.prev_or_spec, self.path_to_restore, ok = dialog.call(self)
            if ok:
                for storage, categories in self.files_to_restore.items():
                    dialog = QInputDialog()
                    dialog.setModal(True)
                    key, ok = dialog.getText(
                        self,
                        "Key",
                        "Enter key for <b>%s</b> storage" % storage,
                        mode=QLineEdit.Password)
                    if ok:
                        try:
                            key = str(key)
                            with open(
                                    self.current_dir + storage + sep + "init",
                                    'rb') as f:
                                hash_from_storage = f.read(64)
                                cipter_text = f.read()
                                encryptor = AES.new(key +
                                                    self.padding[len(key):])
                                plain = encryptor.decrypt(cipter_text)
                                if hash_from_storage == SHA256.new(
                                        plain).hexdigest():
                                    for cat, backups in categories.items():
                                        sorted_by_date = sorted(
                                            backups.keys(), key=lambda x: x)
                                        for backup in sorted_by_date:
                                            for fn in backups[backup]:
                                                path_to_file = self.current_dir + storage + sep + backup + sep + cat + sep + fn
                                                self.decrypt_and_save(
                                                    path_to_file,
                                                    key,
                                                    new_path=self.
                                                    path_to_restore + sep + cat
                                                    if not self.prev_or_spec
                                                    else '')
                                                self.progressBarBackup.setValue(
                                                    self.progressBarBackup.
                                                    value() + 1)
                                    self.progressBarBackup.setValue(
                                        self.progressBarBackup.maximum())
                                else:
                                    QMessageBox.about(self, "Error",
                                                      "Incorrect password!")
                        except UnicodeError:
                            QMessageBox.about(self, "Error",
                                              "Incorrect password!")
        else:
            QMessageBox.about(
                self, "Error",
                "Select the storage/backup/file before restoring!")
        self.restoreButton.setEnabled(True)
Example #24
0
 def address_prompt(self, message="", level="Warning"):
     message = "{}. Change port".format(message)
     return QInputDialog.getInt(QInputDialog(), level, message, self.port,
                                1024, 65535)
Example #25
0
 def address_prompt(self, message="", level="Warning"):
     message = "{}. Change address".format(message)
     return QInputDialog.getText(QInputDialog(), level, message, 0,
                                 self.address)
Example #26
0
def updateField():
    maCouche = iface.activeLayer()
    layerName = maCouche.name()
    formTitle = layerName + u" - Attributs d'entités"
    layers = QgsMapLayerRegistry.instance().mapLayers() # liste des couches du projet

    for w in iface.mainWindow().findChildren(QDialog):
        if w.windowTitle() == formTitle and w.isActiveWindow():
            w.reject()

    vYear = u"year_end"
    vStatus = u"fk_status"
    for feature in maCouche.getFeatures(QgsFeatureRequest(int(featureId))):
        msgBox = QMessageBox()
        if feature[vStatus] != 1301:
            if feature[vStatus] == 13002:
                text_arch = u"La conduite ID ="+str(featureId) + u" a déjà été archivée en " + str(feature[vYear])
            else:
                text_arch = u"La conduite ID ="+str(featureId) + u" ne peut être archivée si elle n'est pas en service"
            msgBox.setText(text_arch)
            msgBox.exec_()
        if feature[vStatus] == 1301:
            input_rep = QInputDialog()
            year_end, ok = input_rep.getInt(None, u"Annee d'archivage ", u"indiquez l'ann\xe9e d'archive (4 chiffres)", datetime.now().year, 1800,2999, 1)
            if ok:
                if not maCouche.isEditable():
                    maCouche.startEditing()
                feature[vStatus] = 13002
                feature[vYear] = year_end
                if iface.openFeatureForm(maCouche, feature):
                    maCouche.updateFeature(feature)
                    num_e = 0
                    num_v = 0
                    num_h = 0
                    num_i = 0
                    num_a = 0
                    for i in range(0,len(layerIds)):
                        if layerIds[i] not in layers:
                            text_layer = u"La couche avec ID = "+ str(layerIds[i]) + u" n'existe plus ou pas dans le projet, merci de vérifier la structure du projet sinon elle ne sera pas prise en compte dans l'archivage"
                            msgBox.setText(text_layer)
                            msgBox.exec_()
                    for layer in layers.values():
                        uri = QgsDataSourceURI(layer.source())
                        name = uri.schema() + "." + uri.table()
                        #if name in ["qwat_od.valve", "qwat_od.part" , "qwat_od.hydrant"]:
                        #if layer.name() == u"vannes" or layer.name() == u"\xe9l\xe9ments de montage" or layer.name() == u"hydrants" or layer.name() == u"introduction":
                        if layer.id() in layerIds:
                            # print unicode(layer.name())
                            num_elements = 0
                            if not layer.isEditable():
                                layer.startEditing()
                            req = QgsFeatureRequest(feature.geometry().boundingBox()).setFilterExpression(' "fk_status" = \'1301\' ')
                            for feat in layer.getFeatures(req):
                                if feat.geometry().intersects(feature.geometry()):
                                    num = 0
                                    for f in maCouche.getFeatures(QgsFeatureRequest(feat.geometry().boundingBox()).setFilterExpression(' "fk_status" != \'13002\' ')):
                                        if f.geometry().intersects(feat.geometry())  and f.id() != featureId:
                                            num += 1
                                    # print("int",feat.id(),num)
                                    if num == 0:
                                        if feat[vStatus] != 13002:
                                            feat[vStatus] = 13002
                                            feat[vYear] = year_end
                                            layer.updateFeature(feat)
                                            num_elements += 1
                            #if layer.name() == u"vannes":
                            if name == "qwat_od.valve":
                                num_v = num_elements
                            #if layer.name() == u"\xe9l\xe9ments de montage":
                            if name == "qwat_od.part" :
                                num_e = num_elements
                            #if layer.name() == u"hydrants":
                            if name == "qwat_od.hydrant":
                                num_h = num_elements
                            #if layer.name() == u"introduction":
                            if name == "qwat_od.subscriber":
                                num_i = num_elements
                            if name == "qwat_od.usr_prc_point":
                                num_a = num_elements

                    text = u"La conduite ID ="+str(featureId)+ u" a \xe9t\xe9 archiv\xe9e en " + str(year_end)
                    if num_v > 0 or num_e > 0 or num_h > 0 or num_i > 0:
                        text += u"\n ainsi que :"
                        if num_v > 0:
                            text += u"\n - " + str(num_v) + u" vannes"
                        if num_e > 0:
                            text += u"\n - " + str(num_e) + u" \xe9l\xe9ments de montage"
                        if num_h > 0:
                            text += u"\n - " + str(num_h) + u" hydrants"
                        if num_i > 0:
                            text += u"\n - " + str(num_i) + u" introductions"
                        if num_a > 0:
                            text += u"\n - " + str(num_a) + u" \xe9l\xe9ments de protection cathodique"
                    msgBox.setText(text)
                    msgBox.exec_()
                else:
                    pass
            else:
                pass
        else:
            pass