Exemple #1
0
    def __init__(self, parent):
        super(InlineServiceOperation, self).__init__(parent)
        if platform.system() != "Linux":
            font = QFont()
            font.setFamily(u"Segoe UI Symbol")
            self.setFont(font)
        self.setupUi(self)

        self.parent = parent
        self.superParent = parent.superParent

        self.combo_items_dcp = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["DCPCodeList"])

        tla.setupListView(self.dcp, CustomComboBox, self, comboList=list(self.combo_items_dcp.values()), NoParent=True)
        tla.setupListView(self.connectionPoint, QgsFilterLineEdit, self, NoParent=True)
        tla.setupMandatoryField(None, self.operationName, self.label_operationName, u"Elemento Obrigatório.", )
        tla.setupMandatoryField(None, self.dcp, self.label_dcp, u"Obrigatório conter pelo menos uma entrada")
        tla.setupMandatoryField(None, self.connectionPoint, self.label_connectionPoint, u"Obrigatório conter pelo menos uma entrada")

        for btn in self.findChildren(QPushButton, QRegExp('btn_*')):
            if '_add_' in btn.objectName():
                btn.setIcon(QIcon(':/resourcesFolder/icons/plus_icon.svg'))
                btn.setText('')
            elif '_del_' in btn.objectName():
                btn.setIcon(QIcon(':/resourcesFolder/icons/delete_icon.svg'))
                btn.setText('')
        for info in self.findChildren(QPushButton, QRegExp('info_*')):
                     info.setIcon(QIcon(':/resourcesFolder/icons/help_icon.svg'))
                     info.setText('')
                     info.pressed.connect(self.printHelp)
        self.operationName.editingFinished.connect(self.update_title)
        self.update_title()
        self.btn_del_operation.setToolTip(u"Agagar Operação.")
        self.eater = tla.EatWheel()
        for x in self.findChildren(QComboBox):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        for x in self.findChildren(QDateTimeEdit):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        self.btn_del_operation.clicked.connect(self.deleteOperation)
        self.dcp.model().dataChanged.connect(self.update_title)
        self.connectionPoint.model().dataChanged.connect(self.update_title)
        self.combo_dcp.setCurrentIndex(self.combo_dcp.findText("WebServices"))
