Beispiel #1
0
    def __init__(self, layer, feature_id, attr_update=False, parent=None):

        super(DMADialog, self).__init__(parent)
        DatabaseHelper.__init__(self)
        self.setupUi(self)
        self.__layer = layer
        self.__feature_id = feature_id
        self.__attr_update = attr_update
        self.__feature = None

        if not layer.isEditable():
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)

        try:
            PluginUtils.run_query(PluginUtils.populate_network_cbox, 2, self.network_cbox)
        except (WntException, SQLAlchemyError) as e:
            PluginUtils.show_error(self, self.tr('Database Error'), e.args[0])
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
            return

        request = QgsFeatureRequest().setFilterFid(feature_id)
        try:
            self.__feature = layer.getFeatures(request).next()
        except StopIteration:
            print "Feature not found"
            return

        self.document_form = DocumentForm('co_dma', self.__feature_id)
        self.tabWidget.addTab(self.document_form, 'Documents')

        if attr_update:
            self.__populate_details()
Beispiel #2
0
    def __init__(self, network_id, parent=None):

        super(NetworkDialog, self).__init__(parent)
        DatabaseHelper.__init__(self)
        self.setupUi(self)
        self.__network_id = network_id

        try:
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.dim_pressure_cbox, ClNominalPressure,
                                  True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.op_pressure_cbox, ClNominalPressure,
                                  True)
        except (WntException, SQLAlchemyError) as e:
            PluginUtils.show_error(self, self.tr('Database Error'), e.args[0])
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
            return

        if network_id is None:
            co_network = CoNetwork()
            co_network.network_number = 'XXX'
            co_network.network_name = 'XXX'
            self.session.add(co_network)
            self.session.flush()
            self.__network_id = co_network.id
        else:
            self.__populate_network_details()

        self.document_form = DocumentForm('co_network', self.__network_id)
        self.tabWidget.addTab(self.document_form, 'Documents')
Beispiel #3
0
    def __init__(self, layer, feature_id, attr_update=False, parent=None):

        super(UtilityStationDialog, self).__init__(parent)
        DatabaseHelper.__init__(self)
        self.setupUi(self)
        self.__layer = layer
        self.__feature_id = feature_id
        self.__attr_update = attr_update
        self.__feature = None

        self.status_change_date_edit.setDate(QDate.currentDate())

        if not layer.isEditable():
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)

        try:
            PluginUtils.run_query(PluginUtils.populate_network_cbox, 2,
                                  self.network_cbox)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.purpose_cbox, ClPurposeOfStation, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.station_type_cbox, ClTypeOfStation,
                                  True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.capacity_unit_cbox, ClCapacityUnit,
                                  True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.operating_state_cbox, ClOperatingState,
                                  True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.location_cbox, ClLocation, True)

        except (WntException, SQLAlchemyError) as e:
            PluginUtils.show_error(self, self.tr('Database Error'), e.args[0])
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
            return

        request = QgsFeatureRequest().setFilterFid(feature_id)
        try:
            self.__feature = layer.getFeatures(request).next()
        except StopIteration:
            print "Feature not found"
            return

        self.damage_form = DamageForm('co_utility_station', self.__feature_id)
        self.tabWidget.addTab(self.damage_form, 'Damages')
        self.maintenance_form = MaintenanceForm('co_utility_station',
                                                self.__feature_id)
        self.tabWidget.addTab(self.maintenance_form, 'Maintenance')
        self.document_form = DocumentForm('co_utility_station',
                                          self.__feature_id)
        self.tabWidget.addTab(self.document_form, 'Documents')

        if attr_update:
            self.__populate_details()
        else:
            self.operating_state_cbox.setCurrentIndex(
                self.operating_state_cbox.findData('OP', Qt.UserRole))
