def unsetWarn(self):
     label_text = unsetLabelRed(self.label_vertical_extent.text().replace(
         u'\u26a0', '')).strip()
     self.label_vertical_extent.setText(label_text)
     self.label_vertical_extent.setToolTip(u'')
     self.superParent.unregister_incomplete_entries(
         self.objectName(),
         unsetLabelRed(self.label_vertical_extent.text()))
 def setWarn(self, text):
     if not unsetLabelRed(
             self.label_vertical_extent.text()).strip().endswith(u'\u26a0'):
         label_text = setLabelRed(self.label_vertical_extent.text() + u' ' +
                                  u'\u26a0')
         self.label_vertical_extent.setText(label_text)
     self.label_vertical_extent.setToolTip(tla.formatTooltip(text))
     self.superParent.register_incomplete_entries(
         self.objectName(),
         unsetLabelRed(self.label_vertical_extent.text()))
Esempio n. 3
0
 def check_mandatory_operations(self):
     if self.op_box.count() == 1:# op_box contains the button
         label_text = tla.setLabelRed(self.label_operation.text() + u' ' + u'\u26a0')
         self.label_operation.setText(label_text)
         self.label_operation.setToolTip(u"Deve ser definida pelo menos uma Operação.")
         self.superParent.register_mandatory_missingfield(self.objectName(), unsetLabelRed(self.label_operation.text()))
     else:
         label_text = tla.unsetLabelRed(self.label_operation.text().replace(u'\u26a0', '')).strip()
         self.label_operation.setText(label_text)
         self.label_operation.setToolTip(u"")
         self.superParent.unregister_mandatory_missingfield(self.objectName(), unsetLabelRed(self.label_operation.text()))
 def check_mandatory_contacts(self):
     if self.Contacts.count() == 0:
         label_text = tla.setLabelRed(
             self.label_contacts.text().replace(u'\u26a0', '') + u' ' +
             u'\u26a0')
         self.label_contacts.setText(label_text)
         self.label_contacts.setToolTip(
             u"É necessario pelo menos um contacto.")
         self.superParent.register_mandatory_missingfield(
             self.objectName(), unsetLabelRed(self.label_contacts.text()))
     else:
         label_text = tla.unsetLabelRed(self.label_contacts.text().replace(
             u'\u26a0', '')).strip()
         self.label_contacts.setText(label_text)
         self.label_contacts.setToolTip(u"")
         self.superParent.unregister_mandatory_missingfield(
             self.objectName(), unsetLabelRed(self.label_contacts.text()))
    def reftemocheck(self):
        if self.datestamp.get_date() is None and self.label_datestamp.toolTip(
        ) == "":

            label_text = tla.setLabelRed(
                self.label_datestamp.text().replace(u'\u26a0', '') + u' ' +
                u'\u26a0')
            self.label_datestamp.setText(label_text)
            self.label_datestamp.setToolTip(u"Elemento Obrigatorio.")
            self.superParent.register_mandatory_missingfield(
                self.objectName(), unsetLabelRed(self.label_datestamp.text()))
        elif self.datestamp.get_date(
        ) is not None and self.label_datestamp.toolTip() != "":
            label_text = tla.unsetLabelRed(self.label_datestamp.text().replace(
                u'\u26a0', '')).strip()
            self.label_datestamp.setText(label_text)
            self.label_datestamp.setToolTip(u'')
            self.superParent.unregister_mandatory_missingfield(
                self.objectName(), unsetLabelRed(self.label_datestamp.text()))