Exemple #2
0
    def __init__(self, parent, scope):
        super(DistributionWidget, self).__init__(parent)
        self.setupUi(self)
        self.superParent = self.parent()
        self.combo_items_ci_onlinefunctioncode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["CI_OnLineFunctionCode"])
        self.tableValidation = tval.Distribution(
            list(self.combo_items_ci_onlinefunctioncode.values()))

        tla.setupTableView(
            self,
            self.distributionformat, [u'Nome do Formato', u'Versão'],
            [QgsFilterLineEdit, QgsFilterLineEdit],
            [self.line_name, self.line_version],
            mandatorysources=[0, 1],
            validationfunction=self.tableValidation.distribuituionformat)
        self.distributionformat.horizontalHeader().setSectionResizeMode(
            qwidgets.QHeaderView.Stretch)

        self.combo_function.setModel(
            customCombo.CustomComboBoxModel(
                self,
                sorted(list(self.combo_items_ci_onlinefunctioncode.values()),
                       key=lambda x: x.term_pt)))
        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)

        self.btn_adi_contact.setIcon(
            qgui.QIcon(':/resourcesFolder/icons/plus_icon.svg'))

        tla.setupMandatoryField(
            self, self.distributionformat, self.label_distributionformat,
            u"Obrigatório conter pelo "
            u"menos uma entrada.")
        self.contacts_list = []
        self.btn_adi_contact.clicked.connect(self.addContact)
        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)

        self.scope = scope
        if self.scope == SCOPES.SERVICES:
            tla.setupTableView(self,
                               self.resourcelocator, [u'URL'],
                               [QgsFilterLineEdit], [self.line_linkage],
                               mandatorysources=[0])
            tla.setupMandatoryField(
                self, self.resourcelocator, self.label_resourcelocator,
                u"Obrigatório conter pelo menos uma entrada.")
            self.combo_function.setHidden(True)
            self.resourcelocator.verticalHeader().hide()
        else:
            tla.setupTableView(
                self,
                self.resourcelocator, [u'URL', u'Função'],
                [QgsFilterLineEdit, customCombo.CustomComboBox],
                [self.line_linkage, self.combo_function],
                comboList=[self.combo_items_ci_onlinefunctioncode],
                mandatorysources=[0, 1],
                validationfunction=self.tableValidation.resourcelocator)
        self.resourcelocator.horizontalHeader().setSectionResizeMode(
            qwidgets.QHeaderView.Stretch)
    def __init__(self, parent, scope):
        super(GeographicInfoWidget, self).__init__(parent)
        self.setupUi(self)
        self.superParent = self.parent()
        self.scope = scope

        headers = [
            u'Limite Oeste', u"Limite Este", u"Limite Norte", u"Limite Sul",
            u"Contém\nRecurso"
        ]

        column_types = [
            qwidgets.QDoubleSpinBox, qwidgets.QDoubleSpinBox,
            qwidgets.QDoubleSpinBox, qwidgets.QDoubleSpinBox,
            qwidgets.QCheckBox
        ]
        tla.setupTableView(self, self.boundingbox, headers, column_types,
                           GeoLocalizationDialog)
        self.boundingbox.horizontalHeader().setCascadingSectionResizes(True)
        self.boundingbox.horizontalHeader().setStretchLastSection(False)
        self.boundingbox.horizontalHeader().resizeSection(4, 60)
        self.boundingbox.horizontalHeader().setSectionResizeMode(
            4, qwidgets.QHeaderView.Fixed)
        self.boundingbox.horizontalHeader().setSectionResizeMode(
            3, qwidgets.QHeaderView.Stretch)
        self.boundingbox.horizontalHeader().setSectionResizeMode(
            2, qwidgets.QHeaderView.Stretch)
        self.boundingbox.horizontalHeader().setSectionResizeMode(
            1, qwidgets.QHeaderView.Stretch)
        self.boundingbox.horizontalHeader().setSectionResizeMode(
            0, qwidgets.QHeaderView.Stretch)

        headers = [u"Identificador", u"Contém\nRecurso"]
        column_types = [QgsFilterLineEdit, qwidgets.QCheckBox]
        sources = [self.line_identifier, self.check_haveResource]
        tla.setupTableView(self,
                           self.geographicidentifier,
                           headers,
                           column_types,
                           sources,
                           mandatorysources=[0])
        self.geographicidentifier.horizontalHeader(
        ).setCascadingSectionResizes(True)
        self.geographicidentifier.horizontalHeader().setStretchLastSection(
            False)
        self.geographicidentifier.horizontalHeader().resizeSection(1, 60)
        self.geographicidentifier.horizontalHeader().setSectionResizeMode(
            0, qwidgets.QHeaderView.Stretch)

        # Setup the reference system stuff
        self.combo_items = {}
        for element in self.superParent.reference_systems_list[
                "horizontal_refs"]:
            self.combo_items[str(
                element['code']).strip()] = Reference_System_Item(
                    code=element['code'],
                    name=element['name'],
                    codeSpace=element['codespace'])

        self.listValidation = lval.GeographicInfo(
            list(self.combo_items.values()))
        tla.setupListView(
            self.referencesystem,
            CustomComboBox,
            self,
            comboList=list(self.combo_items.values()),
            validationfunction=self.listValidation.referenceSystems)

        self.boundingbox.doubleClicked.connect(self.handleDoubleClick)

        self.combo_items_vert = {}
        for element in self.superParent.reference_systems_list[
                "vertical_refs"]:
            self.combo_items_vert[str(
                element['code']).strip()] = Reference_System_Item(
                    code=element['code'],
                    name=element['name'],
                    codeSpace='EPSG')
        self.referencesystemidentifier.setModel(
            customCombo.CustomComboBoxModel(self, [None] + sorted(
                list(self.combo_items_vert.values()), key=lambda x: x.name)))

        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)

        self.extent_btn.setIcon(
            qgui.QIcon(':/resourcesFolder/icons/globe.svg'))
        self.extent_btn.setText('')
        self.minimumValue.valueChanged.connect(
            self.check_consistency_altimetric_extention)
        self.maximumValue.valueChanged.connect(
            self.check_consistency_altimetric_extention)
        self.referencesystemidentifier.currentIndexChanged.connect(
            self.check_consistency_altimetric_extention)
        self.minimumValue.setSpecialValueText(" ")
        self.maximumValue.setSpecialValueText(" ")
        self.clear_min_max()

        tla.setupMandatoryField(
            self, self.referencesystem, self.label_referencesystem,
            u"Obrigatório conter pelo menos uma "
            u"entrada")
        tla.setupMandatoryField(
            self, self.boundingbox, self.label_boundingbox,
            u"A Especificação de uma caixa envolvente é obrigatoria.")
        # Button to open extent dialog
        self.extent_btn.clicked.connect(self.launch_extent_dialog)

        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)
        self.check_consistency_altimetric_extention()

        self.dialog = None
        self.check_haveResource.setChecked(True)
        self.btn_clear_all.pressed.connect(self.clear_min_max)
    def __init__(self, parent, scope):
        super(KeywordsWidget, self).__init__(parent)
        self.setupUi(self)

        self.superParent = self.parent()

        self.combo_items_inspire = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["INSPIRE"])
        self.combo_items_serviceClassification = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["ServiceClassification"])
        self.combo_items_topiccategory = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_TopicCategoryCode"])
        self.combo_items_datetype = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["CI_DateTypeCode"])
        self.combo_items_md_keywordtypecode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_KeywordTypeCode"])
        self.combo_items_md_keywordtypecode_snimar = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_KeywordTypeCodeSNIMar"])
        self.validatorList = lval.Keywords(list(self.combo_items_inspire.values()), list(self.combo_items_topiccategory.values()))
        self.validatorTables = tval.Keywords(list(self.combo_items_md_keywordtypecode.values()),
                                             list(self.combo_items_datetype.values()))

        sn_model = TableModel(self, [u"Tipo", u"Palavra-Chave", u"Versão Thesaurus"],
                              [customCombo.CustomComboBox, QLineEdit, QLineEdit],
                              self.snimarkeywords,
                              validationfunction=self.validatorTables.snimarkeywords)
        self.snimarkeywords.setModel(sn_model)
        self.snimarkeywords.resizeColumnsToContents()

        self.snimarkeywords.verticalHeader().setVisible(False)
        self.snimarkeywords.resizeRowsToContents()
        self.snimarkeywords.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.snimarkeywords.setSelectionMode(QAbstractItemView.ContiguousSelection)
        self.snimarkeywords.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.btn_open_snimarkeywords.clicked.connect(self.snimar_dialog)
        self.btn_del_snimarkeywords.clicked.connect(lambda: tla.removeSelectedFromList(self.snimarkeywords))

        self.wormskeywords.setColumnHidden(1, True)
        worms_model = TableModel(self, ['Palavra-chave', 'date'], [QLineEdit, QLineEdit], self.wormskeywords)
        self.wormskeywords.setModel(worms_model)
        self.wormskeywords.setColumnHidden(1, True)
        self.wormskeywords.resizeColumnsToContents()
        self.wormskeywords.verticalHeader().setVisible(False)
        self.wormskeywords.resizeRowsToContents()
        self.wormskeywords.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.wormskeywords.setSelectionMode(QAbstractItemView.ContiguousSelection)
        self.wormskeywords.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.btn_open_wormskeywords.clicked.connect(self.worms_dialog)
        self.btn_del_wormskeyword.clicked.connect(lambda: tla.removeSelectedFromList(self.wormskeywords))

        #crossref_model = TableModel(self, ['Autor', 'Titulo'], [QLineEdit, QLineEdit], self.crossrefkeywords)
        self.crossrefkeywords.setColumnHidden(1, True)
        self.crossrefkeywords.setColumnHidden(2, True)
        crossref_model = TableModel(self, ['Palavra-chave', 'doi', 'date'], [QLineEdit, QLineEdit, QLineEdit], self.crossrefkeywords)
        self.crossrefkeywords.setModel(crossref_model)
        self.crossrefkeywords.setColumnHidden(1, True)
        self.crossrefkeywords.setColumnHidden(2, True)
        self.crossrefkeywords.resizeColumnsToContents()
        self.crossrefkeywords.verticalHeader().setVisible(False)
        self.crossrefkeywords.resizeRowsToContents()
        self.crossrefkeywords.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.crossrefkeywords.setSelectionMode(QAbstractItemView.ContiguousSelection)
        self.crossrefkeywords.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.btn_open_crossrefkeywords.clicked.connect(self.crossref_dialog)
        self.btn_del_crossrefkeyword.clicked.connect(lambda: tla.removeSelectedFromList(self.crossrefkeywords))

        tla.setupTableView(self, self.freekeywords,
                           [u"Palavra-Chave", u"Tipo", u"Thesaurus", u"Data", u"Tipo de Data"],
                           [QgsFilterLineEdit, customCombo.CustomComboBox, QgsFilterLineEdit, QDateEdit,
                            customCombo.CustomComboBox],
                           FreeKeyWordsDialog,
                           comboList=[self.combo_items_md_keywordtypecode, self.combo_items_datetype],
                           validationfunction=self.validatorTables.freekeywords)
        self.freekeywords.doubleClicked.connect(self.handleDoubleClick)
        self.freekeywords.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        for btn in self.findChildren(QPushButton, qcore.QRegExp('btn_*')):
            if '_add_' in btn.objectName():
                btn.setIcon(QIcon(':/resourcesFolder/icons/plus_icon.svg'))
                btn.setText('')
            elif '_del_' in btn.objectName():
                btn.setIcon(QIcon(':/resourcesFolder/icons/delete_icon.svg'))
                btn.setText('')
        for info in self.findChildren(QPushButton, qcore.QRegExp('info_*')):
            info.setIcon(QIcon(':/resourcesFolder/icons/help_icon.svg'))
            info.setText('')
            info.pressed.connect(self.printHelp)
        self.btn_update_snimar.clicked.connect(self.launchupdatesnimar)
        self.snimarkeywords.model().rowsInserted.connect(self.snimar_keywords_special_validation)
        self.snimarkeywords.model().rowsRemoved.connect(self.snimar_keywords_special_validation)
        self.eater = tla.EatWheel()
        for x in self.findChildren(QComboBox):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        for x in self.findChildren(QDateTimeEdit):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        self.dialog = SNIMARKeywordsDialog(self, self.snimarkeywords.model(),
                                           self.combo_items_md_keywordtypecode_snimar)
        self.dialog.setWindowIcon(QIcon(":/resourcesFolder/icons/main_icon.png"))


        self.wormsDialog = WormsKeywordsDialog(self)
        self.wormsDialog.setWindowIcon(QIcon(":/resourcesFolder/icons/main_icon.png"))

        self.crossrefDialog = CrossrefKeywordsDialog(self)
        self.crossrefDialog.setWindowIcon(QIcon(":/resourcesFolder/icons/main_icon.png"))


        self.validatorTables.set_thesaurus(self.dialog.thesaurus_model)

        self.snimar_keywords_special_validation()
        self.scope = scope
        if self.scope == SCOPES.SERVICES:
            self.widget_topic.setHidden(True)
            self.topiccategory.setHidden(True)
            self.combo_topiccategory.setHidden(True)
            self.btn_add_topiccategory.setHidden(True)
            self.btn_del_topiccategory.setHidden(True)
            self.widget_inspire.setHidden(True)
            self.inspire.setHidden(True)
            self.btn_add_inspire.setHidden(True)
            self.btn_del_inspire.setHidden(True)
            self.combo_inspire.setHidden(True)
            tla.setupListView(self.serviceClassification, customCombo.CustomComboBox, self,
                              comboList=list(self.combo_items_serviceClassification.values()))
            tla.setupMandatoryField(self, self.serviceClassification, self.label_serviceClassification,
                                    u"Obrigatório conter pelo menos uma entrada")

        else:
            self.widget_serviceClassification.setHidden(True)
            self.serviceClassification.setHidden(True)
            self.btn_add_serviceClassification.setHidden(True)
            self.btn_del_serviceClassification.setHidden(True)
            self.combo_serviceClassification.setHidden(True)
            tla.setupListView(self.topiccategory, customCombo.CustomComboBox, self,
                              comboList=list(self.combo_items_topiccategory.values()),
                              validationfunction=self.validatorList.topiccategory)
            tla.setupMandatoryField(self, self.topiccategory, self.label_topiccategory,
                                    u"Obrigatório conter pelo menos uma "
                                    u"entrada")
            tla.setupListView(self.inspire, customCombo.CustomComboBox, self,
                              comboList=list(self.combo_items_inspire.values()),
                              validationfunction=self.validatorList.inspire)

            tla.setupMandatoryField(self, self.inspire, self.label_inspire,
                                    u"Obrigatório conter pelo menos uma entrada")
    def __init__(self, parent, scope):
        super(TemporalInfoWidget, self).__init__(parent)

        self.setupUi(self)
        self.creationdate = NullQDateEditWrapper(self.creationdate)
        self.revisiondate = NullQDateEditWrapper(self.revisiondate)
        self.superParent = self.parent()
        self.scope = scope
        self.combo_items_ci_datetypecode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["CI_DateTypeCode"])
        tla.setupListView(self.publicationdate,
                          QDateEdit,
                          self,
                          date_format=cons.DATE_FORMAT)

        # timeextension stuff (headers and types and such
        self.creationdate.clear()
        self.revisiondate.clear()
        self.date_publicationdate.clear()

        self.begindate = NullQDateTimeEditWrapper(self.begindate)
        self.enddate = NullQDateTimeEditWrapper(self.enddate)
        self.begindate.clear()
        self.enddate.clear()

        self.date_publicationdate.setDate(QDate.currentDate())
        self.publicationdate.model().rowsInserted.connect(self.reftemocheck)
        self.publicationdate.model().rowsRemoved.connect(self.reftemocheck)
        self.creationdate.get_original().editingFinished.connect(
            self.reftemocheck)
        self.revisiondate.get_original().editingFinished.connect(
            self.reftemocheck)
        self.creationdate.get_original().dateTimeChanged.connect(
            self.reftemocheck)
        self.revisiondate.get_original().dateTimeChanged.connect(
            self.reftemocheck)

        self.begindate.get_original().editingFinished.connect(
            self.time_ext_check)
        self.enddate.get_original().editingFinished.connect(
            self.time_ext_check)
        self.begindate.get_original().dateTimeChanged.connect(
            self.time_ext_check)
        self.enddate.get_original().dateTimeChanged.connect(
            self.time_ext_check)
        self.reftemocheck()
        self.time_ext_check()

        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('')
            elif '_clear_' in btn.objectName():
                btn.setIcon(
                    qgui.QIcon(':/resourcesFolder/icons/delete_field.svg'))
        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)
        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)

        self.btn_clear_creationdate.pressed.connect(
            lambda: self.creationdate.clear())
        self.btn_clear_revisiondate.pressed.connect(
            lambda: self.revisiondate.clear())
        self.btn_clear_begindate.pressed.connect(
            lambda: self.begindate.clear())
        self.btn_clear_enddate.pressed.connect(lambda: self.enddate.clear())
    def __init__(self, parent, scope):
        super(RestrictionsWidget, self).__init__(parent)
        self.setupUi(self)
        self.superParent = self.parent()
        self.scope = scope

        self.combo_items_md_restrictionscode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_RestrictionCode"])
        self.combo_items_md_classificationcode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_ClassificationCode"])
        self.listValidation = lval.Restrictions(
            list(self.combo_items_md_classificationcode.values()),
            list(self.combo_items_md_restrictionscode.values()))

        tla.setupListView(self.useLimitation, QgsFilterLineEdit, self)
        tla.setupListView(
            self.accessConstraints,
            customCombo.CustomComboBox,
            self,
            comboList=list(self.combo_items_md_restrictionscode.values()),
            validationfunction=self.listValidation.accessConstraints)
        tla.setupListView(
            self.useConstraints,
            customCombo.CustomComboBox,
            self,
            comboList=list(self.combo_items_md_restrictionscode.values()),
            validationfunction=self.listValidation.useConstraints)
        tla.setupListView(self.otherConstraints, QgsFilterLineEdit, self)

        tla.setupListView(
            self.securityrestrictions,
            customCombo.CustomComboBox,
            self,
            comboList=list(self.combo_items_md_classificationcode.values()),
            validationfunction=self.listValidation.securityrestrictions)

        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)

        tla.setupMandatoryField(self, self.useLimitation,
                                self.label_useLimitation,
                                u"Obrigatório conter pelomenos uma entrada")
        tla.setupMandatoryField(self, self.accessConstraints,
                                self.label_accessConstraints,
                                u"Obrigatório conter pelomenos uma entrada")
        tla.setupMandatoryField(self, self.useConstraints,
                                self.label_useConstraints,
                                u"Obrigatório conter pelo menos uma entrada")

        self.accessConstraints.model().rowsInserted.connect(self.check_others)
        self.accessConstraints.model().rowsRemoved.connect(self.check_others)
        self.useConstraints.model().rowsInserted.connect(self.check_others)
        self.useConstraints.model().rowsRemoved.connect(self.check_others)

        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)
    def __init__(self, parent):
        super(MetadataWidget, self).__init__(parent)
        self.setupUi(self)
        self.datestamp = NullQDateEditWrapper(self.datestamp)
        self.superParent = self.parent()

        tla.setupMandatoryField(self, self.fileidentifier,
                                self.label_fileidentifier,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.datestamp, self.label_datestamp,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.language, self.label_language,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.stdname, self.label_stdname,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.stdversion, self.label_stdversion,
                                u"Elemento obrigatório em falta")

        self.pal = qgui.QPalette()
        self.pal.setColor(self.pal.Background, qgui.QColor(cons.ERROR_COLOR))
        self.contacts_list = []

        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('')
            elif '_clear_' in btn.objectName():
                btn.setIcon(
                    qgui.QIcon(':/resourcesFolder/icons/delete_field.svg'))

            split_name = btn.objectName().split('_')
            if len(split_name) == 4 and split_name[2] == 'uuid':
                btn.clicked.connect(self.generate_uuid)

        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)

        self.btn_adi_contact.setIcon(
            qgui.QIcon(':/resourcesFolder/icons/plus_icon.svg'))
        self.combo_items_languagecode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["LanguageCode"])
        self.combo_items_md_charactersetCode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_CharacterSetCode"])

        self.language.setModel(
            customCombo.CustomComboBoxModel(
                self,
                sorted(list(self.combo_items_languagecode.values()),
                       key=lambda x: x.term_pt)))
        self.language.setCurrentIndex(
            self.language.findText(cons.PREDEF_LANG_METADATA))
        self.language.setDisabled(True)
        self.datestamp.clear()
        self.characterset.setModel(
            customCombo.CustomComboBoxModel(
                self,
                sorted(list(self.combo_items_md_charactersetCode.values()),
                       key=lambda x: x.term_pt)))
        self.characterset.setCurrentIndex(
            self.characterset.findText(cons.PREDEF_CHARSET))

        self.stdname.setText(cons.SNIMAR_PROFILE_NAME)
        self.stdname.setDisabled(True)
        self.stdversion.setDisabled(True)
        self.stdversion.setText(cons.SNIMAR_PROFILE_VERSION)
        self.btn_adi_contact.clicked.connect(self.addContact)
        self.check_mandatory_contacts()

        self.eater = tla.EatWheel()
        for x in self.findChildren(qwidgets.QComboBox):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        for x in self.findChildren(QDateEdit):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)

        self.btn_clear_datestamp.pressed.connect(
            lambda: self.datestamp.clear())

        self.datestamp.get_original().editingFinished.connect(
            self.reftemocheck)
        self.datestamp.get_original().dateTimeChanged.connect(
            self.reftemocheck)
        self.reftemocheck()