Beispiel #4
0
    def __init__(self, layer, feature_id, attr_update=False, parent=None):

        super(PipelineSegmentDialog, self).__init__(parent)
        DatabaseHelper.__init__(self)
        self.setupUi(self)
        self.__layer = layer
        self.__feature_id = feature_id
        self.__attr_update = attr_update
        self.__feature = None

        self.installation_date_edit.setDate(QDate.currentDate())
        self.status_change_date_edit.setDate(QDate.currentDate())
        self.date_of_last_inspection_edit.setDate(QDate.currentDate())

        if not layer.isEditable():
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)

        try:
            PluginUtils.run_query(PluginUtils.populate_network_cbox, 2, self.network_cbox)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.inspection_interval_unit_cbox,
                                  ClIntervalUnit, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.operating_state_cbox,
                                  ClOperatingState, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.pipeline_type_cbox,
                                  ClTypeOfPipelineSegment, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.mounting_type_cbox,
                                  ClMountingTypeOfPipelineSegment, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.material_cbox, ClMaterial, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.placement_type_cbox,
                                  ClTypeOfPlacement, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.nominal_width_cbox,
                                  ClNominalWidthOfPipelineSegment, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.positional_accuracy_cbox,
                                  ClPositionalAccuracy, True)
        except (WntException, SQLAlchemyError) as e:
            PluginUtils.show_error(self, self.tr('Database Error'), e.args[0])
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
            return

        request = QgsFeatureRequest().setFilterFid(feature_id)
        try:
            self.__feature = layer.getFeatures(request).next()
        except StopIteration:
            print "Feature not found"
            return

        self.damage_form = DamageForm('co_pipeline_segment', self.__feature_id)
        self.tabWidget.addTab(self.damage_form, 'Damages')
        self.maintenance_form = MaintenanceForm('co_pipeline_segment', self.__feature_id)
        self.tabWidget.addTab(self.maintenance_form, 'Maintenance')
        self.document_form = DocumentForm('co_pipeline_segment', self.__feature_id)
        self.tabWidget.addTab(self.document_form, 'Documents')

        if attr_update:
            self.__populate_details()
        else:
            self.operating_state_cbox.setCurrentIndex(self.operating_state_cbox.findData('OP', Qt.UserRole))
Beispiel #5
0
    def __init__(self, layer, feature_id, attr_update=False, parent=None):

        super(DamageDialog, self).__init__(parent)
        DatabaseHelper.__init__(self)
        self.setupUi(self)
        self.__layer = layer
        self.__feature_id = feature_id
        self.__attr_update = attr_update
        self.__feature = None
        self.__nearby_features = []
        self.__set_asset_type = None
        self.__set_asset_id = None

        self.occurrence_date_edit.setDate(QDate.currentDate())
        self.registration_date_edit.setDate(QDate.currentDate())
        self.repair_date_edit.setDate(QDate.currentDate())

        if not layer.isEditable():
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)

        try:
            PluginUtils.run_query(PluginUtils.populate_network_cbox, 2, self.network_cbox)
            PluginUtils.run_query(self.__populate_received_from_cbox)
            PluginUtils.run_query(self.__populate_repaired_by_cbox)
            PluginUtils.run_query(self.__populate_repair_task_cbox)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.type_cbox, ClDamageType, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.cause_cbox, ClDamageCause, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2, self.status_cbox, ClDamageStatus, True)
        except (WntException, SQLAlchemyError) as e:
            PluginUtils.show_error(self, self.tr('Database Error'), e.args[0])
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
            return

        request = QgsFeatureRequest().setFilterFid(feature_id)
        try:
            self.__feature = layer.getFeatures(request).next()
        except StopIteration:
            print "Feature not found"
            return

        self.document_form = DocumentForm('co_damage', self.__feature_id)
        self.tabWidget.addTab(self.document_form, 'Documents')

        self.material_form = RepairMaterialForm('co_damage', self.__feature_id)
        self.tabWidget.addTab(self.material_form, 'Repair Material')

        self.__populate_nearby_features()

        self.warning_label.clear()

        if attr_update:
            self.__populate_details()
        else:
            self.status_cbox.setCurrentIndex(1)
Beispiel #6
0
    def __init__(self, layer, feature_id, attr_update=False, parent=None):

        super(LineCasingDialog, self).__init__(parent)
        DatabaseHelper.__init__(self)
        self.setupUi(self)
        self.__layer = layer
        self.__feature_id = feature_id
        self.__attr_update = attr_update
        self.__feature = None

        self.installation_date_edit.setDate(QDate.currentDate())
        self.date_of_last_inspection_edit.setDate(QDate.currentDate())

        if not layer.isEditable():
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)

        try:
            PluginUtils.run_query(PluginUtils.populate_network_cbox, 2,
                                  self.network_cbox)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.inspection_intervall_unit_cbox,
                                  ClIntervalUnit, True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.casing_type_cbox, ClTypeOfLineCasing,
                                  True)
            PluginUtils.run_query(PluginUtils.populate_codelist_cbox, 2,
                                  self.jacket_pipe_diameter_cbox,
                                  ClNominalWidthOfJacketPipe, True)
        except (WntException, SQLAlchemyError) as e:
            PluginUtils.show_error(self, self.tr('Database Error'), e.args[0])
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
            return

        request = QgsFeatureRequest().setFilterFid(feature_id)
        try:
            self.__feature = layer.getFeatures(request).next()
        except StopIteration:
            print "Feature not found"
            return

        self.damage_form = DamageForm('co_line_casing', self.__feature_id)
        self.tabWidget.addTab(self.damage_form, 'Damages')
        self.maintenance_form = MaintenanceForm('co_line_casing',
                                                self.__feature_id)
        self.tabWidget.addTab(self.maintenance_form, 'Maintenance')
        self.document_form = DocumentForm('co_line_casing', self.__feature_id)
        self.tabWidget.addTab(self.document_form, 'Documents')

        if attr_update:
            self.__populate_details()