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()))
示例#2
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 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()))
示例#4
0
 def printHelp(self):
     QToolTip.showText(
         QCursor.pos(),
         tla.formatTooltip(self.superParent.helps['distributionPanel'][
             self.sender().objectName()]), None)
 def printHelp(self):
     QToolTip.showText(
         QCursor.pos(),
         tla.formatTooltip(self.superParent.superParent.
                           helps['chooseGeographicExtentOnMapDialog'][
                               self.sender().objectName()]), None)
示例#6
0
 def printHelp(self):
     QToolTip.showText(QCursor.pos(), tla.formatTooltip(
         self.superParent.helps['contactListManagerWindow'][self.sender().objectName()]),
                       None)
    def __init__(self, parent, orgslist, in_distribution=False):
        super(InlineContactWidget, self).__init__(parent)
        self.parent = parent
        self.superParent = parent.superParent
        self.setupUi(self)
        if platform.system() != "Linux":
            font = QFont()
            font.setFamily(u"Segoe UI Symbol")
            self.setFont(font)

        self.orgs = {}
        org = orgslist
        for x in org:
            name = org[x] + " (" + x + ")"
            self.orgs[x] = customCombo.CodeListItem(name, name, name)

        self.combo_org.setModel(
            customCombo.CustomComboBoxModel(
                self, [customCombo.CodeListItem(OUTRA, OUTRA, OUTRA)] +
                sorted(list(self.orgs.values()), key=lambda x: x.term_pt)))
        self.combo_org.currentIndexChanged.connect(self.check_org)

        # initialized where because if was on the spot the c++ garbage collector will destroy it and cause a error
        self.dialog = None
        tla.setupListView(self.phone, QgsFilterLineEdit, self, NoParent=True)
        tla.setupListView(self.email, QgsFilterLineEdit, self, NoParent=True)
        tla.setupListView(self.fax, QgsFilterLineEdit, self, NoParent=True)

        tla.setupMandatoryField(None, self.organization,
                                self.label_organization,
                                tla.formatTooltip(u"Elemento Obrigatório."))
        tla.setupMandatoryField(
            None, self.email, self.label_email,
            tla.formatTooltip(
                u"Deve ser indicado pelo menos um endereço eletrónico (\'<em>email</em>\')."
            ))

        for btn in self.findChildren(qwidgets.QPushButton,
                                     qcore.QRegExp('btn_*')):
            if '_add_' in btn.objectName():
                btn.setIcon(
                    qgui.QIcon(':/resourcesFolder/icons/plus_icon.svg'))
                btn.setText('')
            elif '_del_' in btn.objectName():
                btn.setIcon(
                    qgui.QIcon(':/resourcesFolder/icons/delete_icon.svg'))
                btn.setText('')
        for info in self.findChildren(qwidgets.QPushButton,
                                      qcore.QRegExp('info_*')):
            info.setIcon(qgui.QIcon(':/resourcesFolder/icons/help_icon.svg'))
            info.setText('')
            info.pressed.connect(self.printHelp)
        f = open(
            os.path.join(pluginDirectory('EditorMetadadosMarswInforbiomares'),
                         'resourcesFolder/stylesheet.qtcss'))
        self.sytlesheet = f.read()
        for btn in self.findChildren(qwidgets.QPushButton):
            btn.setStyleSheet(self.sytlesheet)
            btn.setFocusPolicy(Qt.NoFocus)
        self.name.editingFinished.connect(self.updateTitle)
        self.organization.textChanged.connect(self.updateTitle)
        self.city.editingFinished.connect(self.updateTitle)
        self.country.editingFinished.connect(self.updateTitle)
        self.email.model().dataChanged.connect(self.updateTitle)
        self.btn_del_contact.clicked.connect(self.deleteContact)
        self.btn_contact_list.clicked.connect(self.importFromListContacts)
        self.btn_addto_list_contacts.clicked.connect(self.addtoListOfContacts)
        self.mGroupBox.collapsedStateChanged.connect(self.hideButtons)
        self.btn_del_contact.setToolTip(tla.formatTooltip(u"Agagar contacto."))
        self.updateTitle()

        self.btn_addto_list_contacts.setIcon(
            qgui.QIcon(':/resourcesFolder/icons/save_icon.svg'))
        self.btn_addto_list_contacts.setToolTip(
            tla.formatTooltip(u"Guardar contacto na Lista de Contactos."))
        self.btn_contact_list.setIcon(
            qgui.QIcon(':/resourcesFolder/icons/contactsList_icon.svg'))
        self.btn_contact_list.setToolTip(u'Importar da Lista de Contactos')
        self.btn_contact_list.setText('')
        self.btn_addto_list_contacts.setText('')
        self.eater = tla.EatWheel()
        for x in self.findChildren(qwidgets.QComboBox):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        for x in self.findChildren(QDateTimeEdit):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        for x in self.findChildren(QDateEdit):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)

        if in_distribution:
            temp = {}
            temp["distributor"] = {}
            temp["distributor"]["en"] = "distributor"
            temp["distributor"]["pt"] = "Distribuidor"
            temp["distributor"]["description"] = "Distribuidor"

            self.roles = customCombo.dic_to_CustomComboBox_dic(temp)
            self.combo_role.setModel(
                customCombo.CustomComboBoxModel(
                    self,
                    sorted(list(self.roles.values()),
                           key=lambda x: x.term_pt)))
            self.combo_role.setDisabled(True)
        else:
            self.roles = customCombo.dic_to_CustomComboBox_dic(
                self.superParent.codelist["CI_RoleCode"])
            self.combo_role.setModel(
                customCombo.CustomComboBoxModel(
                    self,
                    sorted(list(self.roles.values()),
                           key=lambda x: x.term_pt)))
            tla.setupMandatoryField(
                None, self.combo_role, self.label_role,
                u"Tem que ser especificada uma função para o contacto.")
            self.combo_role.currentIndexChanged.connect(
                self.check_mandatory_completude)
 def printHelp(self):
     QToolTip.showText(
         QCursor.pos(),
         tla.formatTooltip(
             self.superParent.superParent.helps['chooseFreeKeywordDialog'][
                 self.sender().objectName()]), None)
 def setMandatory(self, label, toolTipmsg):
     label_text = tla.setLabelRed(label.text() + u' ' + u'\u26a0')
     label.setText(label_text)
     label.setToolTip(tla.formatTooltip(toolTipmsg))