Exemple #8
0
    def __init__(self, parent, edition_mode=True):
        super(ContactsDialog, self).__init__(parent)
        if platform.system() != "Linux":
            font = QFont()
            font.setFamily(u"Segoe UI Symbol")
            self.setFont(font)
        # VIEW SETUP#############################################################
        self.setupUi(self)
        self.superParent = self.parent()

        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('')
            elif '_clear_' in btn.objectName():
                btn.setIcon(qgui.QIcon(':/resourcesFolder/icons/delete_field.svg'))

        lists = ['phone', 'fax', 'email']
        for item in lists:
            btn = self.findChild(qwidgets.QPushButton, 'btn_add_' + item)
            btn.clicked.connect(self.add_list_row)
            btn = self.findChild(qwidgets.QPushButton, 'btn_del_' + item)
            btn.clicked.connect(self.del_list_row)

        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)

        # Contact list connections and variables
        self.contact_array = None
        self.open_contact_array()
        self.current_contact = None
        self.contact_list.clearSelection()
        self.contactPanel.setDisabled(True)

        # SETUP THE DIALOG MODE
        if edition_mode:  # EDITION MODE

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

            self.combo_org.setModel(
                cus.CustomComboBoxModel(self,
                                        [cus.CodeListItem(OUTRA, OUTRA, OUTRA)] + sorted(list(self.orgs.values()),
                                                                                         key=lambda x: x.term_pt)))
            self.combo_org.currentIndexChanged.connect(self.check_org)
            self.btn_contact_add.setVisible(True)
            self.btn_contact_del.setVisible(True)
            self.cancelChanges()
            self.btn_add_contact_metadata.setVisible(False)

            # CONNECTING FIELDS THAT CAN BE CHANGED
            self.name.textChanged.connect(self.changesMade)
            self.organization.textChanged.connect(self.changesMade)
            self.city.textChanged.connect(self.changesMade)
            self.postalcode.textChanged.connect(self.changesMade)
            self.country.textChanged.connect(self.changesMade)
            self.delivery_point.textChanged.connect(self.changesMade)
            self.phone.model().rowsInserted.connect(self.changesMade)
            self.fax.model().rowsInserted.connect(self.changesMade)
            self.email.model().rowsInserted.connect(self.changesMade)
            self.online.textChanged.connect(self.changesMade)
            self.phone.model().rowsRemoved.connect(self.changesMade)
            self.fax.model().rowsRemoved.connect(self.changesMade)
            self.email.model().rowsRemoved.connect(self.changesMade)
            self.online.textChanged.connect(self.changesMade)

            # SETUP MANDATORY FIELDS VISUAL VALIDATION
            self.organization.editingFinished.connect(self.setup_mandatory_label)
            self.name.editingFinished.connect(self.setup_mandatory_label)
            self.setup_mandatory_label()

            # ACTIONS SETUP
            self.btn_contact_save.clicked.connect(self.save_contact)  # save contact
            self.btn_cancelClose.clicked.connect(self.cancelChanges)  # cancel changes and revert contact
            self.btn_contact_add.clicked.connect(
                self.new_contact)  # add new contact if changes in current contact exists ask...
            self.btn_contact_del.clicked.connect(self.delete_contact)  # delete contact with confirmation

            self.contact_list.itemClicked.connect(
                self.selection_changed)  # change current selection if changes exists ask...
        else:  # EXPORT MODE
            self.contactPanel.hide()
            self.btn_add_contact_metadata.setVisible(True)
            self.btn_contact_add.setVisible(False)
            self.btn_contact_del.setVisible(False)
            self.adjustSize()

        # ACTIONS SETUP
        self.contact_list.itemClicked.connect(self.selection_changed_export_Mode)  # change current selection
        # ACTIONS FUNCTIONS
        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)