Esempio n. 6
0
    def check_mandatory_resolution(self):
        if self.spatiaResolutionUnknown.isChecked():
            self.box_spatial_res_tables.setDisabled(True)
        else:
            self.box_spatial_res_tables.setDisabled(False)

        if self.spatiaResolutionUnknown.isChecked() and self.label_spatialResolution.toolTip() != \
                u"":
            label_text = unsetLabelRed(
                self.label_spatialResolution.text().replace(u'\u26a0',
                                                            '')).strip()
            self.label_spatialResolution.setText(label_text)
            self.label_spatialResolution.setToolTip(u'')
            self.superParent.unregister_mandatory_missingfield(
                self.objectName(),
                unsetLabelRed(self.label_spatialResolution.text()))
            return

        if self.distance.model().rowCount() <= 0 and self.equivalentscale.model().rowCount() <= 0 and \
                        self.label_spatialResolution.toolTip() == u"":
            label_text = setLabelRed(
                self.label_spatialResolution.text().replace(u'\u26a0', '') +
                u' ' + u'\u26a0')
            self.label_spatialResolution.setText(label_text)
            self.label_spatialResolution.setToolTip(
                tla.formatTooltip(
                    u"Pelo menos um dos seguintes listas tem que conter um valor."
                ))
            self.superParent.register_mandatory_missingfield(
                self.objectName(),
                unsetLabelRed(self.label_spatialResolution.text()))

        elif (self.distance.model().rowCount() > 0 or self.equivalentscale.model().rowCount() > 0) \
                and self.label_spatialResolution.toolTip() != u"":
            label_text = unsetLabelRed(
                self.label_spatialResolution.text().replace(u'\u26a0',
                                                            '')).strip()
            self.label_spatialResolution.setText(label_text)
            self.label_spatialResolution.setToolTip(u'')
            self.superParent.unregister_mandatory_missingfield(
                self.objectName(),
                unsetLabelRed(self.label_spatialResolution.text()))
    def time_ext_check(self):
        self.set_diference()
        # clean state
        label_text = tla.unsetLabelRed(self.label_timeextension.text().replace(
            u'\u26a0', '')).strip()
        self.label_timeextension.setText(label_text)
        self.label_timeextension.setToolTip(u'')
        self.superParent.unregister_incomplete_entries(
            self.objectName(), unsetLabelRed(self.label_timeextension.text()))

        if self.enddate.is_null_date() and self.begindate.is_null_date():
            pass
        elif self.begindate.is_null_date():
            label_text = tla.setLabelRed(self.label_timeextension.text() +
                                         u' ' + u'\u26a0')
            self.label_timeextension.setText(label_text)
            self.label_timeextension.setToolTip(
                u"A data de início da extensão temporal não se encontra preenchida."
            )
            self.superParent.register_incomplete_entries(
                self.objectName(),
                unsetLabelRed(self.label_timeextension.text()))
        elif self.enddate.is_null_date():
            label_text = tla.setLabelRed(self.label_timeextension.text() +
                                         u' ' + u'\u26a0')
            self.label_timeextension.setText(label_text)
            self.label_timeextension.setToolTip(
                u"A data de fim da extensão temporal não se encontra preenchida."
            )
            self.superParent.register_incomplete_entries(
                self.objectName(),
                unsetLabelRed(self.label_timeextension.text()))
        elif self.begindate.get_dateTime() > self.enddate.get_dateTime():
            label_text = tla.setLabelRed(self.label_timeextension.text() +
                                         u' ' + u'\u26a0')
            self.label_timeextension.setText(label_text)
            self.label_timeextension.setToolTip(
                u"A duração da Extensão Temporal não se encontra correcta.")
            self.superParent.register_incomplete_entries(
                self.objectName(),
                unsetLabelRed(self.label_timeextension.text()))
    def reftemocheck(self):
        if self.creationdate.get_date() is None and self.revisiondate.get_date() is None and \
                        self.publicationdate.model().rowCount() == 0 and self.label_temporalREf.toolTip() == "":

            label_text = tla.setLabelRed(self.label_temporalREf.text() + u' ' +
                                         u'\u26a0')
            self.label_temporalREf.setText(label_text)
            self.label_temporalREf.setToolTip(
                u"Pelo menos um dos elementos tem que ser preenchido.")
            self.superParent.register_mandatory_missingfield(
                self.objectName(),
                unsetLabelRed(self.label_temporalREf.text()))
        elif not (self.creationdate.get_date() is None
                  and self.revisiondate.get_date() is None
                  and self.publicationdate.model().rowCount()
                  == 0) and self.label_temporalREf.toolTip() != "":
            label_text = tla.unsetLabelRed(
                self.label_temporalREf.text().replace(u'\u26a0', '')).strip()
            self.label_temporalREf.setText(label_text)
            self.label_temporalREf.setToolTip(u'')
            self.superParent.unregister_mandatory_missingfield(
                self.objectName(),
                unsetLabelRed(self.label_temporalREf.text()))
 def check_role(self):
     have_poc = False
     for cont in self.contacts_list:
         if cont.get_role() == 'pointOfContact':
             have_poc = True
             break
     if not have_poc:
         label_text = tla.setLabelRed(
             self.label_contacts.text().replace(u'\u26a0', '') + u' ' +
             u'\u26a0')
         self.label_contacts.setText(label_text)
         self.label_contacts.setToolTip(
             u"É necessario pelo menos um contacto com a função 'Contacto'."
         )
         self.superParent.register_mandatory_missingfield(
             self.objectName(), unsetLabelRed(self.label_contacts.text()))
     else:
         label_text = tla.unsetLabelRed(self.label_contacts.text().replace(
             u'\u26a0', '')).strip()
         self.label_contacts.setText(label_text)
         self.label_contacts.setToolTip(u"")
         self.superParent.unregister_mandatory_missingfield(
             self.objectName(), unsetLabelRed(self.label_contacts.text()))
    def snimar_keywords_special_validation(self):
        positives = 0

        for sn_type in cons.SNIMAR_KEYWORDS_MANDATORY_TYPES:
            if self.snimarkeywords.model().contains_at_column(self.combo_items_md_keywordtypecode_snimar.get(sn_type),
                                                              0):
                positives += 1
            else:
                break
        if positives == len(cons.SNIMAR_KEYWORDS_MANDATORY_TYPES) and self.label_snimarkeywords.toolTip() != u'':
            label_text = unsetLabelRed(self.label_snimarkeywords.text().replace(u'\u26a0', '')).strip()
            self.label_snimarkeywords.setText(label_text)
            self.label_snimarkeywords.setToolTip(u'')
            self.superParent.unregister_mandatory_missingfield(self.objectName(),
                                                               unsetLabelRed(self.label_snimarkeywords.text()))
        elif positives != len(cons.SNIMAR_KEYWORDS_MANDATORY_TYPES) and self.label_snimarkeywords.toolTip() == u'':
            label_text = setLabelRed(self.label_snimarkeywords.text() + u' ' + u'\u26a0')
            self.label_snimarkeywords.setText(label_text)
            self.label_snimarkeywords.setToolTip(
                tla.formatTooltip(
                    u"O Metadado tem que conter pelo menos uma palavra chave SNIMar dos seguintes tipos: " +
                    ', '.join(cons.SNIMAR_KEYWORDS_MANDATORY_TYPES) + u'.'))
            self.superParent.register_mandatory_missingfield(self.objectName(),
                                                             unsetLabelRed(self.label_snimarkeywords.text()))
 def unsetMandatory(self, label):
     label_text = tla.unsetLabelRed(label.text().replace(u'\u26a0',
                                                         '')).strip()
     label.setText(label_text)
     label.setToolTip(u"")