Exemple #9
0
    def __init__(self, parent, scope):
        super(QualityWidget, self).__init__(parent)
        self.setupUi(self)
        self.conformancedate = NullQDateEditWrapper(self.conformancedate)
        self.superParent = self.parent()
        self.scope = scope
        self.combo_items_ci_datetypecode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["CI_DateTypeCode"])
        self.conformancedatetype.setModel(
            customCombo.CustomComboBoxModel(
                self, [None] +
                sorted(list(self.combo_items_ci_datetypecode.values()),
                       key=lambda x: x.term_pt)))
        if scope == CONS.Scopes.CDG or scope == CONS.Scopes.SERIES:

            tla.setupTableView(
                self,
                self.processsteps, [u"Descrição", u"Data", u"Justificação"],
                [QgsFilterLineEdit, QDateTimeEdit, QgsFilterLineEdit], [
                    self.line_description, self.date_processdate,
                    self.line_rationale
                ],
                mandatorysources=[0],
                validationfunction=tval.Quality().processsteps,
                date_format=cons.DATE_TIME_FORMAT)
            self.processsteps.horizontalHeader().setCascadingSectionResizes(
                False)
            self.processsteps.horizontalHeader().setStretchLastSection(False)
            self.processsteps.horizontalHeader().resizeSection(1, 260)
            self.processsteps.horizontalHeader().setDefaultSectionSize(260)
            self.processsteps.horizontalHeader().setMinimumSectionSize(260)
            self.processsteps.horizontalHeader().setSectionResizeMode(
                1, qwidgets.QHeaderView.Fixed)
            self.processsteps.horizontalHeader().setSectionResizeMode(
                2, qwidgets.QHeaderView.Stretch)
            self.processsteps.horizontalHeader().setSectionResizeMode(
                0, qwidgets.QHeaderView.Stretch)
            self.date_processdate.setDate(QDate.currentDate())

            tla.setupListView(self.source, QgsFilterLineEdit, self)
            tla.setupMandatoryField(self, self.statement, self.label_statement,
                                    u"Elemento obrigatório.")
        else:
            self.panel_hist.hide()

        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('')
            elif '_clear_' in btn.objectName():
                btn.setIcon(
                    qgui.QIcon(':/resourcesFolder/icons/delete_field.svg'))
        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)

        tla.setupMandatoryField(self, self.conformancetitle,
                                self.label_conformancetitle,
                                u"Elemento obrigatório.")
        tla.setupMandatoryField(self, self.conformancedate,
                                self.label_conformancedate,
                                u"Elemento obrigatório.")
        tla.setupMandatoryField(self, self.conformancedatetype,
                                self.label_conformancedatetype,
                                u"Elemento obrigatório.")
        tla.setupMandatoryField(self, self.conformanceexplanation,
                                self.label_conformanceexplanation,
                                u"Elemento obrigatório.")

        self.eater = tla.EatWheel()
        for x in self.findChildren(qwidgets.QComboBox):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        for x in self.findChildren(QDateEdit):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        self.btn_clear_conformancedate.pressed.connect(
            lambda: self.conformancedate.clear())

        self.btn_INSPIRE.pressed.connect(self.set_default_dataquality_report)
        self.statement.textChanged.connect(self.checkHistText)
        self.hist_data.stateChanged.connect(self.setHist)
    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)
Exemple #11
0
    def __init__(self, parent, scope):

        super(IdentificationWidget, self).__init__(parent)
        self.setupUi(self)
        self.superParent = self.parent()
        self.contacts_list = []
        self.scope = scope
        # CODELISTS LOAD
        self.combo_items_md_maintenancefrequencycode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_MaintenanceFrequencyCode"])
        self.combo_items_languagecode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["LanguageCode"])
        self.combo_items_md_spatialrepresentationtypecode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_SpatialRepresentationTypeCode"])
        self.combo_items_md_charactersetCode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_CharacterSetCode"])
        self.combo_items_md_scopecode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_ScopeCode"])
        self.combo_items_md_progressCode = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["MD_ProgressCode"])
        self.combo_item_service_type = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["ServiceType"])
        self.combo_items_couplingType = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["CouplingType"])
        self.combo_items_distance_units = customCombo.dic_to_CustomComboBox_dic(
            self.superParent.codelist["DistanceUnits"])

        # Lists
        self.validator = lval.Identification(
            list(self.combo_items_md_maintenancefrequencycode.values()),
            list(self.combo_items_languagecode.values()),
            list(self.combo_items_md_spatialrepresentationtypecode.values()),
            list(self.combo_items_md_progressCode.values()))
        self.tablevalidator = tval.Identification()
        tla.setupListView(self.credits, QgsFilterLineEdit, self)
        # ---------

        tla.setupListView(
            self.resourcemaintenance,
            customCombo.CustomComboBox,
            self,
            comboList=list(
                self.combo_items_md_maintenancefrequencycode.values()),
            validationfunction=self.validator.resourcemaintenance)
        # ---------

        tla.setupListView(self.language,
                          customCombo.CustomComboBox,
                          self,
                          comboList=list(
                              self.combo_items_languagecode.values()),
                          validationfunction=self.validator.language)

        # ----------------------------
        tla.setupListView(self.resourcestatus,
                          customCombo.CustomComboBox,
                          self,
                          comboList=list(
                              self.combo_items_md_progressCode.values()),
                          validationfunction=self.validator.resourcestatus)

        self.combo_language.setCurrentIndex(
            self.combo_language.findText(cons.PREDEF_LANG_RESOURCES))
        # ---------

        # tables
        tla.setupTableView(self,
                           self.identifiers,
                           [u'Identificador', u'Espaço de Nomes'],
                           [QgsFilterLineEdit, QgsFilterLineEdit],
                           [self.line_identifier, self.line_namespace],
                           validationfunction=self.tablevalidator.identifiers,
                           mandatorysources=[0])
        self.identifiers.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)

        tla.setupMandatoryField(self, self.hierarchylevel,
                                self.label_hierarchylevel,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.title, self.label_title,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.abstract_, self.label_abstract,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.titleEN, self.label_titleEN,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.abstractEN, self.label_abstractEN,
                                u"Elemento obrigatório em falta")
        tla.setupMandatoryField(self, self.resourcemaintenance,
                                self.label_resourcemaintenance,
                                u"Obrigatório conter pelo menos uma entrada")
        tla.setupMandatoryField(self, self.identifiers, self.label_identifiers,
                                u"Obrigatório conter pelo menos uma entrada")
        tla.setupMandatoryField(self, self.characterset,
                                self.label_characterset,
                                u"Elemento obrigatório em falta")

        # ComboBoxes Initialization(Not the ones associated with List/Table Views!!!!)

        self.characterset.setModel(
            customCombo.CustomComboBoxModel(
                self, [None] +
                sorted(list(self.combo_items_md_charactersetCode.values()),
                       key=lambda x: x.term_pt)))
        self.characterset.setCurrentIndex(
            self.characterset.findText(cons.PREDEF_CHARSET))
        self.hierarchylevel.setModel(
            customCombo.CustomComboBoxModel(
                self,
                [None] + sorted(list(self.combo_items_md_scopecode.values()),
                                key=lambda x: x.term_pt)))
        # ----------------------------------------------------------------------#
        self.btn_adi_contact.clicked.connect(self.addContact)
        self.check_mandatory_contacts()
        # Buttons Icons initialization

        for btn in self.findChildren(QPushButton, qcore.QRegExp('btn_*')):
            if '_add_' in btn.objectName():
                btn.setIcon(QIcon(':/resourcesFolder/icons/plus_icon.svg'))
                btn.setText('')
            elif '_del_' in btn.objectName():
                btn.setIcon(QIcon(':/resourcesFolder/icons/delete_icon.svg'))
                btn.setText('')

        for info in self.findChildren(QPushButton, qcore.QRegExp('info_*')):
            info.setIcon(QIcon(':/resourcesFolder/icons/help_icon.svg'))
            info.setText('')
            info.pressed.connect(self.printHelp)
        self.btn_adi_contact.setIcon(
            QIcon(':/resourcesFolder/icons/plus_icon.svg'))
        self.btn_gen_uuid_identifiers.clicked.connect(
            lambda: self.identifiers.model().addNewRow(
                [str(uuid.uuid4()), None]))

        self.eater = tla.EatWheel()
        for x in self.findChildren(QComboBox):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)
        for x in self.findChildren(QDateTimeEdit):
            x.installEventFilter(self.eater)
            x.setFocusPolicy(Qt.StrongFocus)

        self.hierarchylevel.setCurrentIndex(
            self.hierarchylevel.findText(
                self.combo_items_md_scopecode[SCOPES.get_string_representation(
                    self.scope)].term_pt))
        self.hierarchylevel.setDisabled(True)

        if scope == SCOPES.CDG or scope == SCOPES.SERIES:

            tla.setupTableView(self,
                               self.distance, ["Valor", "Unidade"],
                               [QDoubleSpinBox, customCombo.CustomComboBox],
                               [self.spin_distance, self.combo_distance],
                               comboList=[self.combo_items_distance_units],
                               mandatorysources=[0, 1])
            self.distance.verticalHeader().setMinimumSectionSize(20)
            self.distance.verticalHeader().setDefaultSectionSize(100)
            self.distance.horizontalHeader().setSectionResizeMode(
                QHeaderView.Stretch)
            self.combo_distance.setModel(
                customCombo.CustomComboBoxModel(
                    self,
                    sorted(list(self.combo_items_distance_units.values()),
                           key=lambda x: x.term_pt)))
            self.combo_distance.setCurrentIndex(
                self.combo_distance.findText('Metros'))

            tla.setupListView(
                self.equivalentscale,
                QSpinBox,
                self,
                fraction_flag=True,
                validationfunction=self.validator.equivalentscale)
            tla.setupListView(
                self.geographicrepresentation,
                customCombo.CustomComboBox,
                self,
                comboList=list(
                    self.combo_items_md_spatialrepresentationtypecode.values(
                    )),
                validationfunction=self.validator.geographicrepresentation)

            self.equivalentscale.model().rowsInserted.connect(
                self.check_mandatory_resolution)
            self.equivalentscale.model().rowsRemoved.connect(
                self.check_mandatory_resolution)
            self.distance.model().rowsInserted.connect(
                self.check_mandatory_resolution)
            self.distance.model().rowsRemoved.connect(
                self.check_mandatory_resolution)
            self.widget_service.setHidden(True)
            self.serviceType.setHidden(True)
            self.widget_coupling.setHidden(True)
            self.couplingType.setHidden(True)
            self.widget_operatesOn.setHidden(True)
            self.operatesOn.setHidden(True)
            self.btn_add_operatesOn.setHidden(True)
            self.btn_del_operatesOn.setHidden(True)
            self.line_operatesOn.setHidden(True)
            self.check_mandatory_resolution()
            tla.setupMandatoryField(
                self, self.geographicrepresentation,
                self.label_geographicrepresentation,
                u"Obrigatório conter pelo menos uma entrada")
            tla.setupMandatoryField(
                self, self.language, self.label_language,
                u"Obrigatório conter pelo menos uma entrada")

            self.spatiaResolutionUnknown.stateChanged.connect(
                self.check_mandatory_resolution)
        elif scope == SCOPES.SERVICES:
            tla.setupListView(self.operatesOn, QgsFilterLineEdit, self)
            self.serviceType.setModel(
                customCombo.CustomComboBoxModel(
                    self, [None] +
                    sorted(list(self.combo_item_service_type.values()),
                           key=lambda x: x.term_pt)))
            self.couplingType.setModel(
                customCombo.CustomComboBoxModel(
                    self, [None] +
                    sorted(list(self.combo_items_couplingType.values()),
                           key=lambda x: x.term_pt)))
            # spatialRespresentationType AND language
            self.box_language_geoReprType.setHidden(True)
            # spatialRepresentation
            self.box_spatial_resolution.setHidden(True)
            # charset
            self.widget_charset.setHidden(True)
            self.characterset.setHidden(True)
            tla.setupMandatoryField(self, self.couplingType,
                                    self.label_couplingType,
                                    u"Campo Obrigatório.")
            tla.setupMandatoryField(self, self.serviceType,
                                    self.label_serviceType,
                                    u"Campo Obrigatório.")